buildsystem: reduce cascaded if-blocks (stamp and virtual)

This commit is contained in:
Sascha Kuehndel (InuSasha) 2017-10-27 18:39:14 +02:00
parent 3cd7be6023
commit 68ea042161
No known key found for this signature in database
GPG Key ID: 15FED89617B88D1B

View File

@ -71,7 +71,10 @@ if [ -f $STAMP ] ; then
fi
fi
if [ ! -f $STAMP ]; then
if [ -f $STAMP ]; then
# already build, do nothing
exit 0
fi
rm -f $STAMP
setup_toolchain $TARGET
@ -212,33 +215,27 @@ if [ ! -f $STAMP ]; then
# build dependencies
case "$TARGET" in
"target")
for p in $PKG_DEPENDS_TARGET; do
$SCRIPTS/build $p
done
;;
"host")
for p in $PKG_DEPENDS_HOST; do
$SCRIPTS/build $p
done
;;
"init")
for p in $PKG_DEPENDS_INIT; do
$SCRIPTS/build $p
done
;;
"bootstrap")
for p in $PKG_DEPENDS_BOOTSTRAP; do
$SCRIPTS/build $p
done
;;
"target") _pkg_depends="$PKG_DEPENDS_TARGET";;
"host") _pkg_depends="$PKG_DEPENDS_HOST";;
"init") _pkg_depends="$PKG_DEPENDS_INIT";;
"bootstrap") _pkg_depends="$PKG_DEPENDS_BOOTSTRAP";;
esac
for p in $_pkg_depends; do
$SCRIPTS/build $p
done
printf "%${BUILD_INDENT}c $(print_color CLR_BUILD "BUILD") $PACKAGE_NAME $(print_color CLR_TARGET "($TARGET)")\n" ' '>&$SILENT_OUT
export BUILD_INDENT=$((${BUILD_INDENT:-1}+$BUILD_INDENT_SIZE))
# virtual packages dont must be build, they only contains dependencies, so dont go further here
if [ ! "$PKG_SECTION" = "virtual" ]; then
if [ "$PKG_SECTION" = "virtual" ]; then
PKG_DEEPMD5=$(find $STAMP_DEPENDS -exec md5sum {} \; 2>/dev/null | sort | md5sum | cut -d" " -f1)
for i in PKG_NAME PKG_DEEPMD5; do
echo "STAMP_$i=\"${!i}\"" >> $STAMP
done
exit 0
fi
# configure other variables
if [ "$TARGET" = "target" ]; then
@ -260,6 +257,7 @@ if [ ! -f $STAMP ]; then
else
PKG_CONFIGURE_SCRIPT="$PKG_BUILD/$PKG_CONFIGURE_SCRIPT"
fi
if [ -z "$PKG_CMAKE_SCRIPT" ]; then
PKG_CMAKE_SCRIPT="$PKG_BUILD/CMakeLists.txt"
fi
@ -291,6 +289,7 @@ if [ ! -f $STAMP ]; then
fi
printf "%${BUILD_INDENT}c $(print_color CLR_TOOLCHAIN "TOOLCHAIN") $PKG_TOOLCHAIN${_auto_toolchain}\n" ' '>&$SILENT_OUT
# make autoreconf
if [ "$PKG_TOOLCHAIN" = "autotools" ]; then
$SCRIPTS/autoreconf $PACKAGE_NAME
fi
@ -549,7 +548,6 @@ if [ ! -f $STAMP ]; then
fi
cd $ROOT
fi # ! "$PKG_SECTION" = "virtual"
for i in `find $SYSROOT_PREFIX/usr/lib/ -name "*.la" 2>/dev/null`; do \
$SED "s:\(['= ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" $i; \
@ -563,4 +561,3 @@ if [ ! -f $STAMP ]; then
if [ "$1" = "u-boot" ]; then
echo "STAMP_UBOOT_SYSTEM=\"${UBOOT_SYSTEM}\"" >> $STAMP
fi
fi