public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] meson.eclass: add meson_use function
@ 2017-12-15 16:38 Mike Gilbert
  2017-12-16 17:29 ` Jan Chren (rindeal)
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Gilbert @ 2017-12-15 16:38 UTC (permalink / raw
  To: gentoo-dev

---
 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: <USE flag> [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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [gentoo-dev] [PATCH] meson.eclass: add meson_use function
  2017-12-15 16:38 [gentoo-dev] [PATCH] meson.eclass: add meson_use function Mike Gilbert
@ 2017-12-16 17:29 ` Jan Chren (rindeal)
  2017-12-23  4:02   ` Mart Raudsepp
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Chren (rindeal) @ 2017-12-16 17:29 UTC (permalink / raw
  To: gentoo-dev

On 15 December 2017 at 17:38, Mike Gilbert <floppym@gentoo.org> 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: <USE flag> [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
?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-dev] [PATCH] meson.eclass: add meson_use function
  2017-12-16 17:29 ` Jan Chren (rindeal)
@ 2017-12-23  4:02   ` Mart Raudsepp
  0 siblings, 0 replies; 3+ messages in thread
From: Mart Raudsepp @ 2017-12-23  4:02 UTC (permalink / raw
  To: gentoo-dev

On L, 2017-12-16 at 18:29 +0100, Jan Chren (rindeal) wrote:
> On 15 December 2017 at 17:38, Mike Gilbert <floppym@gentoo.org>
> 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: <USE flag> [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.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-12-23  4:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-15 16:38 [gentoo-dev] [PATCH] meson.eclass: add meson_use function Mike Gilbert
2017-12-16 17:29 ` Jan Chren (rindeal)
2017-12-23  4:02   ` Mart Raudsepp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox