xbps-src: new vopt_feature helper
This commit is contained in:
parent
65435ab244
commit
5bb9d7c856
|
@ -1204,6 +1204,11 @@ package accordingly. Additionally, the following functions are available:
|
|||
Outputs `-D<property>=true` if the option is set, or
|
||||
`-D<property>=false` otherwise.
|
||||
|
||||
- *vopt_feature()* `vopt_feature <option> <property>`
|
||||
|
||||
Same as `vopt_bool`, but uses `-D<property=enabled` and
|
||||
`-D<property>=disabled` respectively.
|
||||
|
||||
The following example shows how to change a source package that uses GNU
|
||||
configure to enable a new build option to support PNG images:
|
||||
|
||||
|
|
|
@ -36,3 +36,11 @@ vopt_bool() {
|
|||
fi
|
||||
vopt_if "$1" "-D${prop}=true" "-D${prop}=false"
|
||||
}
|
||||
|
||||
vopt_feature() {
|
||||
local opt="$1" prop="${2:-$1}"
|
||||
if [ "$#" -gt "2" ]; then
|
||||
msg_error "vopt_feature $opt: $(($# - 2)) excess parameter(s)\n"
|
||||
fi
|
||||
vopt_if "$1" "-D${prop}=enabled" "-D${prop}=disabled"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue