rename vopt_onoff to vopt_bool which returns -D<prop>=true|false

This makes it more generic and allows us to use it freely between
cmake and meson build styles.
This commit is contained in:
maxice8 2018-05-03 07:41:48 -03:00 committed by Enno Boland
parent 9a60b4f245
commit daf68c6d59
2 changed files with 7 additions and 7 deletions

View File

@ -830,10 +830,10 @@ package accordingly. Additionally, the following functions are available:
Emits an error and exits if both options are set at the same time.
- *vopt_onoff()* `vopt_onoff <option> <property>`
- *vopt_bool()* `vopt_bool <option> <property>`
Outputs `-D<property>=ON` if the option is set, or
`-D<property>=OFF` otherwise.
Outputs `-D<property>=true` if the option is set, or
`-D<property>=false` otherwise.
The following example shows how to change a source package that uses GNU
configure to enable a new build option to support PNG images:

View File

@ -29,12 +29,12 @@ vopt_conflict() {
fi
}
vopt_onoff() {
vopt_bool() {
local opt="$1" prop="$2"
if [ "$#" -lt "2" ]; then
msg_error "vopt_onoff <build_option> <property>: missing values\n"
msg_error "vopt_bool <build_option> <property>: missing values\n"
elif [ "$#" -gt "2" ]; then
msg_error "vopt_onoff $opt: $(($# - 2)) excess parameter(s)\n"
msg_error "vopt_bool $opt: $(($# - 2)) excess parameter(s)\n"
fi
vopt_if "$1" "-D${prop}=ON" "-D${prop}=OFF"
vopt_if "$1" "-D${prop}=true" "-D${prop}=false"
}