Specifically:
1. Place the environment setup file into $B and not into $TMPDIR,
so that the recipe using the class can itself better decide what to do with the 
file.

2. Use global, unified sysroots (provided through build-sysroots recipe)
and not recipe-specific ones, as this allows flexible on-the-fly management of 
what
libraries are available to build applications, without having to modify any
recipes, similar to eSDK 'extensible' part.

This also requires adjustment of the sstate sametune_samegsigs test, as 
meta-ide-support
becomes dependent on $MACHINE (unified sysroots have it in their paths)
and needs to be excluded from the test.

3. Add a few missing settings that have been added to SDK environment files.

4. Add a snippet to the environment setup file that also runs the relocation 
scripts.
In regular SDKs this is executed by the SDK installer, in direct SDK we can do 
it when
setting up the environment.

Signed-off-by: Alexander Kanavin <a...@linutronix.de>
---
 meta/classes/toolchain-scripts.bbclass      | 40 ++++++++++++++++-----
 meta/lib/oeqa/selftest/cases/sstatetests.py |  2 +-
 2 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/meta/classes/toolchain-scripts.bbclass 
b/meta/classes/toolchain-scripts.bbclass
index 1d7c703748..16f1e17607 100644
--- a/meta/classes/toolchain-scripts.bbclass
+++ b/meta/classes/toolchain-scripts.bbclass
@@ -63,24 +63,46 @@ toolchain_create_sdk_env_script () {
        toolchain_shared_env_script
 }
 
-# This function creates an environment-setup-script in the TMPDIR which enables
+# This function creates an environment-setup-script in B which enables
 # a OE-core IDE to integrate with the build tree
 # Caller must ensure CONFIG_SITE is setup
 toolchain_create_tree_env_script () {
-       script=${TMPDIR}/environment-setup-${REAL_MULTIMACH_TARGET_SYS}
+       script=${B}/environment-setup-${REAL_MULTIMACH_TARGET_SYS}
        rm -f $script
        touch $script
+       echo 'standalone_sysroot_target="${STAGING_DIR}/${MACHINE}"' >> $script
+       echo 'standalone_sysroot_native="${STAGING_DIR}/${BUILD_ARCH}"' >> 
$script
        echo 'orig=`pwd`; cd ${COREBASE}; . ./oe-init-build-env ${TOPDIR}; cd 
$orig' >> $script
-       echo 'export 
PATH=${STAGING_DIR_NATIVE}/usr/bin:${STAGING_BINDIR_TOOLCHAIN}:$PATH' >> $script
-       echo 'export PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR}' >> 
$script
-       echo 'export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}' >> $script
+       echo 'export 
PATH=$standalone_sysroot_native/${bindir_native}:$standalone_sysroot_native/${bindir_native}/${TARGET_SYS}:$PATH'
 >> $script
+       echo 'export PKG_CONFIG_SYSROOT_DIR=$standalone_sysroot_target' >> 
$script
+       echo 'export 
PKG_CONFIG_PATH=$standalone_sysroot_target'"$libdir"'/pkgconfig:$standalone_sysroot_target'"$prefix"'/share/pkgconfig'
 >> $script
        echo 'export CONFIG_SITE="${CONFIG_SITE}"' >> $script
-       echo 'export SDKTARGETSYSROOT=${STAGING_DIR_TARGET}' >> $script
-       echo 'export OECORE_NATIVE_SYSROOT="${STAGING_DIR_NATIVE}"' >> $script
-       echo 'export OECORE_TARGET_SYSROOT="${STAGING_DIR_TARGET}"' >> $script
-       echo 'export OECORE_ACLOCAL_OPTS="-I 
${STAGING_DIR_NATIVE}/usr/share/aclocal"' >> $script
+       echo 'export SDKTARGETSYSROOT=$standalone_sysroot_target' >> $script
+       echo 'export OECORE_NATIVE_SYSROOT=$standalone_sysroot_native' >> 
$script
+       echo 'export OECORE_TARGET_SYSROOT=$standalone_sysroot_target' >> 
$script
+       echo 'export OECORE_ACLOCAL_OPTS="-I 
$standalone_sysroot_native/usr/share/aclocal"' >> $script
+       echo 'export OECORE_BASELIB="${baselib}"' >> $script
+       echo 'export OECORE_TARGET_ARCH="${TARGET_ARCH}"' >>$script
+       echo 'export OECORE_TARGET_OS="${TARGET_OS}"' >>$script
 
        toolchain_shared_env_script
+
+       cat >> $script <<EOF
+
+if [ -d "\$OECORE_NATIVE_SYSROOT/${datadir}/post-relocate-setup.d/" ]; then
+       for s in \$OECORE_NATIVE_SYSROOT/${datadir}/post-relocate-setup.d/*; do
+               if [ ! -x \$s ]; then
+                       continue
+               fi
+               \$s "\$1"
+               status=\$?
+               if [ \$status != 0 ]; then
+                       echo "post-relocate command \"\$s \$1\" failed with 
status \$status" >&2
+                       exit \$status
+               fi
+       done
+fi
+EOF
 }
 
 toolchain_shared_env_script () {
diff --git a/meta/lib/oeqa/selftest/cases/sstatetests.py 
b/meta/lib/oeqa/selftest/cases/sstatetests.py
index 4749f28ab8..63827f3068 100644
--- a/meta/lib/oeqa/selftest/cases/sstatetests.py
+++ b/meta/lib/oeqa/selftest/cases/sstatetests.py
@@ -444,7 +444,7 @@ BB_SIGNATURE_HANDLER = "OEBasicHash"
             f = []
             for root, dirs, files in os.walk(d):
                 for name in files:
-                    if "meta-environment" in root or "cross-canadian" in root:
+                    if "meta-environment" in root or "cross-canadian" in root 
or 'meta-ide-support' in root:
                         continue
                     if "qemux86copy-" in root or "qemux86-" in root:
                         continue
-- 
2.30.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#168418): 
https://lists.openembedded.org/g/openembedded-core/message/168418
Mute This Topic: https://lists.openembedded.org/mt/92554105/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to