[oe] [RFC][PATCH] meta-toolchain: make SDK relocatable by using $SDK_PATH var in env setup script

Denys Dmytriyenko denis at denix.org
Thu Feb 4 17:22:34 UTC 2010


On Thu, Feb 04, 2010 at 11:57:51AM -0500, Chris Conroy wrote:
> On Wed, 2010-02-03 at 20:43 -0500, Denys Dmytriyenko wrote:
> > Do not hard-code SDK location into all the libtool's .la files and other
> > libtool, pkg-config and opkg service variables and aliases. Use $SDK_PATH
> > environment variable instead, which is set once in the main environment-setup
> > script, allowing easy SDK relocation by adjusting a single variable.
> > 
> > Signed-off-by: Denys Dmytriyenko <denis at denix.org>
> > ---
> >  recipes/meta/meta-toolchain.bb |   25 ++++++++++++++-----------
> >  1 files changed, 14 insertions(+), 11 deletions(-)
> > 
> > diff --git a/recipes/meta/meta-toolchain.bb b/recipes/meta/meta-toolchain.bb
> > index a8c27ec..2855fde 100644
> > --- a/recipes/meta/meta-toolchain.bb
> > +++ b/recipes/meta/meta-toolchain.bb
> > @@ -119,10 +119,10 @@ do_populate_sdk() {
> >  
> >  	# Fix or remove broken .la files
> >  	for i in `find ${SDK_OUTPUT}/${SDKPATH}/${TARGET_SYS} -name \*.la`; do
> > -		sed -i 	-e "/^dependency_libs=/s,\([[:space:]']\)${base_libdir},\1${SDKPATH}/${TARGET_SYS}${base_libdir},g" \
> > -			-e "/^dependency_libs=/s,\([[:space:]']\)${libdir},\1${SDKPATH}/${TARGET_SYS}${libdir},g" \
> > -			-e "/^dependency_libs=/s,\-\([LR]\)${base_libdir},-\1${SDKPATH}/${TARGET_SYS}${base_libdir},g" \
> > -			-e "/^dependency_libs=/s,\-\([LR]\)${libdir},-\1${SDKPATH}/${TARGET_SYS}${libdir},g" \
> > +		sed -i 	-e "/^dependency_libs=/s,\([[:space:]']\)${base_libdir},\1\$SDK_PATH/\$TARGET_SYS${base_libdir},g" \
> > +			-e "/^dependency_libs=/s,\([[:space:]']\)${libdir},\1\$SDK_PATH/\$TARGET_SYS${libdir},g" \
> > +			-e "/^dependency_libs=/s,\-\([LR]\)${base_libdir},-\1\$SDK_PATH/\$TARGET_SYS${base_libdir},g" \
> > +			-e "/^dependency_libs=/s,\-\([LR]\)${libdir},-\1\$SDK_PATH/\$TARGET_SYS${libdir},g" \
> >  			-e 's/^installed=yes$/installed=no/' $i
> >  	done
> >  	rm -f ${SDK_OUTPUT}/${SDKPATH}/lib/*.la
> > @@ -137,13 +137,16 @@ do_populate_sdk() {
> >  	# Create environment setup script
> >  	script=${SDK_OUTPUT}/${SDKPATH}/environment-setup
> >  	touch $script
> > -	echo 'export PATH=${SDKPATH}/bin:$PATH' >> $script
> > -	echo 'export LIBTOOL_SYSROOT_PATH=${prefix}/${TARGET_SYS}' >> $script
> > -	echo 'export PKG_CONFIG_SYSROOT_DIR=${SDKPATH}/${TARGET_SYS}' >> $script
> > -	echo 'export PKG_CONFIG_PATH=${SDKPATH}/${TARGET_SYS}${libdir}/pkgconfig' >> $script
> > -	echo 'export CONFIG_SITE=${SDKPATH}/site-config' >> $script
> > -	echo "alias opkg='LD_LIBRARY_PATH=${SDKPATH}/lib ${SDKPATH}/bin/opkg-cl -f ${SDKPATH}/${sysconfdir}/opkg-sdk.conf -o ${SDKPATH}'" >> $script
> > -	echo "alias opkg-target='LD_LIBRARY_PATH=${SDKPATH}/lib ${SDKPATH}/bin/opkg-cl -f ${SDKPATH}/${TARGET_SYS}${sysconfdir}/opkg.conf -o ${SDKPATH}/${TARGET_SYS}'" >> $script
> > +	echo 'export SDK_PATH=${SDKPATH}' >> $script
> > +	echo 'export TARGET_SYS=${TARGET_SYS}' >> $script
> > +	echo 'export PATH=$SDK_PATH/bin:$PATH' >> $script
> > +	echo 'export CPATH=$SDK_PATH/$TARGET_SYS/usr/include:$CPATH' >> $script
> > +	echo 'export LIBTOOL_SYSROOT_PATH=$SDK_PATH/$TARGET_SYS' >> $script
> > +	echo 'export PKG_CONFIG_SYSROOT_DIR=$SDK_PATH/$TARGET_SYS' >> $script
> > +	echo 'export PKG_CONFIG_PATH=$SDK_PATH/$TARGET_SYS${libdir}/pkgconfig' >> $script
> > +	echo 'export CONFIG_SITE=$SDK_PATH/site-config' >> $script
> > +	echo "alias opkg='LD_LIBRARY_PATH=$SDK_PATH/lib $SDK_PATH/bin/opkg-cl -f $SDK_PATH/${sysconfdir}/opkg-sdk.conf -o $SDK_PATH'" >> $script
> > +	echo "alias opkg-target='LD_LIBRARY_PATH=$SDK_PATH/lib $SDK_PATH/bin/opkg-cl -f $SDK_PATH/$TARGET_SYS${sysconfdir}/opkg.conf -o $SDK_PATH/$TARGET_SYS'" >> $script
> >  
> >  	# Add version information
> >  	versionfile=${SDK_OUTPUT}/${SDKPATH}/version
> 
> The fact that both SDK_PATH and SDKPATH exist and apparently mean
> different things seems very wrong to me. IMHO one should be removed or

First of all, they are the same. Check conf/bitbake.conf:

SDKPATH = "${SDK_PATH}"

Second, ask RP why he introduced SDKPATH, when we had SDK_PATH for years (my 
guess - that's what is used in Poky, so makes porting changes easier):

7c2bd627 (Richard Purdie  2009-11-12 11:51:18 +0000 342) SDKPATH = "${SDK_PATH}"

> renamed since having them both will be a source of confusion.
> 
> It should probably be ${SDK_PATH} instead of $SDK_PATH in your changes.

You missed the whole point of the patch. It really should be $SDK_PATH

> Does this really make the SDK relocatable? I thought there were still
> major issues with relocating GCC.

GCC built from OE may still have relocation problems - haven't checked lately.
But it doesn't mean that's the only use case scenario... There is also 
external toolchain option, as well as building SDK without the toolchain.
Both of those cases were tested with the above change for several months now.

-- 
Denys




More information about the Openembedded-devel mailing list