diff options
author | Chen Qi <Qi.Chen@windriver.com> | 2018-03-05 10:02:01 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-03-06 06:43:10 -0800 |
commit | d1e6aa57f7ee44b92c3a2ec740b806c17254814a (patch) | |
tree | a9f18a9cb18d1a97d010c35534324aa834e1927d /meta | |
parent | 40cdf6dd789d3f4977b31898e23db52d3bf7a657 (diff) | |
download | poky-d1e6aa57f7ee44b92c3a2ec740b806c17254814a.tar.gz |
meson.bbclass: fix to build for more projects
We should use the value of CC for the c compiler setting in cross
compilation configuration file for meson. For example, if we only
use ${HOST_PREFIX}gcc instead of ${CC}, we would meet the following
do_compile failure for systemd.
cc1: fatal error: linux/capability.h: No such file or directory
Do the same change for LD, AR, NM, STRIP and READELF.
(From OE-Core rev: 177bd96a531fcc85e62baff04aba327e2bccee07)
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/meson.bbclass | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass index 31d32a56f6..2d7ee4fffc 100644 --- a/meta/classes/meson.bbclass +++ b/meta/classes/meson.bbclass | |||
@@ -41,26 +41,22 @@ MESON_CROSS_FILE = "" | |||
41 | MESON_CROSS_FILE_class-target = "--cross-file ${WORKDIR}/meson.cross" | 41 | MESON_CROSS_FILE_class-target = "--cross-file ${WORKDIR}/meson.cross" |
42 | MESON_CROSS_FILE_class-nativesdk = "--cross-file ${WORKDIR}/meson.cross" | 42 | MESON_CROSS_FILE_class-nativesdk = "--cross-file ${WORKDIR}/meson.cross" |
43 | 43 | ||
44 | CCOMPILER ?= "gcc" | ||
45 | CXXCOMPILER ?= "g++" | ||
46 | CCOMPILER_toolchain-clang = "clang" | ||
47 | CXXCOMPILER_toolchain-clang = "clang++" | ||
48 | |||
49 | def meson_array(var, d): | 44 | def meson_array(var, d): |
50 | return "', '".join(d.getVar(var).split()).join(("'", "'")) | 45 | return "', '".join(d.getVar(var).split()).join(("'", "'")) |
51 | 46 | ||
52 | addtask write_config before do_configure | 47 | addtask write_config before do_configure |
53 | do_write_config[vardeps] += "MESON_C_ARGS MESON_CPP_ARGS MESON_LINK_ARGS" | 48 | do_write_config[vardeps] += "MESON_C_ARGS MESON_CPP_ARGS MESON_LINK_ARGS CC CXX LD AR NM STRIP READELF" |
54 | do_write_config() { | 49 | do_write_config() { |
55 | # This needs to be Py to split the args into single-element lists | 50 | # This needs to be Py to split the args into single-element lists |
56 | cat >${WORKDIR}/meson.cross <<EOF | 51 | cat >${WORKDIR}/meson.cross <<EOF |
57 | [binaries] | 52 | [binaries] |
58 | c = '${HOST_PREFIX}${CCOMPILER}' | 53 | c = [${@meson_array('CC', d)}] |
59 | cpp = '${HOST_PREFIX}${CXXCOMPILER}' | 54 | cpp = [${@meson_array('CXX', d)}] |
60 | ar = '${HOST_PREFIX}ar' | 55 | ar = [${@meson_array('AR', d)}] |
61 | ld = '${HOST_PREFIX}ld' | 56 | nm = [${@meson_array('NM', d)}] |
62 | strip = '${HOST_PREFIX}strip' | 57 | ld = [${@meson_array('LD', d)}] |
63 | readelf = '${HOST_PREFIX}readelf' | 58 | strip = [${@meson_array('STRIP', d)}] |
59 | readelf = [${@meson_array('READELF', d)}] | ||
64 | pkgconfig = 'pkg-config' | 60 | pkgconfig = 'pkg-config' |
65 | 61 | ||
66 | [properties] | 62 | [properties] |