Re: [gentoo-dev] [PATCH] meson.eclass: add meson_use function

2017-12-22 Thread Mart Raudsepp
On L, 2017-12-16 at 18:29 +0100, Jan Chren (rindeal) wrote:
> On 15 December 2017 at 17:38, Mike Gilbert 
> wrote:
> > ---
> >  eclass/meson.eclass | 13 +
> >  1 file changed, 13 insertions(+)
> > 
> > diff --git a/eclass/meson.eclass b/eclass/meson.eclass
> > index 2c943dd6ae27..71735fbfc67d 100644
> > --- a/eclass/meson.eclass
> > +++ b/eclass/meson.eclass
> > @@ -137,6 +137,19 @@ _meson_create_cross_file() {
> > EOF
> >  }
> > 
> > +# @FUNCTION: meson_use
> > +# @USAGE:  [option name]
> > +# @DESCRIPTION:
> > +# Given a USE flag and meson project option, outputs a string
> > like:
> > +#
> > +#   -Doption=true
> > +#   -Doption=false
> > +#
> > +# If the project option is unspecified, it defaults to the USE
> > flag.
> > +meson_use() {
> > +   usex "$1" "-D${2-$1}=true" "-D${2-$1}=false"
> > +}
> > +
> >  # @FUNCTION: meson_src_configure
> >  # @DESCRIPTION:
> >  # This is the meson_src_configure function.
> > --
> > 2.15.1

Looks good to me.
If we ever find any reason to support non-boolean options, we can
figure out a third/fourth argument for it, or new function, or just
using usex or whatnot in the ebuilds. Unless we want to have this
boolean one named as meson_bool or whatnot. But this is the most common
one, so in line with others as "meson_use" sounds best to me.

> Isn't this the beginning of this wheel
> https://github.com/gentoo/gentoo/commit/e9116b1aebc819a10410960cbb493
> 1aa5e399af1
> ?

Unlike in cmake, where the define key and USE flag name practically
never line up, with meson they most often do, and there will be no
capitalization tries and whatnot that the cmake stuff did.




Re: [gentoo-dev] [PATCH] meson.eclass: add meson_use function

2017-12-16 Thread Jan Chren (rindeal)
On 15 December 2017 at 17:38, Mike Gilbert  wrote:
> ---
>  eclass/meson.eclass | 13 +
>  1 file changed, 13 insertions(+)
>
> diff --git a/eclass/meson.eclass b/eclass/meson.eclass
> index 2c943dd6ae27..71735fbfc67d 100644
> --- a/eclass/meson.eclass
> +++ b/eclass/meson.eclass
> @@ -137,6 +137,19 @@ _meson_create_cross_file() {
> EOF
>  }
>
> +# @FUNCTION: meson_use
> +# @USAGE:  [option name]
> +# @DESCRIPTION:
> +# Given a USE flag and meson project option, outputs a string like:
> +#
> +#   -Doption=true
> +#   -Doption=false
> +#
> +# If the project option is unspecified, it defaults to the USE flag.
> +meson_use() {
> +   usex "$1" "-D${2-$1}=true" "-D${2-$1}=false"
> +}
> +
>  # @FUNCTION: meson_src_configure
>  # @DESCRIPTION:
>  # This is the meson_src_configure function.
> --
> 2.15.1
>
>

Isn't this the beginning of this wheel
https://github.com/gentoo/gentoo/commit/e9116b1aebc819a10410960cbb4931aa5e399af1
?



[gentoo-dev] [PATCH] meson.eclass: add meson_use function

2017-12-15 Thread Mike Gilbert
---
 eclass/meson.eclass | 13 +
 1 file changed, 13 insertions(+)

diff --git a/eclass/meson.eclass b/eclass/meson.eclass
index 2c943dd6ae27..71735fbfc67d 100644
--- a/eclass/meson.eclass
+++ b/eclass/meson.eclass
@@ -137,6 +137,19 @@ _meson_create_cross_file() {
EOF
 }
 
+# @FUNCTION: meson_use
+# @USAGE:  [option name]
+# @DESCRIPTION:
+# Given a USE flag and meson project option, outputs a string like:
+#
+#   -Doption=true
+#   -Doption=false
+#
+# If the project option is unspecified, it defaults to the USE flag.
+meson_use() {
+   usex "$1" "-D${2-$1}=true" "-D${2-$1}=false"
+}
+
 # @FUNCTION: meson_src_configure
 # @DESCRIPTION:
 # This is the meson_src_configure function.
-- 
2.15.1