diff options
| author | Joshua Watt <JPEWhacker@gmail.com> | 2021-11-19 14:51:40 -0600 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-12-13 23:02:49 +0000 |
| commit | 6c93529a7d84c1cfe6118197b9b2d2c09c02e16b (patch) | |
| tree | a00a68342ebc6c13c51fc3121b88e33922a52196 | |
| parent | f8de48283043d5e8cced1d754128dced6a757ece (diff) | |
| download | poky-6c93529a7d84c1cfe6118197b9b2d2c09c02e16b.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: 11b9c077553f06c1c52a4e03c395b6e6d567b531)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 0ec40fa3aff233bd0dde0461299150786da956ef)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.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)} |
