[OE-core] [PATCH] meson.bbclass: add MESON_CROSS_EXTRA_PROPS to inject properties into meson.cross

Andreas Müller schnitzeltony at gmail.com
Wed May 8 20:13:35 UTC 2019


Some projects rely on (cross)specific properties e.g [1]. By setting

MESON_CROSS_EXTRA_PROPS="var1='value1' var2=true"

the required properties can be passed to meson.build. The contents of
MESON_CROSS_EXTRA_PROPS behave same as known by e.g EXTRA_OEMESON.

[1] https://gitlab.gnome.org/GNOME/tracker/blob/master/meson.build#L91

Signed-off-by: Andreas Müller <schnitzeltony at gmail.com>
---
 meta/classes/meson.bbclass | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass
index 115d1aedcb..b9cd1deaef 100644
--- a/meta/classes/meson.bbclass
+++ b/meta/classes/meson.bbclass
@@ -45,6 +45,11 @@ def meson_array(var, d):
     items = d.getVar(var).split()
     return repr(items[0] if len(items) == 1 else items)
 
+def meson_cross_extra_properties(d):
+    cross_properties = "\n"
+    cross_properties = cross_properties.join((d.getVar('MESON_CROSS_EXTRA_PROPS') or '').split())
+    return cross_properties
+
 # Map our ARCH values to what Meson expects:
 # http://mesonbuild.com/Reference-tables.html#cpu-families
 def meson_cpu_family(var, d):
@@ -76,7 +81,7 @@ def meson_endian(prefix, d):
         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[vardeps] += "MESON_C_ARGS MESON_CPP_ARGS MESON_LINK_ARGS MESON_CROSS_EXTRA_PROPS CC CXX LD AR NM STRIP READELF"
 do_write_config() {
     # This needs to be Py to split the args into single-element lists
     cat >${WORKDIR}/meson.cross <<EOF
@@ -98,6 +103,7 @@ c_link_args = ${@meson_array('MESON_LINK_ARGS', d)}
 cpp_args = ${@meson_array('MESON_CPP_ARGS', d)}
 cpp_link_args = ${@meson_array('MESON_LINK_ARGS', d)}
 gtkdoc_exe_wrapper = '${B}/gtkdoc-qemuwrapper'
+${@meson_cross_extra_properties(d)}
 
 [host_machine]
 system = '${HOST_OS}'
-- 
2.20.1



More information about the Openembedded-core mailing list