* Re: xbps-src: new vopt_feat helper
2023-06-27 16:07 [PR PATCH] xbps-src: new vopt_feat helper cinerea0
@ 2023-07-01 21:57 ` Chocimier
2023-07-02 18:17 ` eli-schwartz
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Chocimier @ 2023-07-01 21:57 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 245 bytes --]
New comment by Chocimier on void-packages repository
https://github.com/void-linux/void-packages/pull/44663#issuecomment-1616151025
Comment:
I would merge it but not under that name, even meson don't call that feat.
Also please join commits.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: xbps-src: new vopt_feat helper
2023-06-27 16:07 [PR PATCH] xbps-src: new vopt_feat helper cinerea0
2023-07-01 21:57 ` Chocimier
@ 2023-07-02 18:17 ` eli-schwartz
2023-07-04 2:30 ` [PR PATCH] [Updated] " cinerea0
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: eli-schwartz @ 2023-07-02 18:17 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 333 bytes --]
New comment by eli-schwartz on void-packages repository
https://github.com/void-linux/void-packages/pull/44663#issuecomment-1616759347
Comment:
> I would merge it but not under that name, even meson don't call that feat.
Or,
> **feat**
> *noun*
>
> - an achievement that requires great courage, skill, or strength.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PR PATCH] [Updated] xbps-src: new vopt_feat helper
2023-06-27 16:07 [PR PATCH] xbps-src: new vopt_feat helper cinerea0
2023-07-01 21:57 ` Chocimier
2023-07-02 18:17 ` eli-schwartz
@ 2023-07-04 2:30 ` cinerea0
2023-07-04 2:31 ` cinerea0
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: cinerea0 @ 2023-07-04 2:30 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 926 bytes --]
There is an updated pull request by cinerea0 against master on the void-packages repository
https://github.com/cinerea0/void-packages vopt_feat
https://github.com/void-linux/void-packages/pull/44663
xbps-src: new vopt_feat helper
#### Testing the changes
- I tested the changes in this PR: **briefly**
I didn't check this against every template where the pattern appears, but it works in the test cases I tried.
---
This helper function reduces boilerplate for [Meson's "feature" build options](https://mesonbuild.com/Build-options.html#features). Right now these are handled using the pattern `-D<property>=$(vopt_if <option> enabled disabled)`, which occurs 78 times in our templates.
Note that this does *not* allow you to set the property to "auto", but I can't think of any situation where that would be desirable.
A patch file from https://github.com/void-linux/void-packages/pull/44663.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-vopt_feat-44663.patch --]
[-- Type: text/x-diff, Size: 1469 bytes --]
From fe51e16418ea1013617e880b94acba7ec268e71e Mon Sep 17 00:00:00 2001
From: cinerea0 <cinerea0@disroot.org>
Date: Mon, 3 Jul 2023 22:30:27 -0400
Subject: [PATCH] xbps-src: new vopt_feature helper
---
Manual.md | 5 +++++
common/environment/setup/options.sh | 8 ++++++++
2 files changed, 13 insertions(+)
diff --git a/Manual.md b/Manual.md
index 63f10f354582..5a183e6c3d18 100644
--- a/Manual.md
+++ b/Manual.md
@@ -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:
diff --git a/common/environment/setup/options.sh b/common/environment/setup/options.sh
index 83e0f9420f9e..f75430b82cd8 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_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"
+}
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: xbps-src: new vopt_feat helper
2023-06-27 16:07 [PR PATCH] xbps-src: new vopt_feat helper cinerea0
` (2 preceding siblings ...)
2023-07-04 2:30 ` [PR PATCH] [Updated] " cinerea0
@ 2023-07-04 2:31 ` cinerea0
2023-07-04 2:40 ` eli-schwartz
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: cinerea0 @ 2023-07-04 2:31 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 339 bytes --]
New comment by cinerea0 on void-packages repository
https://github.com/void-linux/void-packages/pull/44663#issuecomment-1619375017
Comment:
> I would merge it but not under that name, even meson don't call that feat.
Since Meson refers to them as "features", I've renamed it to `vopt_feature`.
> Also please join commits.
Done.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: xbps-src: new vopt_feat helper
2023-06-27 16:07 [PR PATCH] xbps-src: new vopt_feat helper cinerea0
` (3 preceding siblings ...)
2023-07-04 2:31 ` cinerea0
@ 2023-07-04 2:40 ` eli-schwartz
2023-07-04 2:40 ` eli-schwartz
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: eli-schwartz @ 2023-07-04 2:40 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 561 bytes --]
New comment by eli-schwartz on void-packages repository
https://github.com/void-linux/void-packages/pull/44663#issuecomment-1619380470
Comment:
Prior art: https://devmanual.gentoo.org/eclass-reference/meson.eclass/index.html#lbAF
meson_use is equivalent to vopt_bool
meeon_feature is equivalent to the proposed vopt_feature
They, too, do not support defining it to auto. A Gentoo USE flag is either enabled or disabled, and besides they explicitly want to enforce that automagic dependencies do not happen, since they don't build in chroots/containers. :D
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: xbps-src: new vopt_feat helper
2023-06-27 16:07 [PR PATCH] xbps-src: new vopt_feat helper cinerea0
` (4 preceding siblings ...)
2023-07-04 2:40 ` eli-schwartz
@ 2023-07-04 2:40 ` eli-schwartz
2023-07-26 18:31 ` [PR PATCH] [Merged]: xbps-src: new vopt_feature helper Chocimier
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: eli-schwartz @ 2023-07-04 2:40 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 561 bytes --]
New comment by eli-schwartz on void-packages repository
https://github.com/void-linux/void-packages/pull/44663#issuecomment-1619380470
Comment:
Prior art: https://devmanual.gentoo.org/eclass-reference/meson.eclass/index.html#lbAF
meson_use is equivalent to vopt_bool
meson_feature is equivalent to the proposed vopt_feature
They, too, do not support defining it to auto. A Gentoo USE flag is either enabled or disabled, and besides they explicitly want to enforce that automagic dependencies do not happen, since they don't build in chroots/containers. :D
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PR PATCH] [Merged]: xbps-src: new vopt_feature helper
2023-06-27 16:07 [PR PATCH] xbps-src: new vopt_feat helper cinerea0
` (5 preceding siblings ...)
2023-07-04 2:40 ` eli-schwartz
@ 2023-07-26 18:31 ` Chocimier
2023-07-26 18:32 ` Chocimier
2023-07-26 20:38 ` cinerea0
8 siblings, 0 replies; 10+ messages in thread
From: Chocimier @ 2023-07-26 18:31 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 769 bytes --]
There's a merged pull request on the void-packages repository
xbps-src: new vopt_feature helper
https://github.com/void-linux/void-packages/pull/44663
Description:
#### Testing the changes
- I tested the changes in this PR: **briefly**
I didn't check this against every template where the pattern appears, but it works in the test cases I tried.
---
This helper function reduces boilerplate for [Meson's "feature" build options](https://mesonbuild.com/Build-options.html#features). Right now these are handled using the pattern `-D<property>=$(vopt_if <option> enabled disabled)`, which occurs 78 times in our templates.
Note that this does *not* allow you to set the property to "auto", but I can't think of any situation where that would be desirable.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: xbps-src: new vopt_feature helper
2023-06-27 16:07 [PR PATCH] xbps-src: new vopt_feat helper cinerea0
` (6 preceding siblings ...)
2023-07-26 18:31 ` [PR PATCH] [Merged]: xbps-src: new vopt_feature helper Chocimier
@ 2023-07-26 18:32 ` Chocimier
2023-07-26 20:38 ` cinerea0
8 siblings, 0 replies; 10+ messages in thread
From: Chocimier @ 2023-07-26 18:32 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 182 bytes --]
New comment by Chocimier on void-packages repository
https://github.com/void-linux/void-packages/pull/44663#issuecomment-1652303256
Comment:
Awaiting PR switching to new function.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: xbps-src: new vopt_feature helper
2023-06-27 16:07 [PR PATCH] xbps-src: new vopt_feat helper cinerea0
` (7 preceding siblings ...)
2023-07-26 18:32 ` Chocimier
@ 2023-07-26 20:38 ` cinerea0
8 siblings, 0 replies; 10+ messages in thread
From: cinerea0 @ 2023-07-26 20:38 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 219 bytes --]
New comment by cinerea0 on void-packages repository
https://github.com/void-linux/void-packages/pull/44663#issuecomment-1652460027
Comment:
> Awaiting PR switching to new function.
I'll try to handle this tonight.
^ permalink raw reply [flat|nested] 10+ messages in thread