[OE-core] [PATCHv2 01/16] staging.bbclass: Make it easier to define which dirs to stage

Peter Kjellerstedt peter.kjellerstedt at axis.com
Thu May 12 08:37:48 UTC 2016


The directories that should be staged in the sysroot are now specified
in the SYSROOT_DIRS variable. Extra directories that should be staged
for native are specified in SYSROOT_DIRS_NATIVE. Finally, directories
that should not be staged are specified in SYSROOT_DIRS_BLACKLIST.

This also removes the sysroot_stage_libdir() function as it is no
longer used (it was just a wrapper for sysroot_stage_dir()).

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt at axis.com>
---
 meta/classes/staging.bbclass | 75 +++++++++++++++++++++++++-------------------
 1 file changed, 42 insertions(+), 33 deletions(-)

diff --git a/meta/classes/staging.bbclass b/meta/classes/staging.bbclass
index bc5dfa8..a0f82be 100644
--- a/meta/classes/staging.bbclass
+++ b/meta/classes/staging.bbclass
@@ -1,3 +1,37 @@
+# These directories will be staged in the sysroot
+SYSROOT_DIRS = " \
+    ${includedir} \
+    ${libdir} \
+    ${base_libdir} \
+    ${nonarch_base_libdir} \
+    ${datadir} \
+"
+
+# These directories are also staged in the sysroot when they contain files that
+# are usable on the build system
+SYSROOT_DIRS_NATIVE = " \
+    ${bindir} \
+    ${sbindir} \
+    ${base_bindir} \
+    ${base_sbindir} \
+    ${libexecdir} \
+    ${sysconfdir} \
+    ${localstatedir} \
+"
+SYSROOT_DIRS_append_class-native = " ${SYSROOT_DIRS_NATIVE}"
+SYSROOT_DIRS_append_class-cross = " ${SYSROOT_DIRS_NATIVE}"
+SYSROOT_DIRS_append_class-crosssdk = " ${SYSROOT_DIRS_NATIVE}"
+
+# These directories will not be staged in the sysroot
+SYSROOT_DIRS_BLACKLIST = " \
+    ${mandir} \
+    ${docdir} \
+    ${infodir} \
+    ${datadir}/locale \
+    ${datadir}/applications \
+    ${datadir}/fonts \
+    ${datadir}/pixmaps \
+"
 
 sysroot_stage_dir() {
 	src="$1"
@@ -14,43 +48,18 @@ sysroot_stage_dir() {
 	)
 }
 
-sysroot_stage_libdir() {
-	src="$1"
-	dest="$2"
-
-	sysroot_stage_dir $src $dest
-}
-
 sysroot_stage_dirs() {
 	from="$1"
 	to="$2"
 
-	sysroot_stage_dir $from${includedir} $to${includedir}
-	if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then
-		sysroot_stage_dir $from${bindir} $to${bindir}
-		sysroot_stage_dir $from${sbindir} $to${sbindir}
-		sysroot_stage_dir $from${base_bindir} $to${base_bindir}
-		sysroot_stage_dir $from${base_sbindir} $to${base_sbindir}
-		sysroot_stage_dir $from${libexecdir} $to${libexecdir}
-		sysroot_stage_dir $from${sysconfdir} $to${sysconfdir}
-		sysroot_stage_dir $from${localstatedir} $to${localstatedir}
-	fi
-	if [ -d $from${libdir} ]
-	then
-		sysroot_stage_libdir $from${libdir} $to${libdir}
-	fi
-	if [ -d $from${base_libdir} ]
-	then
-		sysroot_stage_libdir $from${base_libdir} $to${base_libdir}
-	fi
-	if [ -d $from${nonarch_base_libdir} ]
-	then
-		sysroot_stage_libdir $from${nonarch_base_libdir} $to${nonarch_base_libdir}
-	fi
-	sysroot_stage_dir $from${datadir} $to${datadir}
-	# We don't care about docs/info/manpages/locales
-	rm -rf $to${mandir}/ $to${docdir}/ $to${infodir}/ ${to}${datadir}/locale/
-	rm -rf $to${datadir}/applications/ $to${datadir}/fonts/ $to${datadir}/pixmaps/
+	for dir in ${SYSROOT_DIRS}; do
+		sysroot_stage_dir "$from$dir" "$to$dir"
+	done
+
+	# Remove directories we do not care about
+	for dir in ${SYSROOT_DIRS_BLACKLIST}; do
+		rm -rf "$to$dir"
+	done
 }
 
 sysroot_stage_all() {
-- 
2.1.0




More information about the Openembedded-core mailing list