summaryrefslogtreecommitdiffstats
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-05 00:22:08 +0100
commit5193aedb458d4db1e851906087ac890fd1abfbd7 (patch)
tree21f4feac0b9aed68324cee48b04dae3233d6fd27
parentc2ba7177f14f94f62beba123fd041bd3df565411 (diff)
downloadpoky-5193aedb458d4db1e851906087ac890fd1abfbd7.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 (From OE-Core rev: e33b902a1dc4294dac148715f4d3ca5b0a6ee1b7) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-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 c36b634b43..d615a84cfb 100644
--- a/meta/classes/meson.bbclass
+++ b/meta/classes/meson.bbclass
@@ -45,6 +45,18 @@ def meson_array(var, d):
45 items = d.getVar(var).split() 45 items = d.getVar(var).split()
46 return repr(items[0] if len(items) == 1 else items) 46 return repr(items[0] if len(items) == 1 else items)
47 47
48# Map our ARCH values to what Meson expects:
49# http://mesonbuild.com/Reference-tables.html#cpu-families
50def meson_cpu_family(var, d):
51 import re
52 arch = d.getVar(var)
53 if arch == 'powerpc':
54 return 'ppc'
55 elif re.match(r"i[3-6]86", arch):
56 return "x86"
57 else:
58 return arch
59
48addtask write_config before do_configure 60addtask write_config before do_configure
49do_write_config[vardeps] += "MESON_C_ARGS MESON_CPP_ARGS MESON_LINK_ARGS CC CXX LD AR NM STRIP READELF" 61do_write_config[vardeps] += "MESON_C_ARGS MESON_CPP_ARGS MESON_LINK_ARGS CC CXX LD AR NM STRIP READELF"
50do_write_config() { 62do_write_config() {
@@ -70,13 +82,13 @@ gtkdoc_exe_wrapper = '${B}/gtkdoc-qemuwrapper'
70 82
71[host_machine] 83[host_machine]
72system = '${HOST_OS}' 84system = '${HOST_OS}'
73cpu_family = '${HOST_ARCH}' 85cpu_family = '${@meson_cpu_family('HOST_ARCH', d)}'
74cpu = '${HOST_ARCH}' 86cpu = '${HOST_ARCH}'
75endian = '${MESON_HOST_ENDIAN}' 87endian = '${MESON_HOST_ENDIAN}'
76 88
77[target_machine] 89[target_machine]
78system = '${TARGET_OS}' 90system = '${TARGET_OS}'
79cpu_family = '${TARGET_ARCH}' 91cpu_family = '${@meson_cpu_family('TARGET_ARCH', d)}'
80cpu = '${TARGET_ARCH}' 92cpu = '${TARGET_ARCH}'
81endian = '${MESON_TARGET_ENDIAN}' 93endian = '${MESON_TARGET_ENDIAN}'
82EOF 94EOF