]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
cargo_common: Handle build SYS as well as HOST/TARGET
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 5 Aug 2022 12:29:09 +0000 (13:29 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 8 Aug 2022 14:41:36 +0000 (15:41 +0100)
Improve the common class to handle BUILD_SYS as well as host and target,
removing the need to a workaround in the rust recipe.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/cargo_common.bbclass
meta/recipes-devtools/rust/rust.inc

index dcd0afd980195736a5f2312e9f5025bf4d2a77ce..4a419cdd0a36681fb0b9473809b41aef1183638b 100644 (file)
@@ -82,6 +82,15 @@ cargo_common_do_configure () {
                EOF
        fi
 
+       if [ "${RUST_TARGET_SYS}" != "${RUST_BUILD_SYS}" -a "${RUST_TARGET_SYS}" != "${RUST_HOST_SYS}"]; then
+               cat <<- EOF >> ${CARGO_HOME}/config
+
+               # TARGET_SYS
+               [target.${RUST_TARGET_SYS}]
+               linker = "${RUST_TARGET_CCLD}"
+               EOF
+       fi
+
        # Put build output in build directory preferred by bitbake instead of
        # inside source directory unless they are the same
        if [ "${B}" != "${S}" ]; then
index 5730887411a278c2e1a48a70d2d6ed9f184530e8..12c86e02c4ab5949be61c1a718ad03b8ebed797f 100644 (file)
@@ -29,9 +29,6 @@ setup_cargo_environment () {
     # x86_64-unknown-linux-gnu.
     # Later stages are build for the native target (i.e. target.x86_64-linux)
     cargo_common_do_configure
-
-    printf '[target.%s]\n' "${RUST_BUILD_SYS}" >> ${CARGO_HOME}/config
-    printf "linker = '%s'\n" "${RUST_BUILD_CCLD}" >> ${CARGO_HOME}/config
 }
 
 inherit rust-target-config