]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
rust-target-config: Allow the targets generated to be configurable
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 23 Jul 2022 12:48:24 +0000 (13:48 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 28 Jul 2022 10:07:11 +0000 (11:07 +0100)
Remove further code duplication by allowing the main function to be
configurable.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/rust-target-config.bbclass
meta/recipes-devtools/cargo/cargo-cross-canadian.inc
meta/recipes-devtools/rust/rust-cross-canadian-common.inc
meta/recipes-devtools/rust/rust-cross.inc

index 4db91d36d53a938eadc92a590519a4b142e5f3da..87b7dee3edc4b657b14bf7c7c4cac3661da47275 100644 (file)
@@ -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
index e83b6a67b3b86bc87c2b4f0e800e119aee70a78f..a2fac929d451ba4562f46d6495e7cdf380a25703 100644 (file)
@@ -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}"
index 5c0644e92d78b7d969409b6ac5a48a9f0ff1a2d7..34020ff6ff4659640bae1824e2274a8b322b4314 100644 (file)
@@ -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"
 
index 719857ebbb3a9a4cc5b4db1b66374c55b09617ef..ab538e6659b9e9afbc6fba7fcb49e720b1edfd0f 100644 (file)
@@ -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"