summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-07-23 13:48:24 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-07-28 11:07:11 +0100
commit2d4b35a0db1220e7a7f1b6776223aa4d40a3f246 (patch)
treece3cd1d075cd1bdd94b6fcd578b114a6a6a24035 /meta
parent3795285cbf362e13b8151bfdbe1bce999ac28641 (diff)
downloadopenembedded-core-contrib-2d4b35a0db1220e7a7f1b6776223aa4d40a3f246.tar.gz
rust-target-config: Allow the targets generated to be configurable
Remove further code duplication by allowing the main function to be configurable. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/rust-target-config.bbclass10
-rw-r--r--meta/recipes-devtools/cargo/cargo-cross-canadian.inc7
-rw-r--r--meta/recipes-devtools/rust/rust-cross-canadian-common.inc8
-rw-r--r--meta/recipes-devtools/rust/rust-cross.inc8
4 files changed, 11 insertions, 22 deletions
diff --git a/meta/classes/rust-target-config.bbclass b/meta/classes/rust-target-config.bbclass
index 4db91d36d5..87b7dee3ed 100644
--- a/meta/classes/rust-target-config.bbclass
+++ b/meta/classes/rust-target-config.bbclass
@@ -357,10 +357,16 @@ rust_gen_target[vardepsexclude] += "RUST_HOST_SYS RUST_TARGET_SYS ABIEXTENSION l
do_rust_gen_targets[vardeps] += "DATA_LAYOUT TARGET_ENDIAN TARGET_POINTER_WIDTH TARGET_C_INT_WIDTH MAX_ATOMIC_WIDTH FEATURES"
+RUST_TARGETGENS = "BUILD"
+
python do_rust_gen_targets () {
wd = d.getVar('WORKDIR') + '/targets/'
- build_arch = d.getVar('BUILD_ARCH')
- rust_gen_target(d, 'BUILD', wd, build_arch)
+ # Order of BUILD, HOST, TARGET is important in case the files overwrite, most specific last
+ rust_gen_target(d, 'BUILD', wd, d.getVar('BUILD_ARCH'))
+ if "HOST" in d.getVar("RUST_TARGETGENS"):
+ rust_gen_target(d, 'HOST', wd, d.getVar('HOST_ARCH'))
+ if "TARGET" in d.getVar("RUST_TARGETGENS"):
+ rust_gen_target(d, 'TARGET', wd, d.getVar('TARGET_ARCH'))
}
addtask rust_gen_targets after do_patch before do_compile
diff --git a/meta/recipes-devtools/cargo/cargo-cross-canadian.inc b/meta/recipes-devtools/cargo/cargo-cross-canadian.inc
index e83b6a67b3..a2fac929d4 100644
--- a/meta/recipes-devtools/cargo/cargo-cross-canadian.inc
+++ b/meta/recipes-devtools/cargo/cargo-cross-canadian.inc
@@ -28,12 +28,7 @@ inherit cross-canadian
PN = "cargo-cross-canadian-${TRANSLATED_TARGET_ARCH}"
-python do_rust_gen_targets () {
- wd = d.getVar('WORKDIR') + '/targets/'
-
- rust_gen_target(d, 'BUILD', wd, d.getVar('BUILD_ARCH'))
- rust_gen_target(d, 'HOST', wd, d.getVar('HOST_ARCH'))
-}
+RUST_TARGETGENS = "BUILD HOST"
do_compile:prepend () {
PKG_CONFIG_PATH="${RECIPE_SYSROOT_NATIVE}/usr/lib/pkgconfig:${PKG_CONFIG_PATH}"
diff --git a/meta/recipes-devtools/rust/rust-cross-canadian-common.inc b/meta/recipes-devtools/rust/rust-cross-canadian-common.inc
index 5c0644e92d..34020ff6ff 100644
--- a/meta/recipes-devtools/rust/rust-cross-canadian-common.inc
+++ b/meta/recipes-devtools/rust/rust-cross-canadian-common.inc
@@ -25,13 +25,7 @@ DEBUG_PREFIX_MAP = "-fdebug-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDP
-fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
"
-python do_rust_gen_targets () {
- wd = d.getVar('WORKDIR') + '/targets/'
- # Order of BUILD, HOST, TARGET is important in case the files overwrite, most specific last
- rust_gen_target(d, 'BUILD', wd, d.getVar('BUILD_ARCH'))
- rust_gen_target(d, 'HOST', wd, d.getVar('HOST_ARCH'))
- rust_gen_target(d, 'TARGET', wd, d.getVar('TARGET_ARCH'))
-}
+RUST_TARGETGENS = "BUILD HOST TARGET"
INHIBIT_DEFAULT_RUST_DEPS = "1"
diff --git a/meta/recipes-devtools/rust/rust-cross.inc b/meta/recipes-devtools/rust/rust-cross.inc
index 719857ebbb..ab538e6659 100644
--- a/meta/recipes-devtools/rust/rust-cross.inc
+++ b/meta/recipes-devtools/rust/rust-cross.inc
@@ -1,10 +1,4 @@
-python do_rust_gen_targets () {
- wd = d.getVar('WORKDIR') + '/targets/'
- # Order of BUILD, HOST, TARGET is important in case the files overwrite, most specific last
- rust_gen_target(d, 'BUILD', wd, d.getVar('BUILD_ARCH'))
- rust_gen_target(d, 'HOST', wd, d.getVar('HOST_ARCH'))
- rust_gen_target(d, 'TARGET', wd, d.getVar('TARGET_ARCH'))
-}
+RUST_TARGETGENS = "BUILD HOST TARGET"
# Otherwise we'll depend on what we provide
INHIBIT_DEFAULT_RUST_DEPS = "1"