summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRoss Burton <ross@burtonini.com>2021-03-25 17:39:01 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-03-31 00:06:23 +0100
commit06b4910c3ada5398faf9369d686b82eee441bb19 (patch)
tree017f1564b754447c3c1e6294011d232fcd6ec21a /meta
parentff9c4b014179481a5ea76487187205e606f8b4b2 (diff)
downloadpoky-06b4910c3ada5398faf9369d686b82eee441bb19.tar.gz
meson: use native-file instead of environment variables
Meson now supports native-files, which are the same as cross files but describe the native build. By writing and using a native file which describes the tools to use, we can drop the environment variable overriding. (From OE-Core rev: 20a5af2583de60969124b4dc15e045ee47516da4) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/meson.bbclass54
1 files changed, 24 insertions, 30 deletions
diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass
index a7644e70cb..bf9b02e06e 100644
--- a/meta/classes/meson.bbclass
+++ b/meta/classes/meson.bbclass
@@ -26,7 +26,8 @@ MESONOPTS = " --prefix ${prefix} \
26 --sysconfdir ${sysconfdir} \ 26 --sysconfdir ${sysconfdir} \
27 --localstatedir ${localstatedir} \ 27 --localstatedir ${localstatedir} \
28 --sharedstatedir ${sharedstatedir} \ 28 --sharedstatedir ${sharedstatedir} \
29 --wrap-mode nodownload" 29 --wrap-mode nodownload \
30 --native-file ${WORKDIR}/meson.native"
30 31
31EXTRA_OEMESON_append = " ${PACKAGECONFIG_CONFARGS}" 32EXTRA_OEMESON_append = " ${PACKAGECONFIG_CONFARGS}"
32 33
@@ -102,12 +103,14 @@ cups-config = 'cups-config'
102g-ir-scanner = '${STAGING_BINDIR}/g-ir-scanner-wrapper' 103g-ir-scanner = '${STAGING_BINDIR}/g-ir-scanner-wrapper'
103g-ir-compiler = '${STAGING_BINDIR}/g-ir-compiler-wrapper' 104g-ir-compiler = '${STAGING_BINDIR}/g-ir-compiler-wrapper'
104 105
105[properties] 106[built-in options]
106needs_exe_wrapper = true
107c_args = ${@meson_array('CFLAGS', d)} 107c_args = ${@meson_array('CFLAGS', d)}
108c_link_args = ${@meson_array('LDFLAGS', d)} 108c_link_args = ${@meson_array('LDFLAGS', d)}
109cpp_args = ${@meson_array('CXXFLAGS', d)} 109cpp_args = ${@meson_array('CXXFLAGS', d)}
110cpp_link_args = ${@meson_array('LDFLAGS', d)} 110cpp_link_args = ${@meson_array('LDFLAGS', d)}
111
112[properties]
113needs_exe_wrapper = true
111gtkdoc_exe_wrapper = '${B}/gtkdoc-qemuwrapper' 114gtkdoc_exe_wrapper = '${B}/gtkdoc-qemuwrapper'
112 115
113[host_machine] 116[host_machine]
@@ -122,8 +125,26 @@ cpu_family = '${@meson_cpu_family('TARGET_ARCH', d)}'
122cpu = '${TARGET_ARCH}' 125cpu = '${TARGET_ARCH}'
123endian = '${@meson_endian('TARGET', d)}' 126endian = '${@meson_endian('TARGET', d)}'
124EOF 127EOF
128
129 cat >${WORKDIR}/meson.native <<EOF
130[binaries]
131c = ${@meson_array('BUILD_CC', d)}
132cpp = ${@meson_array('BUILD_CXX', d)}
133ar = ${@meson_array('BUILD_AR', d)}
134nm = ${@meson_array('BUILD_NM', d)}
135strip = ${@meson_array('BUILD_STRIP', d)}
136readelf = ${@meson_array('BUILD_READELF', d)}
137pkgconfig = 'pkg-config-native'
138
139[built-in options]
140c_args = ${@meson_array('BUILD_CFLAGS', d)}
141c_link_args = ${@meson_array('BUILD_LDFLAGS', d)}
142cpp_args = ${@meson_array('BUILD_CXXFLAGS', d)}
143cpp_link_args = ${@meson_array('BUILD_LDFLAGS', d)}
144EOF
125} 145}
126 146
147# Tell externalsrc that changes to this file require a reconfigure
127CONFIGURE_FILES = "meson.build" 148CONFIGURE_FILES = "meson.build"
128 149
129meson_do_configure() { 150meson_do_configure() {
@@ -140,33 +161,6 @@ meson_do_configure() {
140 fi 161 fi
141} 162}
142 163
143override_native_tools() {
144 # Set these so that meson uses the native tools for its build sanity tests,
145 # which require executables to be runnable. The cross file will still
146 # override these for the target build.
147 export CC="${BUILD_CC}"
148 export CXX="${BUILD_CXX}"
149 export LD="${BUILD_LD}"
150 export AR="${BUILD_AR}"
151 export STRIP="${BUILD_STRIP}"
152 # These contain *target* flags but will be used as *native* flags. The
153 # correct native flags will be passed via -Dc_args and so on, unset them so
154 # they don't interfere with tools invoked by Meson (such as g-ir-scanner)
155 unset CPPFLAGS CFLAGS CXXFLAGS LDFLAGS
156}
157
158meson_do_configure_prepend_class-target() {
159 override_native_tools
160}
161
162meson_do_configure_prepend_class-nativesdk() {
163 override_native_tools
164}
165
166meson_do_configure_prepend_class-native() {
167 export PKG_CONFIG="pkg-config-native"
168}
169
170python meson_do_qa_configure() { 164python meson_do_qa_configure() {
171 import re 165 import re
172 warn_re = re.compile(r"^WARNING: Cross property (.+) is using default value (.+)$", re.MULTILINE) 166 warn_re = re.compile(r"^WARNING: Cross property (.+) is using default value (.+)$", re.MULTILINE)