meson.bbclass: add MESON_CROSS_EXTRA_PROPS to inject properties into meson.cross
PATCH 1/1 meson.bbclass: add MESON_CROSS_EXTRA_PROPS to inject properties into meson.cross
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
--- meta/classes/meson.bbclass | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
meta/classes/meson.bbclass +7 -1
@@ -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}'
Signature · 1 line
2.20.1
Quoted 8 lines · Andreas Müller
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_PROPSbehave same as known by e.gEXTRA_OEMESON.[1] https://gitlab.gnome.org/GNOME/tracker/blob/master/meson.build#L91
Or see https://git.openembedded.org/openembedded-core/commit/?id=e04e0a20cab04966698c50dc79195a8f159248d3
for an example of how this is done already.
Ross
Quoted 6 lines · Ross
Quoted 4 lines · Andreas Müller
Some projects rely on (cross)specific properties e.g [1]. By setting
MESON_CROSS_EXTRA_PROPS="var1='value1' var2=true"
Quoted 8 lines
Quoted 4 lines
the required properties can be passed to meson.build. The contents of
MESON_CROSS_EXTRA_PROPSbehave same as known by e.gEXTRA_OEMESON.[1] https://gitlab.gnome.org/GNOME/tracker/blob/master/meson.build#L91
Or see https://git.openembedded.org/openembedded-core/commit/?id=e04e0a20cab04966698c50dc79195a8f159248d3
for an example of how this is done already.
Sometimes the sending of patches is the secret attempt to gather information :)
Thanks
Andreas
Quoted 11 lines · Andreas Müller
Quoted 9 lines · Ross
Quoted 7 lines · Andreas Müller
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_PROPSbehave same as known by e.gEXTRA_OEMESON.
Quoted 9 lines
Quoted 5 lines
Quoted 1 line
[1] https://gitlab.gnome.org/GNOME/tracker/blob/master/meson.build#L91
Or see https://git.openembedded.org/openembedded-core/commit/?id=e04e0a20cab04966698c50dc79195a8f159248d3
for an example of how this is done already.Sometimes the sending of patches is the secret attempt to gather information :)
Thanks
So for me to understand it correctly: adding multiple '--cross-file' entries in commandline accumulates the contents of the files and it is not the last that wins?
I am asking because help says 'File describing cross compilation environment.' so I wouldn't expect this behaviour.
Andreas
Quoted 7 lines · Andreas Müller
So for me to understand it correctly: adding multiple '--cross-file' entries in commandline accumulates the contents of the files and it is not the last that wins?
I am asking because help says 'File describing cross compilation environment.' so I wouldn't expect this behaviour.
Answer myself - and guess who did it :))
https://github.com/mesonbuild/meson/blob/master/docs/markdown/snippets/multiple-cross-files.md
Andreas
Quoted 9 lines · Ross
Quoted 7 lines · Andreas Müller
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_PROPSbehave same as known by e.gEXTRA_OEMESON.
Quoted 6 lines
Quoted 1 line
[1] https://gitlab.gnome.org/GNOME/tracker/blob/master/meson.build#L91
Or see https://git.openembedded.org/openembedded-core/commit/?id=e04e0a20cab04966698c50dc79195a8f159248d3
for an example of how this is done already.Ross
I have to get back to this.
For the gnome tracker case I have in the recipe
| # full text search requires sqlite3 build with PACKAGECONFIG[fts5] set | PACKAGECONFIG[fts] = "-Dfts=true,-Dfts=false"
and was happy to handle it correctly the OE way
| MESON_CROSS_EXTRA_PROPS = "sqlite3_has_fts5='${@bb.utils.contains('PACKAGECONFIG', 'fts', 'true', 'false', d)}'"
Andreas