From: Harish Sadineni <[email protected]>

Export `OECORE_TARGET_SYS` in the generated SDK and tree environment
setup scripts, and source any `*.sh` files from
`environment-setup.d/${TARGET_SYS}` in addition to the existing
`environment-setup.d` directory.

This complements the rust-cross-canadian changes, where Rust
environment setup scripts are installed under a target-specific
directory. By sourcing only the scripts that match the active target,
the SDK avoids loading environment settings for other target variants,
such as mixing 32-bit and 64-bit configurations in multilib SDKs.

Signed-off-by: Harish Sadineni <[email protected]>
---
 meta/classes-recipe/toolchain-scripts.bbclass | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/meta/classes-recipe/toolchain-scripts.bbclass 
b/meta/classes-recipe/toolchain-scripts.bbclass
index 8c062ef0e7..9405b3b1e6 100644
--- a/meta/classes-recipe/toolchain-scripts.bbclass
+++ b/meta/classes-recipe/toolchain-scripts.bbclass
@@ -76,6 +76,7 @@ toolchain_create_sdk_env_script () {
        echo 'export 
OECORE_MESON_HOST_CPU_FAMILY="${@meson_cpu_family('TARGET_ARCH', d)}"' >>$script
        echo 'export OECORE_MESON_HOST_CPU="${TARGET_ARCH}"' >>$script
        echo 'export OECORE_MESON_HOST_ENDIAN="${@meson_endian('TARGET', d)}"' 
>>$script
+       echo 'export OECORE_TARGET_SYS="${TARGET_SYS}"' >> $script
 
        echo 'unset command_not_found_handle' >> $script
 
@@ -110,6 +111,7 @@ toolchain_create_tree_env_script () {
        echo 'export 
OECORE_MESON_HOST_CPU_FAMILY="${@meson_cpu_family('TARGET_ARCH', d)}"' >>$script
        echo 'export OECORE_MESON_HOST_CPU="${TARGET_ARCH}"' >>$script
        echo 'export OECORE_MESON_HOST_ENDIAN="${@meson_endian('TARGET', d)}"' 
>>$script
+        echo 'export OECORE_TARGET_SYS="${TARGET_SYS}"' >> $script
 
        toolchain_shared_env_script
 
@@ -172,6 +174,12 @@ if [ -d "\$OECORE_NATIVE_SYSROOT/environment-setup.d" ]; 
then
            . \$envfile
     done
 fi
+if [ -d "\$OECORE_NATIVE_SYSROOT/environment-setup.d/\$OECORE_TARGET_SYS" ]; 
then
+    for envfile in 
\$OECORE_NATIVE_SYSROOT/environment-setup.d/\$OECORE_TARGET_SYS/*.sh; do
+            . \$envfile
+    done
+fi
+
 EOF
 }
 
-- 
2.51.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#241822): 
https://lists.openembedded.org/g/openembedded-core/message/241822
Mute This Topic: https://lists.openembedded.org/mt/120408880/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to