Gentoo Archives: gentoo-dev

From: James Le Cuirot <chewi@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH 2/2] meson.eclass: add MYMESONARGS variable
Date: Wed, 08 Apr 2020 22:41:06
Message-Id: 20200408234046.7c1fd70b@symphony.aura-online.co.uk
In Reply to: [gentoo-dev] [PATCH 2/2] meson.eclass: add MYMESONARGS variable by Mike Gilbert
1 On Wed, 8 Apr 2020 16:34:52 -0400
2 Mike Gilbert <floppym@g.o> wrote:
3
4 > This was requested to allow users to pass aribtrary arguments to meson.
5 >
6 > Signed-off-by: Mike Gilbert <floppym@g.o>
7 > ---
8 > eclass/meson.eclass | 11 +++++++++++
9 > 1 file changed, 11 insertions(+)
10 >
11 > diff --git a/eclass/meson.eclass b/eclass/meson.eclass
12 > index 3e3a2e2f7a2e..0932a7ed427f 100644
13 > --- a/eclass/meson.eclass
14 > +++ b/eclass/meson.eclass
15 > @@ -84,6 +84,11 @@ fi
16 > # Optional meson test arguments as Bash array; this should be defined before
17 > # calling meson_src_test.
18 >
19 > +# @VARIABLE: MYMESONARGS
20 > +# @DEFAULT_UNSET
21 > +# @DESCRIPTION:
22 > +# User-controlled environment variable containing arguments to be passed to
23 > +# meson in meson_src_configure.
24 >
25 > read -d '' __MESON_ARRAY_PARSER <<"EOF"
26 > import shlex
27 > @@ -236,6 +241,9 @@ meson_src_configure() {
28 >
29 > BUILD_DIR="${BUILD_DIR:-${WORKDIR}/${P}-build}"
30 >
31 > + # Handle quoted whitespace
32 > + eval "local -a MYMESONARGS=( ${MYMESONARGS} )"
33 > +
34 > mesonargs+=(
35 > # Arguments from ebuild
36 > "${emesonargs[@]}"
37 > @@ -243,6 +251,9 @@ meson_src_configure() {
38 > # Arguments passed to this function
39 > "$@"
40 >
41 > + # Arguments from user
42 > + "${MYMESONARGS[@]}"
43 > +
44 > # Source directory
45 > "${EMESON_SOURCE:-${S}}"
46 >
47
48 I didn't mean for you to do this yourself so thank you very much
49 indeed! You've done a nice job, I've tested it, and it works perfectly.
50
51 Cheers,
52 --
53 James Le Cuirot (chewi)
54 Gentoo Linux Developer