Gentoo Archives: gentoo-dev

From: Mike Gilbert <floppym@g.o>
To: Gentoo Dev <gentoo-dev@l.g.o>
Cc: William Hubbs <williamh@g.o>
Subject: Re: [gentoo-dev] [PATCH] meson.eclass: stop calling ninja
Date: Tue, 24 Aug 2021 15:16:24
Message-Id: CAJ0EP438AsurN_LEF=Et0RA+8k0NyKpqdNAGEeCGv51Mmc-rCg@mail.gmail.com
In Reply to: [gentoo-dev] [PATCH] meson.eclass: stop calling ninja by William Hubbs
1 On Tue, Aug 24, 2021 at 1:35 AM William Hubbs <williamh@g.o> wrote:
2 >
3 > Use the compile and install subcommands of meson instead of calling
4 > ninja. This allows for the possibility of a different back end.
5 >
6 > Signed-off-by: William Hubbs <williamh@g.o>
7 > ---
8 > eclass/meson.eclass | 24 +++++++++++++++++++++---
9 > 1 file changed, 21 insertions(+), 3 deletions(-)
10 >
11 > diff --git a/eclass/meson.eclass b/eclass/meson.eclass
12 > index 2a563e367c6..e9c9b155096 100644
13 > --- a/eclass/meson.eclass
14 > +++ b/eclass/meson.eclass
15 > @@ -379,7 +379,21 @@ meson_src_configure() {
16 > meson_src_compile() {
17 > debug-print-function ${FUNCNAME} "$@"
18 >
19 > - eninja -C "${BUILD_DIR}" "$@"
20 > + local mesoncompileargs=(
21 > + -C "${BUILD_DIR}"
22 > + )
23 > + if [[ -n ${NINJAOPTS} ]]; then
24 > + mesoncompileargs+=(
25 > + --jobs "$(makeopts_jobs ${NINJAOPTS})"
26 > + --load-average "$(makeopts_loadavg ${NINJAOPTS})"
27 > + )
28 > + elif [[ -n ${MAKEOPTS} ]]; then
29 > + mesoncompileargs+=(
30 > + --jobs "$(makeopts_jobs ${MAKEOPTS})"
31 > + --load-average "$(makeopts_loadavg ${MAKEOPTS})"
32
33 ${MAKEOPTS} should be quoted on the above 2 lines.
34
35 makeopts_loadavg outputs 999 by default if the load average is not
36 specified. Please override this as "0" by passing it as the second
37 argument.
38
39 > + )
40 > +
41 > + meson compile "${mesoncompileargs[@]}" "$@" || die "compile failed"
42 > }
43 >
44 > # @FUNCTION: meson_src_test
45 > @@ -406,13 +420,17 @@ meson_src_test() {
46 > }
47 >
48 > # @FUNCTION: meson_src_install
49 > -# @USAGE: [extra ninja install arguments]
50 > +# @USAGE: [extra meson install arguments]
51 > # @DESCRIPTION:
52 > # This is the meson_src_install function.
53 > meson_src_install() {
54 > debug-print-function ${FUNCNAME} "$@"
55 >
56 > - DESTDIR="${D}" eninja -C "${BUILD_DIR}" install "$@"
57 > + local mesoninstallargs=(
58 > + -C "${BUILD_DIR}" "$@"
59 > + --destdir "${D}"
60 > + )
61 > + meson install "${mesoninstallargs[@]}" "$@"
62
63 You are including "$@" twice: once in mesoninstallargs, and once on
64 the above line. Please remove it from mesoninstallargs.