xbps-src: move vopt_* helpers to environment/setup/options.sh.
This commit is contained in:
parent
790202ddbd
commit
6d20b9a05a
2 changed files with 22 additions and 21 deletions
22
common/environment/setup/options.sh
Normal file
22
common/environment/setup/options.sh
Normal 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}"
|
||||||
|
}
|
||||||
|
|
|
@ -566,24 +566,3 @@ remove_cross_pkg() {
|
||||||
msg_error "failed to remove cross-${XBPS_CROSS_TRIPLET} (error $rval)\n"
|
msg_error "failed to remove cross-${XBPS_CROSS_TRIPLET} (error $rval)\n"
|
||||||
fi
|
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}"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue