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