diff options
author | Joshua Watt <JPEWhacker@gmail.com> | 2021-11-19 14:51:40 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-11-23 10:53:15 +0000 |
commit | 08a86c364636b3914bf0e2efceedb774dff97f00 (patch) | |
tree | 2652a433a91dbabd7d96f59767a4d676ad71712d | |
parent | a20e6a8a85071e05b371d4f5a04a2557667828cd (diff) | |
download | poky-08a86c364636b3914bf0e2efceedb774dff97f00.tar.gz |
classes/meson: Add optional rust definitions
Adds the rust tools to the cross and native files if present so that
projects that use both rust and meson can build
(From OE-Core rev: 0ec40fa3aff233bd0dde0461299150786da956ef)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/meson.bbclass | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass index 4ba70de3dc..a7981e481f 100644 --- a/meta/classes/meson.bbclass +++ b/meta/classes/meson.bbclass | |||
@@ -36,8 +36,15 @@ MESON_CROSS_FILE = "" | |||
36 | MESON_CROSS_FILE:class-target = "--cross-file ${WORKDIR}/meson.cross" | 36 | MESON_CROSS_FILE:class-target = "--cross-file ${WORKDIR}/meson.cross" |
37 | MESON_CROSS_FILE:class-nativesdk = "--cross-file ${WORKDIR}/meson.cross" | 37 | MESON_CROSS_FILE:class-nativesdk = "--cross-file ${WORKDIR}/meson.cross" |
38 | 38 | ||
39 | def rust_tool(d, target_var): | ||
40 | rustc = d.getVar('RUSTC') | ||
41 | if not rustc: | ||
42 | return "" | ||
43 | cmd = [rustc, "--target", d.getVar(target_var)] + d.getVar("RUSTFLAGS").split() | ||
44 | return "rust = %s" % repr(cmd) | ||
45 | |||
39 | addtask write_config before do_configure | 46 | addtask write_config before do_configure |
40 | do_write_config[vardeps] += "CC CXX LD AR NM STRIP READELF CFLAGS CXXFLAGS LDFLAGS" | 47 | do_write_config[vardeps] += "CC CXX LD AR NM STRIP READELF CFLAGS CXXFLAGS LDFLAGS RUSTC RUSTFLAGS" |
41 | do_write_config() { | 48 | do_write_config() { |
42 | # This needs to be Py to split the args into single-element lists | 49 | # This needs to be Py to split the args into single-element lists |
43 | cat >${WORKDIR}/meson.cross <<EOF | 50 | cat >${WORKDIR}/meson.cross <<EOF |
@@ -54,6 +61,7 @@ llvm-config = 'llvm-config${LLVMVERSION}' | |||
54 | cups-config = 'cups-config' | 61 | cups-config = 'cups-config' |
55 | g-ir-scanner = '${STAGING_BINDIR}/g-ir-scanner-wrapper' | 62 | g-ir-scanner = '${STAGING_BINDIR}/g-ir-scanner-wrapper' |
56 | g-ir-compiler = '${STAGING_BINDIR}/g-ir-compiler-wrapper' | 63 | g-ir-compiler = '${STAGING_BINDIR}/g-ir-compiler-wrapper' |
64 | ${@rust_tool(d, "HOST_SYS")} | ||
57 | 65 | ||
58 | [built-in options] | 66 | [built-in options] |
59 | c_args = ${@meson_array('CFLAGS', d)} | 67 | c_args = ${@meson_array('CFLAGS', d)} |
@@ -88,6 +96,7 @@ strip = ${@meson_array('BUILD_STRIP', d)} | |||
88 | readelf = ${@meson_array('BUILD_READELF', d)} | 96 | readelf = ${@meson_array('BUILD_READELF', d)} |
89 | objcopy = ${@meson_array('BUILD_OBJCOPY', d)} | 97 | objcopy = ${@meson_array('BUILD_OBJCOPY', d)} |
90 | pkgconfig = 'pkg-config-native' | 98 | pkgconfig = 'pkg-config-native' |
99 | ${@rust_tool(d, "BUILD_SYS")} | ||
91 | 100 | ||
92 | [built-in options] | 101 | [built-in options] |
93 | c_args = ${@meson_array('BUILD_CFLAGS', d)} | 102 | c_args = ${@meson_array('BUILD_CFLAGS', d)} |