diff options
author | Ross Burton <ross.burton@intel.com> | 2018-07-03 14:04:10 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-07-05 00:22:08 +0100 |
commit | 5193aedb458d4db1e851906087ac890fd1abfbd7 (patch) | |
tree | 21f4feac0b9aed68324cee48b04dae3233d6fd27 | |
parent | c2ba7177f14f94f62beba123fd041bd3df565411 (diff) | |
download | poky-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.bbclass | 16 |
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 | ||
50 | def 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 | |||
48 | addtask write_config before do_configure | 60 | addtask write_config before do_configure |
49 | do_write_config[vardeps] += "MESON_C_ARGS MESON_CPP_ARGS MESON_LINK_ARGS CC CXX LD AR NM STRIP READELF" | 61 | do_write_config[vardeps] += "MESON_C_ARGS MESON_CPP_ARGS MESON_LINK_ARGS CC CXX LD AR NM STRIP READELF" |
50 | do_write_config() { | 62 | do_write_config() { |
@@ -70,13 +82,13 @@ gtkdoc_exe_wrapper = '${B}/gtkdoc-qemuwrapper' | |||
70 | 82 | ||
71 | [host_machine] | 83 | [host_machine] |
72 | system = '${HOST_OS}' | 84 | system = '${HOST_OS}' |
73 | cpu_family = '${HOST_ARCH}' | 85 | cpu_family = '${@meson_cpu_family('HOST_ARCH', d)}' |
74 | cpu = '${HOST_ARCH}' | 86 | cpu = '${HOST_ARCH}' |
75 | endian = '${MESON_HOST_ENDIAN}' | 87 | endian = '${MESON_HOST_ENDIAN}' |
76 | 88 | ||
77 | [target_machine] | 89 | [target_machine] |
78 | system = '${TARGET_OS}' | 90 | system = '${TARGET_OS}' |
79 | cpu_family = '${TARGET_ARCH}' | 91 | cpu_family = '${@meson_cpu_family('TARGET_ARCH', d)}' |
80 | cpu = '${TARGET_ARCH}' | 92 | cpu = '${TARGET_ARCH}' |
81 | endian = '${MESON_TARGET_ENDIAN}' | 93 | endian = '${MESON_TARGET_ENDIAN}' |
82 | EOF | 94 | EOF |