From 388c51caf1dcfccfdda76a06b468841570a42131 Mon Sep 17 00:00:00 2001 From: cinerea0 Date: Tue, 27 Jun 2023 11:05:28 -0400 Subject: [PATCH 1/2] xbps-src: new vopt_feat helper Meson helper function like vopt_bool to reduce boilerplate for "feature" options --- common/environment/setup/options.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/common/environment/setup/options.sh b/common/environment/setup/options.sh index 83e0f9420f9e..95293e222fa2 100644 --- a/common/environment/setup/options.sh +++ b/common/environment/setup/options.sh @@ -36,3 +36,11 @@ vopt_bool() { fi vopt_if "$1" "-D${prop}=true" "-D${prop}=false" } + +vopt_feat() { + local opt="$1" prop="${2:-$1}" + if [ "$#" -gt "2" ]; then + msg_error "vopt_feat $opt: $(($# - 2)) excess parameter(s)\n" + fi + vopt_if "$1" "-D${prop}=enabled" "-D${prop}=disabled" +} From be92a5a460904a30d53b674522f8f5d23c38de0c Mon Sep 17 00:00:00 2001 From: cinerea0 Date: Tue, 27 Jun 2023 12:06:17 -0400 Subject: [PATCH 2/2] Manual.md: document vopt_feat --- Manual.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Manual.md b/Manual.md index 1670863cbe54..bbd8d023ff59 100644 --- a/Manual.md +++ b/Manual.md @@ -1158,6 +1158,11 @@ package accordingly. Additionally, the following functions are available: Outputs `-D=true` if the option is set, or `-D=false` otherwise. +- *vopt_feat()* `vopt_feat