Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: 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 07:55:17
Message-Id: a7cfc149807e2d1b454e872dd857d0cef5ef6e43.camel@gentoo.org
In Reply to: [gentoo-dev] [PATCH] meson.eclass: stop calling ninja by William Hubbs
1 On Tue, 2021-08-24 at 00:35 -0500, William Hubbs wrote:
2 > Use the compile and install subcommands of meson instead of calling
3 > ninja. This allows for the possibility of a different back end.
4 >
5 > Signed-off-by: William Hubbs <williamh@g.o>
6 > ---
7 > eclass/meson.eclass | 24 +++++++++++++++++++++---
8 > 1 file changed, 21 insertions(+), 3 deletions(-)
9 >
10 > diff --git a/eclass/meson.eclass b/eclass/meson.eclass
11 > index 2a563e367c6..e9c9b155096 100644
12 > --- a/eclass/meson.eclass
13 > +++ b/eclass/meson.eclass
14 > @@ -379,7 +379,21 @@ meson_src_configure() {
15 > meson_src_compile() {
16 > debug-print-function ${FUNCNAME} "$@"
17 >
18 > - eninja -C "${BUILD_DIR}" "$@"
19 > + local mesoncompileargs=(
20 > + -C "${BUILD_DIR}"
21 > + )
22 > + if [[ -n ${NINJAOPTS} ]]; then
23
24 Shouldn't NINJAOPTS be only used with the ninja backend then?
25
26 > + mesoncompileargs+=(
27 > + --jobs "$(makeopts_jobs ${NINJAOPTS})"
28 > + --load-average "$(makeopts_loadavg ${NINJAOPTS})"
29 > + )
30 > + elif [[ -n ${MAKEOPTS} ]]; then
31 > + mesoncompileargs+=(
32 > + --jobs "$(makeopts_jobs ${MAKEOPTS})"
33 > + --load-average "$(makeopts_loadavg ${MAKEOPTS})"
34 > + )
35
36 Does this really work without a 'fi'?
37
38 Also, you could avoid repetition by putting NINJAOPTS/MAKEOPTS into
39 a local variable, and passing that to makeopts_*.
40
41 > +
42 > + meson compile "${mesoncompileargs[@]}" "$@" || die "compile failed"
43 > }
44 >
45 > # @FUNCTION: meson_src_test
46 > @@ -406,13 +420,17 @@ meson_src_test() {
47 > }
48 >
49 > # @FUNCTION: meson_src_install
50 > -# @USAGE: [extra ninja install arguments]
51 > +# @USAGE: [extra meson install arguments]
52 > # @DESCRIPTION:
53 > # This is the meson_src_install function.
54 > meson_src_install() {
55 > debug-print-function ${FUNCNAME} "$@"
56 >
57 > - DESTDIR="${D}" eninja -C "${BUILD_DIR}" install "$@"
58 > + local mesoninstallargs=(
59 > + -C "${BUILD_DIR}" "$@"
60 > + --destdir "${D}"
61 > + )
62 > + meson install "${mesoninstallargs[@]}" "$@"
63 >
64 > pushd "${S}" > /dev/null || die
65 > einstalldocs
66
67 --
68 Best regards,
69 Michał Górny