Gentoo Archives: gentoo-dev

From: Mart Raudsepp <leio@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH] meson.eclass: add meson_use function
Date: Sat, 23 Dec 2017 04:03:09
Message-Id: 1514001774.18181.5.camel@gentoo.org
In Reply to: Re: [gentoo-dev] [PATCH] meson.eclass: add meson_use function by "Jan Chren (rindeal)"
1 On L, 2017-12-16 at 18:29 +0100, Jan Chren (rindeal) wrote:
2 > On 15 December 2017 at 17:38, Mike Gilbert <floppym@g.o>
3 > wrote:
4 > > ---
5 > >  eclass/meson.eclass | 13 +++++++++++++
6 > >  1 file changed, 13 insertions(+)
7 > >
8 > > diff --git a/eclass/meson.eclass b/eclass/meson.eclass
9 > > index 2c943dd6ae27..71735fbfc67d 100644
10 > > --- a/eclass/meson.eclass
11 > > +++ b/eclass/meson.eclass
12 > > @@ -137,6 +137,19 @@ _meson_create_cross_file() {
13 > >         EOF
14 > >  }
15 > >
16 > > +# @FUNCTION: meson_use
17 > > +# @USAGE: <USE flag> [option name]
18 > > +# @DESCRIPTION:
19 > > +# Given a USE flag and meson project option, outputs a string
20 > > like:
21 > > +#
22 > > +#   -Doption=true
23 > > +#   -Doption=false
24 > > +#
25 > > +# If the project option is unspecified, it defaults to the USE
26 > > flag.
27 > > +meson_use() {
28 > > +       usex "$1" "-D${2-$1}=true" "-D${2-$1}=false"
29 > > +}
30 > > +
31 > >  # @FUNCTION: meson_src_configure
32 > >  # @DESCRIPTION:
33 > >  # This is the meson_src_configure function.
34 > > --
35 > > 2.15.1
36
37 Looks good to me.
38 If we ever find any reason to support non-boolean options, we can
39 figure out a third/fourth argument for it, or new function, or just
40 using usex or whatnot in the ebuilds. Unless we want to have this
41 boolean one named as meson_bool or whatnot. But this is the most common
42 one, so in line with others as "meson_use" sounds best to me.
43
44 > Isn't this the beginning of this wheel
45 > https://github.com/gentoo/gentoo/commit/e9116b1aebc819a10410960cbb493
46 > 1aa5e399af1
47 > ?
48
49 Unlike in cmake, where the define key and USE flag name practically
50 never line up, with meson they most often do, and there will be no
51 capitalization tries and whatnot that the cmake stuff did.