[oe-commits] Richard Purdie : autotools.bbclass: Separate out useful staging functions into base. bbclass and call from autotools classes (from Poky)

git version control git at git.openembedded.org
Mon Nov 2 20:45:17 UTC 2009


Module: openembedded.git
Branch: rpurdie/work-in-progress
Commit: b8837168dedbfabd1f8bc6eb24970d963c3fb7c4
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=b8837168dedbfabd1f8bc6eb24970d963c3fb7c4

Author: Richard Purdie <rpurdie at linux.intel.com>
Date:   Mon Nov  2 17:23:05 2009 +0000

autotools.bbclass: Separate out useful staging functions into base.bbclass and call from autotools classes (from Poky)

Signed-off-by: Richard Purdie <rpurdie at linux.intel.com>

---

 classes/autotools.bbclass |   61 ++++--------------------------------------
 classes/base.bbclass      |   64 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+), 55 deletions(-)

diff --git a/classes/autotools.bbclass b/classes/autotools.bbclass
index e939883..17d5317 100644
--- a/classes/autotools.bbclass
+++ b/classes/autotools.bbclass
@@ -173,14 +173,11 @@ autotools_stage_includes() {
 }
 
 autotools_stage_dir() {
-	from="$1"
-	to="$2"
-	# This will remove empty directories so we can ignore them
-	rmdir "$from" 2> /dev/null || true
-	if [ -d "$from" ]; then
-		mkdir -p "$to"
-		cp -fpPR "$from"/* "$to"
-	fi
+ 	sysroot_stage_libdir $1 ${STAGE_TEMP_PREFIX}$2
+}
+
+autotools_stage_libdir() {
+	sysroot_stage_libdir $1 ${STAGE_TEMP_PREFIX}$2
 }
 
 autotools_stage_all() {
@@ -191,55 +188,9 @@ autotools_stage_all() {
 	rm -rf ${STAGE_TEMP}
 	mkdir -p ${STAGE_TEMP}
 	oe_runmake DESTDIR="${STAGE_TEMP}" install
-	autotools_stage_dir ${STAGE_TEMP}/${includedir} ${STAGING_INCDIR}
-	if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then
-		autotools_stage_dir ${STAGE_TEMP}/${bindir} ${STAGING_DIR_HOST}${bindir}
-		autotools_stage_dir ${STAGE_TEMP}/${sbindir} ${STAGING_DIR_HOST}${sbindir}
-		autotools_stage_dir ${STAGE_TEMP}/${base_bindir} ${STAGING_DIR_HOST}${base_bindir}
-		autotools_stage_dir ${STAGE_TEMP}/${base_sbindir} ${STAGING_DIR_HOST}${base_sbindir}
-		autotools_stage_dir ${STAGE_TEMP}/${libexecdir} ${STAGING_DIR_HOST}${libexecdir}
-		if [ "${prefix}/lib" != "${libdir}" ]; then
-			# python puts its files in here, make sure they are staged as well
-			autotools_stage_dir ${STAGE_TEMP}/${prefix}/lib ${STAGING_DIR_HOST}${prefix}/lib
-		fi
-	fi
-	if [ -d ${STAGE_TEMP}/${libdir} ]
-	then
-		olddir=`pwd`
-		cd ${STAGE_TEMP}/${libdir}
-		las=$(find . -name \*.la -type f)
-		cd $olddir
-		echo "Found la files: $las"		 
-		for i in $las
-		do
-			sed -e 's/^installed=yes$/installed=no/' \
-			    -e '/^dependency_libs=/s,${WORKDIR}[[:alnum:]/\._+-]*/\([[:alnum:]\._+-]*.la\),${STAGING_LIBDIR}/\1,g' \
-			    -e '/^dependency_libs=/s,${WORKDIR}[[:alnum:]/\._+-]*/\([[:alnum:]\._+-]*\),${STAGING_LIBDIR},g' \
-			    -e "/^dependency_libs=/s,\([[:space:]']\)${libdir},\1${STAGING_LIBDIR},g" \
-			    -i ${STAGE_TEMP}/${libdir}/$i
-		done
-		autotools_stage_dir ${STAGE_TEMP}/${libdir} ${STAGING_LIBDIR}
-	fi
-	# Ok, this is nasty. pkgconfig.bbclass is usually used to install .pc files,
-	# however some packages rely on the presence of .pc files to enable/disable
-	# their configurataions in which case we better should not install everything
-	# unconditionally, but rather depend on the actual results of make install.
-	# The good news though: a) there are not many packages doing this and
-	# b) packaged staging will fix that anyways. :M:
-	if [ "${AUTOTOOLS_STAGE_PKGCONFIG}" = "1" ]
-	then
-		if [ -e ${STAGE_TEMP}/${libdir}/pkgconfig/ ] ; then
-			echo "cp -f ${STAGE_TEMP}/${libdir}/pkgconfig/*.pc ${STAGING_LIBDIR}/pkgconfig/"
-			cp -f ${STAGE_TEMP}/${libdir}/pkgconfig/*.pc ${STAGING_LIBDIR}/pkgconfig/
-		fi
-		if [ -e ${STAGE_TEMP}/${datadir}/pkgconfig/ ] ; then
-			echo "cp -f ${STAGE_TEMP}/${datadir}/pkgconfig/*.pc ${STAGING_DATADIR}/pkgconfig/"
-			cp -f ${STAGE_TEMP}/${datadir}/pkgconfig/*.pc ${STAGING_DATADIR}/pkgconfig/
-		fi
-	fi
 	rm -rf ${STAGE_TEMP}/${mandir} || true
 	rm -rf ${STAGE_TEMP}/${infodir} || true
-	autotools_stage_dir ${STAGE_TEMP}/${datadir} ${STAGING_DATADIR}
+	sysroot_stage_dirs ${STAGE_TEMP} ${STAGE_TEMP_PREFIX}
 	rm -rf ${STAGE_TEMP}
 }
 
diff --git a/classes/base.bbclass b/classes/base.bbclass
index a3bfec8..aca19ee 100644
--- a/classes/base.bbclass
+++ b/classes/base.bbclass
@@ -999,6 +999,70 @@ base_do_compile() {
 	fi
 }
 
+
+sysroot_stage_dir() {
+	src="$1"
+	dest="$2"
+	# This will remove empty directories so we can ignore them
+	rmdir "$src" 2> /dev/null || true
+	if [ -d "$src" ]; then
+		mkdir -p "$dest"
+		cp -fpPR "$src"/* "$dest"
+	fi
+}
+
+sysroot_stage_libdir() {
+	src="$1"
+	dest="$2"
+
+	olddir=`pwd`
+	cd $src
+	las=$(find . -name \*.la -type f)
+	cd $olddir
+	echo "Found la files: $las"		 
+	for i in $las
+	do
+		sed -e 's/^installed=yes$/installed=no/' \
+		    -e '/^dependency_libs=/s,${WORKDIR}[[:alnum:]/\._+-]*/\([[:alnum:]\._+-]*\),${STAGING_LIBDIR}/\1,g' \
+		    -e "/^dependency_libs=/s,\([[:space:]']\)${libdir},\1${STAGING_LIBDIR},g" \
+		    -i $src/$i
+	done
+	autotools_stage_dir $dest $src
+}
+
+sysroot_stage_dirs() {
+	from="$1"
+	to="$2"
+
+	sysroot_stage_dir $from${includedir} $to${STAGING_INCDIR}
+	if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then
+		sysroot_stage_dir $from${bindir} $to${STAGING_DIR_HOST}${bindir}
+		sysroot_stage_dir $from${sbindir} $to${STAGING_DIR_HOST}${sbindir}
+		sysroot_stage_dir $from${base_bindir} $to${STAGING_DIR_HOST}${base_bindir}
+		sysroot_stage_dir $from${base_sbindir} $to${STAGING_DIR_HOST}${base_sbindir}
+		sysroot_stage_dir $from${libexecdir} $to${STAGING_DIR_HOST}${libexecdir}
+		if [ "${prefix}/lib" != "${libdir}" ]; then
+			# python puts its files in here, make sure they are staged as well
+			autotools_stage_dir $from/${prefix}/lib $to${STAGING_DIR_HOST}${prefix}/lib
+		fi
+	fi
+	if [ -d $from${libdir} ]
+	then
+		sysroot_stage_libdir $from/${libdir} $to${STAGING_LIBDIR}
+	fi
+	if [ -d $from${base_libdir} ]
+	then
+		sysroot_stage_libdir $from${base_libdir} $to${STAGING_DIR_HOST}${base_libdir}
+	fi
+	sysroot_stage_dir $from${datadir} $to${STAGING_DATADIR}
+}
+
+
+sysroot_stage_all() {
+	sysroot_stage_dirs ${D} ${SYSROOT_DESTDIR}
+}
+
+
 base_do_stage () {
 	:
 }





More information about the Openembedded-commits mailing list