Gentoo Archives: gentoo-dev

From: Mike Gilbert <floppym@g.o>
To: gentoo-dev@l.g.o
Cc: williamh@g.o, Mike Gilbert <floppym@g.o>
Subject: [gentoo-dev] [PATCH] meson.eclass: add EMESON_BUILDTYPE variable
Date: Thu, 21 Oct 2021 15:51:24
Message-Id: 20211021155103.2373917-1-floppym@gentoo.org
1 This allows the buildtype option to be overridden or omitted.
2
3 This may be necessary if an ebuild makes use of the 'debug' built-in
4 option control project-specific debug functionality. meson emits a
5 warning if both buildtype and debug are specified, since the former
6 overrides the latter.
7
8 See discussion in https://github.com/gentoo/gentoo/pull/22574.
9
10 Signed-off-by: Mike Gilbert <floppym@g.o>
11 ---
12 eclass/meson.eclass | 10 +++++++++-
13 1 file changed, 9 insertions(+), 1 deletion(-)
14
15 diff --git a/eclass/meson.eclass b/eclass/meson.eclass
16 index 4ba364924e4..5fab2f8df6b 100644
17 --- a/eclass/meson.eclass
18 +++ b/eclass/meson.eclass
19 @@ -64,6 +64,11 @@ fi
20 # Build directory, location where all generated files should be placed.
21 # If this isn't set, it defaults to ${WORKDIR}/${P}-build.
22
23 +# @ECLASS-VARIABLE: EMESON_BUILDTYPE
24 +# @DESCRIPTION:
25 +# The buildtype value to pass to meson setup.
26 +: ${EMESON_BUILDTYPE=plain}
27 +
28 # @ECLASS-VARIABLE: EMESON_SOURCE
29 # @DEFAULT_UNSET
30 # @DESCRIPTION:
31 @@ -310,7 +315,6 @@ meson_src_configure() {
32
33 local mesonargs=(
34 meson setup
35 - --buildtype plain
36 --libdir "$(get_libdir)"
37 --localstatedir "${EPREFIX}/var/lib"
38 --prefix "${EPREFIX}/usr"
39 @@ -321,6 +325,10 @@ meson_src_configure() {
40 --native-file "$(_meson_create_native_file)"
41 )
42
43 + if [[ -n ${EMESON_BUILDTYPE} ]]; then
44 + mesonargs+=( --buildtype "${EMESON_BUILDTYPE}" )
45 + fi
46 +
47 if tc-is-cross-compiler; then
48 mesonargs+=( --cross-file "$(_meson_create_cross_file)" )
49 fi
50 --
51 2.33.1