diff --git a/common/environment/setup/options.sh b/common/environment/setup/options.sh new file mode 100644 index 00000000000..8f1b81d4b08 --- /dev/null +++ b/common/environment/setup/options.sh @@ -0,0 +1,22 @@ +# vim: set ts=4 sw=4 et: + +vopt_if() { + local opt="$1" t="$2" f="$3" + name="build_option_$opt" + if [ ${!name} ]; then + echo -n "$t" + else + echo -n "$f" + fi +} + +vopt_with() { + local opt="$1" flag="${2:-$1}" + vopt_if "$1" "--with-${flag}" "--without-${flag}" +} + +vopt_enable() { + local opt="$1" flag="${2:-$1}" + vopt_if "$1" "--enable-${flag}" "--disable-${flag}" +} + diff --git a/common/xbps-src/shutils/common.sh b/common/xbps-src/shutils/common.sh index 33efc57cd95..3183add3c28 100644 --- a/common/xbps-src/shutils/common.sh +++ b/common/xbps-src/shutils/common.sh @@ -566,24 +566,3 @@ remove_cross_pkg() { msg_error "failed to remove cross-${XBPS_CROSS_TRIPLET} (error $rval)\n" fi } - -vopt_if() { - local opt="$1" t="$2" f="$3" - name="build_option_$opt" - if [ ${!name} ]; then - echo -n "$t" - else - echo -n "$f" - fi -} - -vopt_with() { - local opt="$1" flag="${2:-$1}" - vopt_if "$1" "--with-${flag}" "--without-${flag}" -} - -vopt_enable() { - local opt="$1" flag="${2:-$1}" - vopt_if "$1" "--enable-${flag}" "--disable-${flag}" -} -