Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Martin Kelly <mkelly@xevo.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH v3 4/6] toolchain-scripts: pass env to post-relocate
Date: Mon,  4 Jun 2018 16:06:00 -0700	[thread overview]
Message-ID: <20180604230602.8461-5-mkelly@xevo.com> (raw)
In-Reply-To: <20180604230602.8461-1-mkelly@xevo.com>

It's useful for the post-relocate scripts to be able to see the SDK
environment, for example to see the values of CC, CXX etc. in order to
dynamically generate toolchain files.

To enable this, source the SDK environment script prior to calling the
relocate scripts.

Signed-off-by: Martin Kelly <mkelly@xevo.com>
---
v3:
- Source all top-level env setup scripts instead of just one.

 meta/classes/toolchain-scripts.bbclass     | 20 ++++++++++++++++----
 meta/recipes-core/meta/meta-environment.bb |  2 +-
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/meta/classes/toolchain-scripts.bbclass b/meta/classes/toolchain-scripts.bbclass
index ef190a69ec..727bdab4a0 100644
--- a/meta/classes/toolchain-scripts.bbclass
+++ b/meta/classes/toolchain-scripts.bbclass
@@ -118,11 +118,23 @@ EOF
 }
 
 toolchain_create_post_relocate_script() {
-	script=$1
-	rm -f $script
-	touch $script
+	relocate_script=$1
+	env_dir=$2
+	rm -f $relocate_script
+	touch $relocate_script
+
+	cat >> $relocate_script <<EOF
+# Source top-level SDK env scripts in case they are needed for the relocate
+# scripts.
+for env_setup_script in ${env_dir}/environment-setup-*; do
+    . \$env_setup_script
+    status=\$?
+    if [ \$status != 0 ]; then
+        echo "\$0: Failed to source \$env_setup_script with status \$status"
+        exit \$status
+    fi
+done
 
-	cat >> $script <<EOF
 if [ -d "${SDKPATHNATIVE}/post-relocate-setup.d/" ]; then
     for s in ${SDKPATHNATIVE}/post-relocate-setup.d/*; do
         if [ ! -x \$s ]; then
diff --git a/meta/recipes-core/meta/meta-environment.bb b/meta/recipes-core/meta/meta-environment.bb
index 09f757a087..da1230bead 100644
--- a/meta/recipes-core/meta/meta-environment.bb
+++ b/meta/recipes-core/meta/meta-environment.bb
@@ -56,7 +56,7 @@ create_sdk_files() {
 	# Add version information
 	toolchain_create_sdk_version ${SDK_OUTPUT}/${SDKPATH}/version-${REAL_MULTIMACH_TARGET_SYS}
 
-	toolchain_create_post_relocate_script ${SDK_OUTPUT}/${SDKPATH}/post-relocate-setup.sh
+	toolchain_create_post_relocate_script ${SDK_OUTPUT}/${SDKPATH}/post-relocate-setup.sh ${SDKPATH}
 }
 
 do_install() {
-- 
2.11.0



  parent reply	other threads:[~2018-06-04 23:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-04 23:05 [PATCH v3 0/6] meson: implement nativesdk support Martin Kelly
2018-06-04 23:05 ` [PATCH v3 1/6] toolchain-scripts: retab file Martin Kelly
2018-06-05 10:09   ` Peter Kjellerstedt
2018-06-05 10:36     ` Richard Purdie
2018-06-05 12:04       ` Peter Kjellerstedt
2018-06-05 16:56         ` Martin Kelly
2018-06-04 23:05 ` [PATCH v3 2/6] toolchain-scripts: allow non-sh post-relocate Martin Kelly
2018-06-05 10:27   ` Peter Kjellerstedt
2018-06-05 10:36     ` Richard Purdie
2018-06-04 23:05 ` [PATCH v3 3/6] toolchain-scripts: print post-relocate error Martin Kelly
2018-06-04 23:06 ` Martin Kelly [this message]
2018-06-04 23:06 ` [PATCH v3 5/6] meson: handle exe wrappers Martin Kelly
2018-06-04 23:06 ` [PATCH v3 6/6] meson: enable nativesdk Martin Kelly

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=20180604230602.8461-5-mkelly@xevo.com \
    --to=mkelly@xevo.com \
    --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