Skip to content

Commit

Permalink
meson: only use lists of commands in cross file if required
Browse files Browse the repository at this point in the history
There's a bug in Meson[1] where it find_program("foo") will fail if foo is
defined in the cross file as a list.

This is causing the Meson build of libdrm to fail, but for this instance we can
work around the problem by only using lists in the cross file if there are
arguments, and just using a string if there are not.

[1] mesonbuild/meson#3737

(From OE-Core rev: 928a7e26f254eb2da20bd917e83ed5467323de13)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
  • Loading branch information
rossburton authored and rpurdie committed Jun 17, 2018
1 parent 317debe commit 1212e7a
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions meta/classes/meson.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -42,29 +42,30 @@ MESON_CROSS_FILE_class-target = "--cross-file ${WORKDIR}/meson.cross"
MESON_CROSS_FILE_class-nativesdk = "--cross-file ${WORKDIR}/meson.cross"

def meson_array(var, d):
return "', '".join(d.getVar(var).split()).join(("'", "'"))
items = d.getVar(var).split()
return repr(items[0] if len(items) == 1 else items)

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() {
# This needs to be Py to split the args into single-element lists
cat >${WORKDIR}/meson.cross <<EOF
[binaries]
c = [${@meson_array('CC', d)}]
cpp = [${@meson_array('CXX', d)}]
ar = [${@meson_array('AR', d)}]
nm = [${@meson_array('NM', d)}]
ld = [${@meson_array('LD', d)}]
strip = [${@meson_array('STRIP', d)}]
readelf = [${@meson_array('READELF', d)}]
c = ${@meson_array('CC', d)}
cpp = ${@meson_array('CXX', d)}
ar = ${@meson_array('AR', d)}
nm = ${@meson_array('NM', d)}
ld = ${@meson_array('LD', d)}
strip = ${@meson_array('STRIP', d)}
readelf = ${@meson_array('READELF', d)}
pkgconfig = 'pkg-config'

[properties]
needs_exe_wrapper = true
c_args = [${@meson_array('MESON_C_ARGS', d)}]
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)}]
c_args = ${@meson_array('MESON_C_ARGS', d)}
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'

[host_machine]
Expand Down

0 comments on commit 1212e7a

Please sign in to comment.