diff options
author | Ross Burton <ross@burtonini.com> | 2021-03-25 17:39:01 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-03-31 00:06:23 +0100 |
commit | 06b4910c3ada5398faf9369d686b82eee441bb19 (patch) | |
tree | 017f1564b754447c3c1e6294011d232fcd6ec21a /meta | |
parent | ff9c4b014179481a5ea76487187205e606f8b4b2 (diff) | |
download | poky-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.bbclass | 54 |
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 | ||
31 | EXTRA_OEMESON_append = " ${PACKAGECONFIG_CONFARGS}" | 32 | EXTRA_OEMESON_append = " ${PACKAGECONFIG_CONFARGS}" |
32 | 33 | ||
@@ -102,12 +103,14 @@ cups-config = 'cups-config' | |||
102 | g-ir-scanner = '${STAGING_BINDIR}/g-ir-scanner-wrapper' | 103 | g-ir-scanner = '${STAGING_BINDIR}/g-ir-scanner-wrapper' |
103 | g-ir-compiler = '${STAGING_BINDIR}/g-ir-compiler-wrapper' | 104 | g-ir-compiler = '${STAGING_BINDIR}/g-ir-compiler-wrapper' |
104 | 105 | ||
105 | [properties] | 106 | [built-in options] |
106 | needs_exe_wrapper = true | ||
107 | c_args = ${@meson_array('CFLAGS', d)} | 107 | c_args = ${@meson_array('CFLAGS', d)} |
108 | c_link_args = ${@meson_array('LDFLAGS', d)} | 108 | c_link_args = ${@meson_array('LDFLAGS', d)} |
109 | cpp_args = ${@meson_array('CXXFLAGS', d)} | 109 | cpp_args = ${@meson_array('CXXFLAGS', d)} |
110 | cpp_link_args = ${@meson_array('LDFLAGS', d)} | 110 | cpp_link_args = ${@meson_array('LDFLAGS', d)} |
111 | |||
112 | [properties] | ||
113 | needs_exe_wrapper = true | ||
111 | gtkdoc_exe_wrapper = '${B}/gtkdoc-qemuwrapper' | 114 | gtkdoc_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)}' | |||
122 | cpu = '${TARGET_ARCH}' | 125 | cpu = '${TARGET_ARCH}' |
123 | endian = '${@meson_endian('TARGET', d)}' | 126 | endian = '${@meson_endian('TARGET', d)}' |
124 | EOF | 127 | EOF |
128 | |||
129 | cat >${WORKDIR}/meson.native <<EOF | ||
130 | [binaries] | ||
131 | c = ${@meson_array('BUILD_CC', d)} | ||
132 | cpp = ${@meson_array('BUILD_CXX', d)} | ||
133 | ar = ${@meson_array('BUILD_AR', d)} | ||
134 | nm = ${@meson_array('BUILD_NM', d)} | ||
135 | strip = ${@meson_array('BUILD_STRIP', d)} | ||
136 | readelf = ${@meson_array('BUILD_READELF', d)} | ||
137 | pkgconfig = 'pkg-config-native' | ||
138 | |||
139 | [built-in options] | ||
140 | c_args = ${@meson_array('BUILD_CFLAGS', d)} | ||
141 | c_link_args = ${@meson_array('BUILD_LDFLAGS', d)} | ||
142 | cpp_args = ${@meson_array('BUILD_CXXFLAGS', d)} | ||
143 | cpp_link_args = ${@meson_array('BUILD_LDFLAGS', d)} | ||
144 | EOF | ||
125 | } | 145 | } |
126 | 146 | ||
147 | # Tell externalsrc that changes to this file require a reconfigure | ||
127 | CONFIGURE_FILES = "meson.build" | 148 | CONFIGURE_FILES = "meson.build" |
128 | 149 | ||
129 | meson_do_configure() { | 150 | meson_do_configure() { |
@@ -140,33 +161,6 @@ meson_do_configure() { | |||
140 | fi | 161 | fi |
141 | } | 162 | } |
142 | 163 | ||
143 | override_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 | |||
158 | meson_do_configure_prepend_class-target() { | ||
159 | override_native_tools | ||
160 | } | ||
161 | |||
162 | meson_do_configure_prepend_class-nativesdk() { | ||
163 | override_native_tools | ||
164 | } | ||
165 | |||
166 | meson_do_configure_prepend_class-native() { | ||
167 | export PKG_CONFIG="pkg-config-native" | ||
168 | } | ||
169 | |||
170 | python meson_do_qa_configure() { | 164 | python 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) |