summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2018-09-25 14:43:46 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-09-25 23:15:49 +0100
commitfeb5e7ed50dc39f3a2fef37cc198543e0dc77344 (patch)
tree5d7f5e07ca3ac2f872a79370b3ccac87843777e4 /meta/classes
parent16729efc18ae7b3e4e666672556f23a27330cbd6 (diff)
downloadpoky-feb5e7ed50dc39f3a2fef37cc198543e0dc77344.tar.gz
meson: stop Meson using target CFLAGS in native builds
With the goal of autoconf-compatibility Meson respects $CFLAGS et al in builds. In cross-compiled build the cross file is the one true source of flags and the environment isn't used, but in a native build the environment will still be respected. As this can lead to target flags being used in the build for native binaries (including a single native binary inside a target recipe), export CFLAGS=${BUILD_CFLAGS) et al. (From OE-Core rev: 4ca0002860dca771836c0ce1c7a92b79a5f2db3f) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/meson.bbclass15
1 files changed, 10 insertions, 5 deletions
diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass
index 07322cf786..ed08a4058c 100644
--- a/meta/classes/meson.bbclass
+++ b/meta/classes/meson.bbclass
@@ -24,7 +24,11 @@ MESONOPTS = " --prefix ${prefix} \
24 --infodir ${@noprefix('infodir', d)} \ 24 --infodir ${@noprefix('infodir', d)} \
25 --sysconfdir ${sysconfdir} \ 25 --sysconfdir ${sysconfdir} \
26 --localstatedir ${localstatedir} \ 26 --localstatedir ${localstatedir} \
27 --sharedstatedir ${sharedstatedir}" 27 --sharedstatedir ${sharedstatedir} \
28 -Dc_args='${BUILD_CPPFLAGS} ${BUILD_CFLAGS}' \
29 -Dc_link_args='${BUILD_LDFLAGS}' \
30 -Dcpp_args='${BUILD_CPPFLAGS} ${BUILD_CXXFLAGS}' \
31 -Dcpp_link_args='${BUILD_LDFLAGS}'"
28 32
29MESON_TOOLCHAIN_ARGS = "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" 33MESON_TOOLCHAIN_ARGS = "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
30MESON_C_ARGS = "${MESON_TOOLCHAIN_ARGS} ${CFLAGS}" 34MESON_C_ARGS = "${MESON_TOOLCHAIN_ARGS} ${CFLAGS}"
@@ -114,14 +118,15 @@ meson_do_configure() {
114override_native_tools() { 118override_native_tools() {
115 # Set these so that meson uses the native tools for its build sanity tests, 119 # Set these so that meson uses the native tools for its build sanity tests,
116 # which require executables to be runnable. The cross file will still 120 # which require executables to be runnable. The cross file will still
117 # override these for the target build. Note that we do *not* set CFLAGS, 121 # override these for the target build.
118 # LDFLAGS, etc. as they will be slurped in by meson and applied to the
119 # target build, causing errors.
120 export CC="${BUILD_CC}" 122 export CC="${BUILD_CC}"
121 export CXX="${BUILD_CXX}" 123 export CXX="${BUILD_CXX}"
122 export LD="${BUILD_LD}" 124 export LD="${BUILD_LD}"
123 export AR="${BUILD_AR}" 125 export AR="${BUILD_AR}"
124 126 # These contain *target* flags but will be used as *native* flags. The
127 # correct native flags will be passed via -Dc_args and so on, unset them so
128 # they don't interfere with tools invoked by Meson (such as g-ir-scanner)
129 unset CPPFLAGS CFLAGS CXXFLAGS LDFLAGS
125} 130}
126 131
127meson_do_configure_prepend_class-target() { 132meson_do_configure_prepend_class-target() {