summaryrefslogtreecommitdiffstats
path: root/meta/classes/meson.bbclass
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2018-07-03 14:04:10 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-07-04 12:27:27 +0100
commite33b902a1dc4294dac148715f4d3ca5b0a6ee1b7 (patch)
treead71303bc8a9dc407b1b8ef0f6ae2ed63d605cda /meta/classes/meson.bbclass
parent3112ff268d095a65ecb893dd6ca88a85b0f70446 (diff)
downloadopenembedded-core-contrib-e33b902a1dc4294dac148715f4d3ca5b0a6ee1b7.tar.gz
meson: map architecture to correct values in cross file
The cross file specifies the host/target cpu_family, which should be one of a defined set of values[1] but if it isn't Meson won't complain and instead recipes may behave unexpectedly. [1] http://mesonbuild.com/Reference-tables.html#cpu-families Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/meson.bbclass')
-rw-r--r--meta/classes/meson.bbclass16
1 files changed, 14 insertions, 2 deletions
diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass
index c36b634b43d..d615a84cfb0 100644
--- a/meta/classes/meson.bbclass
+++ b/meta/classes/meson.bbclass
@@ -45,6 +45,18 @@ def meson_array(var, d):
items = d.getVar(var).split()
return repr(items[0] if len(items) == 1 else items)
+# Map our ARCH values to what Meson expects:
+# http://mesonbuild.com/Reference-tables.html#cpu-families
+def meson_cpu_family(var, d):
+ import re
+ arch = d.getVar(var)
+ if arch == 'powerpc':
+ return 'ppc'
+ elif re.match(r"i[3-6]86", arch):
+ return "x86"
+ else:
+ return arch
+
addtask write_config before do_configure
do_write_config[vardeps] += "MESON_C_ARGS MESON_CPP_ARGS MESON_LINK_ARGS CC CXX LD AR NM STRIP READELF"
do_write_config() {
@@ -70,13 +82,13 @@ gtkdoc_exe_wrapper = '${B}/gtkdoc-qemuwrapper'
[host_machine]
system = '${HOST_OS}'
-cpu_family = '${HOST_ARCH}'
+cpu_family = '${@meson_cpu_family('HOST_ARCH', d)}'
cpu = '${HOST_ARCH}'
endian = '${MESON_HOST_ENDIAN}'
[target_machine]
system = '${TARGET_OS}'
-cpu_family = '${TARGET_ARCH}'
+cpu_family = '${@meson_cpu_family('TARGET_ARCH', d)}'
cpu = '${TARGET_ARCH}'
endian = '${MESON_TARGET_ENDIAN}'
EOF