Gentoo Archives: gentoo-commits

From: Mike Gilbert <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Sat, 05 May 2018 20:16:14
Message-Id: 1525551355.c8570bc0e2618e502c2fdab7ff972786a12899e0.floppym@gentoo
1 commit: c8570bc0e2618e502c2fdab7ff972786a12899e0
2 Author: Raul E Rangel <rrangel <AT> chromium <DOT> org>
3 AuthorDate: Mon Apr 23 16:15:59 2018 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Sat May 5 20:15:55 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c8570bc0
7
8 meson.eclass: Don't mix host *FLAGS with build *FLAGS
9
10 meson gets the build flags from the environment. When cross compiling it
11 will get the host flags from the cross file. The ebuild was not passing
12 the correct build flags when cross compiling.
13
14 By using tc-env_build the build environment flags are set when calling
15 meson. This results in not mixing host and build flags:
16
17 Example output:
18 Native C compiler: x86_64-pc-linux-gnu-clang (clang 7.0)
19 Appending CFLAGS from environment: '-O1 -pipe'
20 Appending LDFLAGS from environment: ' '
21 Appending CPPFLAGS from environment: ' '
22 Cross C compiler: armv7a-cros-linux-gnueabi-clang (clang 7.0)
23 Host machine cpu family: arm
24 Host machine cpu: armv7a
25 Target machine cpu family: arm
26 Target machine cpu: armv7a
27 Build machine cpu family: x86_64
28 Build machine cpu: x86_64
29
30 tc-env_build does not seem to load the actual build flags, but it's
31 better than using host flags as build flags.
32
33 See https://bugs.gentoo.org/653902 for upstream patch
34
35 BUG=b:78351764
36 BRANCH=none
37 TEST=emerge-grunt and verified mosys runs
38
39 Change-Id: I802b58cb089b27b9253a034ac00dd183e0f1955a
40 Signed-off-by: Raul E Rangel <rrangel <AT> chromium.org>
41 Closes: https://bugs.gentoo.org/653902
42
43 eclass/meson.eclass | 29 +++++++----------------------
44 1 file changed, 7 insertions(+), 22 deletions(-)
45
46 diff --git a/eclass/meson.eclass b/eclass/meson.eclass
47 index 057339dffa4..f493bab2d01 100644
48 --- a/eclass/meson.eclass
49 +++ b/eclass/meson.eclass
50 @@ -159,11 +159,11 @@ _meson_create_cross_file() {
51
52 cat > "${T}/meson.${CHOST}" <<-EOF
53 [binaries]
54 - ar = '${AR}'
55 - c = '${CC}'
56 - cpp = '${CXX}'
57 - pkgconfig = '${PKG_CONFIG}'
58 - strip = '${STRIP}'
59 + ar = '$(tc-getAR)'
60 + c = '$(tc-getCC)'
61 + cpp = '$(tc-getCXX)'
62 + pkgconfig = '$(tc-getPKG_CONFIG)'
63 + strip = '$(tc-getSTRIP)'
64
65 [properties]
66 c_args = $(_meson_env_array "${CFLAGS}")
67 @@ -211,24 +211,9 @@ meson_src_configure() {
68 --wrap-mode nodownload
69 )
70
71 - # Both meson(1) and _meson_create_cross_file need these
72 - local -x AR=$(tc-getAR)
73 - local -x CC=$(tc-getCC)
74 - local -x CXX=$(tc-getCXX)
75 - local -x PKG_CONFIG=$(tc-getPKG_CONFIG)
76 - local -x STRIP=$(tc-getSTRIP)
77 -
78 if tc-is-cross-compiler; then
79 _meson_create_cross_file || die "unable to write meson cross file"
80 - mesonargs+=(
81 - --cross-file "${T}/meson.${CHOST}"
82 - )
83 - # In cross mode, meson uses these as the native/build programs
84 - AR=$(tc-getBUILD_AR)
85 - CC=$(tc-getBUILD_CC)
86 - CXX=$(tc-getBUILD_CXX)
87 - PKG_CONFIG=$(tc-getBUILD_PKG_CONFIG)
88 - STRIP=$(tc-getBUILD_STRIP)
89 + mesonargs+=( --cross-file "${T}/meson.${CHOST}" )
90 fi
91
92 # https://bugs.gentoo.org/625396
93 @@ -241,7 +226,7 @@ meson_src_configure() {
94 set -- meson "${mesonargs[@]}" "$@" \
95 "${EMESON_SOURCE:-${S}}" "${BUILD_DIR}"
96 echo "$@"
97 - "$@" || die
98 + tc-env_build "$@" || die
99 }
100
101 # @FUNCTION: meson_src_compile