2015-06-13 01:03:31 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# build-all.sh - script to build all packages with a build order specified by buildorder.py
|
|
|
|
|
|
|
|
set -e -u -o pipefail
|
|
|
|
|
2016-06-04 00:41:30 +02:00
|
|
|
# Read settings from .termuxrc if existing
|
|
|
|
test -f $HOME/.termuxrc && . $HOME/.termuxrc
|
|
|
|
: ${TERMUX_TOPDIR:="$HOME/.termux-build"}
|
|
|
|
|
2015-06-13 01:03:31 +02:00
|
|
|
BUILDSCRIPT=`dirname $0`/build-package.sh
|
2016-06-04 00:41:30 +02:00
|
|
|
BUILDORDER_FILE=$TERMUX_TOPDIR/_buildall/buildorder.txt
|
|
|
|
BUILDSTATUS_FILE=$TERMUX_TOPDIR/_buildall/buildstatus.txt
|
2015-06-13 01:03:31 +02:00
|
|
|
|
|
|
|
if [ -e $BUILDORDER_FILE ]; then
|
2015-12-28 12:49:23 +01:00
|
|
|
echo "Using existing buildorder file: $BUILDORDER_FILE"
|
2015-06-13 01:03:31 +02:00
|
|
|
else
|
2016-06-04 00:41:30 +02:00
|
|
|
mkdir -p $TERMUX_TOPDIR/_buildall
|
2016-01-15 04:45:50 +01:00
|
|
|
./scripts/buildorder.py > $BUILDORDER_FILE
|
2015-06-13 01:03:31 +02:00
|
|
|
fi
|
2015-12-28 12:49:23 +01:00
|
|
|
if [ -e $BUILDSTATUS_FILE ]; then
|
|
|
|
echo "Continuing build-all from: $BUILDSTATUS_FILE"
|
|
|
|
fi
|
2015-06-13 01:03:31 +02:00
|
|
|
|
2016-06-04 00:41:30 +02:00
|
|
|
exec > >(tee -a $TERMUX_TOPDIR/_buildall/ALL.out)
|
|
|
|
exec 2> >(tee -a $TERMUX_TOPDIR/_buildall/ALL.err >&2)
|
|
|
|
trap 'echo failure; echo See: $TERMUX_TOPDIR/_buildall/${package}.err' ERR
|
2015-06-13 01:03:31 +02:00
|
|
|
|
|
|
|
for package in `cat $BUILDORDER_FILE`; do
|
2015-12-28 12:49:23 +01:00
|
|
|
# Check build status (grepping is a bit crude, but it works)
|
|
|
|
if [ -e $BUILDSTATUS_FILE ] && \
|
|
|
|
grep "^$package\$" $BUILDSTATUS_FILE >/dev/null; then
|
|
|
|
echo "Skipping $package"
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo -n "Building $package... "
|
2015-06-13 01:03:31 +02:00
|
|
|
BUILD_START=`date "+%s"`
|
2017-01-04 01:04:37 +01:00
|
|
|
bash -x $BUILDSCRIPT -s $package > $TERMUX_TOPDIR/_buildall/${package}.out 2> $TERMUX_TOPDIR/_buildall/${package}.err
|
2015-06-13 01:03:31 +02:00
|
|
|
BUILD_END=`date "+%s"`
|
|
|
|
BUILD_SECONDS=$(( $BUILD_END - $BUILD_START ))
|
|
|
|
echo "done in $BUILD_SECONDS"
|
2015-12-28 12:49:23 +01:00
|
|
|
|
|
|
|
# Update build status
|
|
|
|
echo "$package" >> $BUILDSTATUS_FILE
|
2015-06-13 01:03:31 +02:00
|
|
|
done
|
2015-12-28 12:49:23 +01:00
|
|
|
|
|
|
|
# Update build status
|
|
|
|
rm -f $BUILDSTATUS_FILE
|
|
|
|
echo "Finished"
|