xbps-src: move vopt_* helpers to environment/setup/options.sh.

This commit is contained in:
Juan RP 2014-08-30 09:10:11 +02:00
parent 790202ddbd
commit 6d20b9a05a
2 changed files with 22 additions and 21 deletions

View file

@ -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}"
}

View file

@ -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}"
}