toolchain-scripts.bbclass: Allow sourcing of subscript for environment
PATCH 1/2 toolchain-scripts.bbclass: Allow sourcing of subscript for environment
Sometimes we require extra environment settings to be available on the environment for proper SDK work. This were done, in past, using '_append' tasks however with the split of the environment in a canadian package this has been broken.
The easier and more flexible solution is to use environment subscripts which are sources by the main script. These are now looked at:
$OECORE_NATIVE_SYSROOT/environment-setup.d/*.sh
and sourced.
--- meta/classes/toolchain-scripts.bbclass | 10 ++++++++++ 1 file changed, 10 insertions(+)
meta/classes/toolchain-scripts.bbclass +10 -0
@@ -72,6 +72,16 @@ toolchain_shared_env_script () { echo 'export OECORE_SDK_VERSION="${SDK_VERSION}"' >> $script echo 'export ARCH=${ARCH}' >> $script echo 'export CROSS_COMPILE=${TARGET_PREFIX}' >> $script + + cat >> $script <<EOF + +# Append environment subscripts +if [ -d "\$OECORE_NATIVE_SYSROOT/environment-setup.d" ]; then + for envfile in \$OECORE_NATIVE_SYSROOT/environment-setup.d/*.sh; do + source \$envfile + done +fi +EOF } #we get the cached site config in the runtime
Signature · 1 line
1.7.10.4
PATCH 2/2 meta-toolchain-qt: Fix environment population
The generation of the environment has change since the change to use a meta-environment canadian package in the OE-Core, the SDK environment setting has been broken. This uses the new subscript environment to fix it.
--- meta/recipes-qt/meta/meta-toolchain-qt.inc | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
meta/recipes-qt/meta/meta-toolchain-qt.inc +12 -9
@@ -4,29 +4,32 @@ TOOLCHAIN_OUTPUTNAME = "${SDK_NAME}-toolchain-${QTNAME}-${DISTRO_VERSION}" require recipes-core/meta/meta-toolchain.bb -QT_TOOLS_PREFIX = "${SDKPATHNATIVE}${bindir_nativesdk}" +QT_TOOLS_PREFIX = "$OECORE_NATIVE_SYSROOT${bindir_nativesdk}" -toolchain_create_sdk_env_script_append() { - echo 'export OE_QMAKE_CFLAGS="$CFLAGS"' >> $script +create_sdk_files_append() { + mkdir -p ${SDK_OUTPUT}${SDKPATHNATIVE}/environment-setup.d/ + script=${SDK_OUTPUT}${SDKPATHNATIVE}/environment-setup.d/${QT_DIR_NAME}.sh + + echo 'export OE_QMAKE_CFLAGS="$CFLAGS"' > $script echo 'export OE_QMAKE_CXXFLAGS="$CXXFLAGS"' >> $script echo 'export OE_QMAKE_LDFLAGS="$LDFLAGS"' >> $script echo 'export OE_QMAKE_CC=$CC' >> $script echo 'export OE_QMAKE_CXX=$CXX' >> $script echo 'export OE_QMAKE_LINK=$CXX' >> $script echo 'export OE_QMAKE_AR=$AR' >> $script - echo 'export OE_QMAKE_LIBDIR_QT=${SDKTARGETSYSROOT}/${libdir}' >> $script - echo 'export OE_QMAKE_INCDIR_QT=${SDKTARGETSYSROOT}/${includedir}/${QT_DIR_NAME}' >> $script + echo 'export OE_QMAKE_LIBDIR_QT=$OECORE_TARGET_SYSROOT${libdir}' >> $script + echo 'export OE_QMAKE_INCDIR_QT=$OECORE_TARGET_SYSROOT${includedir}/${QT_DIR_NAME}' >> $script echo 'export OE_QMAKE_MOC=${QT_TOOLS_PREFIX}/moc4' >> $script echo 'export OE_QMAKE_UIC=${QT_TOOLS_PREFIX}/uic4' >> $script echo 'export OE_QMAKE_UIC3=${QT_TOOLS_PREFIX}/uic34' >> $script echo 'export OE_QMAKE_RCC=${QT_TOOLS_PREFIX}/rcc4' >> $script echo 'export OE_QMAKE_QDBUSCPP2XML=${QT_TOOLS_PREFIX}/qdbuscpp2xml4' >> $script echo 'export OE_QMAKE_QDBUSXML2CPP=${QT_TOOLS_PREFIX}/qdbusxml2cpp4' >> $script - echo 'export OE_QMAKE_QT_CONFIG=${SDKTARGETSYSROOT}/${datadir}/${QT_DIR_NAME}/mkspecs/qconfig.pri' >> $script - echo 'export QMAKESPEC=${SDKTARGETSYSROOT}/${datadir}/${QT_DIR_NAME}/mkspecs/linux-g++' >> $script - echo 'export QT_CONF_PATH=${SDKPATHNATIVE}/${sysconfdir}/qt.conf' >> $script + echo 'export OE_QMAKE_QT_CONFIG=$OECORE_TARGET_SYSROOT${datadir}/${QT_DIR_NAME}/mkspecs/qconfig.pri' >> $script + echo 'export QMAKESPEC=$OECORE_TARGET_SYSROOT${datadir}/${QT_DIR_NAME}/mkspecs/linux-g++' >> $script + echo 'export QT_CONF_PATH=$OECORE_NATIVE_SYSROOT${sysconfdir}/qt.conf' >> $script # make a symbolic link to mkspecs for compatibility with Qt SDK # and Qt Creator - (cd ${SDK_OUTPUT}/${QT_TOOLS_PREFIX}/..; ln -s ${SDKTARGETSYSROOT}/usr/share/${QT_DIR_NAME}/mkspecs mkspecs;) + (cd ${SDK_OUTPUT}/${SDKPATHNATIVE}${bindir_nativesdk}/..; ln -s ${SDKTARGETSYSROOT}/usr/share/${QT_DIR_NAME}/mkspecs mkspecs;) }
Signature · 1 line
1.7.10.4
Quoted 5 lines · Otavio Salvador
Sometimes we require extra environment settings to be available on the environment for proper SDK work. This were done, in past, using '
_append' tasks however with the split of the environment in a canadian package this has been broken.
Quoted 8 lines
The easier and more flexible solution is to use environment subscripts which are sources by the main script. These are now looked at:
$OECORE_NATIVE_SYSROOT/environment-setup.d/*.sh
and sourced.
Signed-off-by Otavio Salvador <[email protected]>
I really like this approach. However, is there any way for the subscripts to be arch specific?
--Mark
Quoted 26 lines
--- meta/classes/toolchain-scripts.bbclass | 10 ++++++++++ 1 file changed, 10 insertions(+)meta/classes/toolchain-scripts.bbclass +10
-0@@ -72,6 +72,16 @@ toolchain_shared_env_script () { echo 'export OECORE_SDK_VERSION="${SDK_VERSION}"' >> $script echo 'export ARCH=${ARCH}' >> $script echo 'export CROSS_COMPILE=${TARGET_PREFIX}' >> $script + + cat >> $script <<EOF + +# Append environment subscripts +if [ -d "\$OECORE_NATIVE_SYSROOT/environment-setup.d" ]; then + for envfile in \$OECORE_NATIVE_SYSROOT/environment-setup.d/*.sh; do + source \$envfile + done +fi +EOF } #we get the cached site config in the runtime
Quoted 12 lines · Mark Hatle
Quoted 11 lines · Otavio Salvador
Sometimes we require extra environment settings to be available on the environment for proper SDK work. This were done, in past, using '
_append' tasks however with the split of the environment in a canadian package this has been broken.The easier and more flexible solution is to use environment subscripts which are sources by the main script. These are now looked at:
$OECORE_NATIVE_SYSROOT/environment-setup.d/*.sh
Quoted 7 lines
Quoted 3 lines
and sourced.
Signed-off-by Otavio Salvador <[email protected]>I really like this approach. However, is there any way for the subscripts to be arch specific?
I think we can plan on that but this would be 1.8 material IMO. This is enough for what we need today and can easily be improved in future work. What do you think?
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
Quoted 18 lines · Otavio Salvador
Quoted 17 lines · Mark Hatle
Quoted 14 lines · Otavio Salvador
Sometimes we require extra environment settings to be available on the environment for proper SDK work. This were done, in past, using '
_append' tasks however with the split of the environment in a canadian package this has been broken.The easier and more flexible solution is to use environment subscripts which are sources by the main script. These are now looked at:
$OECORE_NATIVE_SYSROOT/environment-setup.d/*.sh
and sourced.
Signed-off-by Otavio Salvador <[email protected]>
Quoted 7 lines
Quoted 2 lines
I really like this approach. However, is there any way for the subscripts to be arch specific?
I think we can plan on that but this would be 1.8 material IMO. This is enough for what we need today and can easily be improved in future work. What do you think?
I think it's a fairly low risk change.. I'm certainly not against it.
--Mark
PATCH 1/1 toolchains-scripts: Add support for target environment scripts
In a similar way to the previous script which adds support for native environment scripts, this adds support for target environment scripts too.
meta/classes/toolchain-scripts.bbclass +5 -0
@@ -76,6 +76,11 @@ toolchain_shared_env_script () { cat >> $script <<EOF # Append environment subscripts +if [ -d "\$OECORE_TARGET_SYSROOT/environment-setup.d" ]; then + for envfile in \$OECORE_TARGET_SYSROOT/environment-setup.d/*.sh; do + source \$envfile + done +fi if [ -d "\$OECORE_NATIVE_SYSROOT/environment-setup.d" ]; then for envfile in \$OECORE_NATIVE_SYSROOT/environment-setup.d/*.sh; do source \$envfile
Re: [PATCH] toolchains-scripts: Add support for target environment scripts
meta/classes/toolchain-scripts.bbclass
Quoted 7 lines · Richard Purdie
In a similar way to the previous script which adds support for native environment scripts, this adds support for target environment scripts too.
Signed-off-by Richard Purdie <[email protected]>meta/classes/toolchain-scripts.bbclass +0
-0
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
Quoted 22 lines · Mark Hatle
Quoted 21 lines · Otavio Salvador
Quoted 19 lines · Mark Hatle
Quoted 6 lines · Otavio Salvador
Sometimes we require extra environment settings to be available on the environment for proper SDK work. This were done, in past, using '
_append' tasks however with the split of the environment in a canadian package this has been broken.Quoted 8 lines
The easier and more flexible solution is to use environment subscripts which are sources by the main script. These are now looked at:
$OECORE_NATIVE_SYSROOT/environment-setup.d/*.sh
and sourced.
Signed-off-by Otavio Salvador <[email protected]>I really like this approach. However, is there any way for the subscripts to be arch specific?
Quoted 6 lines
Quoted 4 lines
I think we can plan on that but this would be 1.8 material IMO. This is enough for what we need today and can easily be improved in future work. What do you think?
I think it's a fairly low risk change.. I'm certainly not against it.
We can easily add the target part too, I've just sent out a patch which does this. I do agree that this is probably a good way forward for being able to extend the scripts.
Cheers,
Richard
Quoted 28 lines · On Thursday 09 October 2014 18:53:13 Otavio Salvador wrote:
Sometimes we require extra environment settings to be available on the environment for proper SDK work. This were done, in past, using '
_append' tasks however with the split of the environment in a canadian package this has been broken.The easier and more flexible solution is to use environment subscripts which are sources by the main script. These are now looked at:
$OECORE_NATIVE_SYSROOT/environment-setup.d/*.sh
and sourced.
Signed-off-by Otavio Salvador <[email protected]>--- meta/classes/toolchain-scripts.bbclass | 10 ++++++++++ 1 file changed, 10 insertions(+)(quoted diff) +0
-0b/meta/classes/toolchain-scripts.bbclass index 6cc8eba..11ffbe5 100644
meta/classes/toolchain-scripts.bbclass +3
-0@@ -72,6 +72,16 @@ toolchain_shared_env_script () { echo 'export OECORE_SDK_VERSION="${SDK_VERSION}"' >> $script echo 'export ARCH=${ARCH}' >> $script echo 'export CROSS_COMPILE=${TARGET_PREFIX}' >> $script + + cat >> $script <<EOF +
meta/classes/toolchain-scripts.bbclass toolchain_shared_env_script () { · line 87
Quoted 10 lines
meta/classes/toolchain-scripts.bbclass +7
-0+# Append environment subscripts +if [ -d "\$OECORE_NATIVE_SYSROOT/environment-setup.d" ]; then + for envfile in \$OECORE_NATIVE_SYSROOT/environment-setup.d/*.sh; do + source \$envfile + done +fi +EOF } #we get the cached site config in the runtime
This series looks great to me, and adds a much better extension mechanism than we've had here previously.
Signature · 2 lines
Paul Eggleton Intel Open Source Technology Centre