]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
toolchain-scripts: pass env to post-relocate
authorMartin Kelly <mkelly@xevo.com>
Mon, 4 Jun 2018 23:06:00 +0000 (16:06 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 7 Jun 2018 07:52:13 +0000 (08:52 +0100)
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>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/toolchain-scripts.bbclass
meta/recipes-core/meta/meta-environment.bb

index 779cc3f5e42e282d214fb25881c674ecbc3aae23..0ff5301530b7f7fad33ec3f73266a9c0cc87ea0c 100644 (file)
@@ -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
index 09f757a087c5895345476e2bce4d4e7e03cfc3bf..da1230bead8713d397cbd0cdbac79c73548a99ea 100644 (file)
@@ -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() {