summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2018-09-25 14:43:45 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-09-25 23:15:42 +0100
commit2f9adf05efdddf8dae9c58976ae56cf32d9e57f0 (patch)
tree267c523960dd3d08d69947210a646358fb7e8345
parentd9e5308ebfe376814f383d61ed00b50e8bad526b (diff)
downloadopenembedded-core-contrib-2f9adf05efdddf8dae9c58976ae56cf32d9e57f0.tar.gz
openembedded-core-contrib-2f9adf05efdddf8dae9c58976ae56cf32d9e57f0.tar.bz2
openembedded-core-contrib-2f9adf05efdddf8dae9c58976ae56cf32d9e57f0.zip
meson: pass correct endian in the cross file
Meson doesn't care for the value of the endian field, but packages may want to use it and Meson master now validates the value. Use siteinfo to obtain the endianism and write the correct value. Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/meson.bbclass20
1 files changed, 13 insertions, 7 deletions
diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass
index e3b452786d..07322cf786 100644
--- a/meta/classes/meson.bbclass
+++ b/meta/classes/meson.bbclass
@@ -1,4 +1,4 @@
-inherit python3native
+inherit siteinfo python3native
DEPENDS_append = " meson-native ninja-native"
@@ -31,10 +31,6 @@ MESON_C_ARGS = "${MESON_TOOLCHAIN_ARGS} ${CFLAGS}"
MESON_CPP_ARGS = "${MESON_TOOLCHAIN_ARGS} ${CXXFLAGS}"
MESON_LINK_ARGS = "${MESON_TOOLCHAIN_ARGS} ${LDFLAGS}"
-# both are required but not used by meson
-MESON_HOST_ENDIAN = "bogus-endian"
-MESON_TARGET_ENDIAN = "bogus-endian"
-
EXTRA_OEMESON_append = " ${PACKAGECONFIG_CONFARGS}"
MESON_CROSS_FILE = ""
@@ -59,6 +55,16 @@ def meson_cpu_family(var, d):
else:
return arch
+def meson_endian(prefix, d):
+ arch, os = d.getVar(prefix + "_ARCH"), d.getVar(prefix + "_OS")
+ sitedata = siteinfo_data_for_machine(arch, os, d)
+ if "endian-little" in sitedata:
+ return "little"
+ elif "endian-big" in sitedata:
+ return "big"
+ else:
+ bb.fatal("Cannot determine endianism for %s-%s" % (arch, os))
+
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() {
@@ -86,13 +92,13 @@ gtkdoc_exe_wrapper = '${B}/gtkdoc-qemuwrapper'
system = '${HOST_OS}'
cpu_family = '${@meson_cpu_family('HOST_ARCH', d)}'
cpu = '${HOST_ARCH}'
-endian = '${MESON_HOST_ENDIAN}'
+endian = '${@meson_endian('HOST', d)}'
[target_machine]
system = '${TARGET_OS}'
cpu_family = '${@meson_cpu_family('TARGET_ARCH', d)}'
cpu = '${TARGET_ARCH}'
-endian = '${MESON_TARGET_ENDIAN}'
+endian = '${@meson_endian('TARGET', d)}'
EOF
}