[oe-commits] [openembedded-core] 13/19: toolchain-scripts: pass env to post-relocate

git at git.openembedded.org git at git.openembedded.org
Thu Jun 7 07:54:03 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit adcf69ee3310171580c28e141fec6997b1f06da4
Author: Martin Kelly <mkelly at xevo.com>
AuthorDate: Mon Jun 4 16:06:00 2018 -0700

    toolchain-scripts: pass env to post-relocate
    
    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 at xevo.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 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 779cc3f..0ff5301 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 09f757a..da1230b 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() {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list