staging.bbclass: Make it easier to define which dirs to stage

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()).

(From OE-Core rev: 80e7e7f78d957b8159bede2a5cd5614d8d73039c)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Peter Kjellerstedt
2016-05-12 10:37:48 +02:00
committed by Richard Purdie
parent 5f6e5e45d5
commit e839431468

View File

@@ -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() {