public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Otavio Salvador <otavio@ossystems.com.br>
To: openembedded-core@lists.openembedded.org
Cc: Otavio Salvador <otavio@ossystems.com.br>
Subject: [PATCH v2 2/2] cargo-cross-canadian: Use SDK's flags during target linking
Date: Sun, 10 Jul 2022 13:43:00 -0300	[thread overview]
Message-ID: <20220710164300.953098-2-otavio@ossystems.com.br> (raw)
In-Reply-To: <20220710164300.953098-1-otavio@ossystems.com.br>

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

(no changes since v1)

 .../cargo/cargo-cross-canadian.inc            | 20 ++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/cargo/cargo-cross-canadian.inc b/meta/recipes-devtools/cargo/cargo-cross-canadian.inc
index 7fc22a4128..01ba151d0a 100644
--- a/meta/recipes-devtools/cargo/cargo-cross-canadian.inc
+++ b/meta/recipes-devtools/cargo/cargo-cross-canadian.inc
@@ -39,6 +39,18 @@ do_compile:prepend () {
 	PKG_CONFIG_PATH="${RECIPE_SYSROOT_NATIVE}/usr/lib/pkgconfig:${PKG_CONFIG_PATH}"
 }
 
+create_sdk_wrapper () {
+        file="$1"
+        shift
+
+        cat <<- EOF > "${file}"
+		#!/bin/sh
+		\$$1 \$@
+		EOF
+
+        chmod +x "$file"
+}
+
 do_install () {
     SYS_BINDIR=$(dirname ${D}${bindir})
     install -d "${SYS_BINDIR}"
@@ -47,6 +59,9 @@ do_install () {
 	chrpath -r "\$ORIGIN/../lib" ${i}
     done
 
+    # Uses SDK's CC as linker so linked binaries works out of box.
+    create_sdk_wrapper "${SYS_BINDIR}/target-rust-ccld" "CC"
+
     ENV_SETUP_DIR=${D}${base_prefix}/environment-setup.d
     mkdir "${ENV_SETUP_DIR}"
     ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo.sh"
@@ -58,7 +73,10 @@ do_install () {
 		touch "\$CARGO_HOME/config"
 		echo "[build]" >> "\$CARGO_HOME/config"
 		echo 'target = "'${TARGET_SYS}'"' >> "\$CARGO_HOME/config"
-        fi
+		echo '# TARGET_SYS' >> "\$CARGO_HOME/config"
+		echo '[target.'${TARGET_SYS}']' >> "\$CARGO_HOME/config"
+		echo 'linker = "target-rust-ccld"' >> "\$CARGO_HOME/config"
+    fi
 
 	# Keep the below off as long as HTTP/2 is disabled.
 	export CARGO_HTTP_MULTIPLEXING=false
-- 
2.36.1



  reply	other threads:[~2022-07-10 16:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-10 16:42 [PATCH v2 1/2] rust-common: Fix use of target definitions for SDK generation Otavio Salvador
2022-07-10 16:43 ` Otavio Salvador [this message]
2022-07-18 12:45   ` [OE-core] [PATCH v2 2/2] cargo-cross-canadian: Use SDK's flags during target linking Richard Purdie
2022-07-18 15:49     ` Otavio Salvador
2022-07-18 15:59       ` Richard Purdie
2022-07-18 19:25         ` Otavio Salvador
2022-07-18 21:18           ` Richard Purdie
2022-07-18 21:41             ` Otavio Salvador
2022-07-18 22:54               ` Richard Purdie
2022-07-19  0:07                 ` Otavio Salvador
2022-07-20 17:21                   ` Richard Purdie
2022-07-20 18:11                     ` Otavio Salvador
2022-07-20 18:26                       ` Richard Purdie
2022-07-20 19:13                       ` Otavio Salvador
2022-07-13 16:05 ` [PATCH v2 1/2] rust-common: Fix use of target definitions for SDK generation Sundeep KOKKONDA
2022-07-14  0:08 ` [OE-core] " Alejandro Enedino Hernandez Samaniego
2022-07-14 11:24   ` Otavio Salvador

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220710164300.953098-2-otavio@ossystems.com.br \
    --to=otavio@ossystems.com.br \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox