Commit | Line | Data |
---|---|---|
59f0d218 FF |
1 | #!/bin/bash |
2 | # build-all.sh - script to build all packages with a build order specified by buildorder.py | |
3 | ||
4 | set -e -u -o pipefail | |
5 | ||
a0057943 FF |
6 | # Read settings from .termuxrc if existing |
7 | test -f $HOME/.termuxrc && . $HOME/.termuxrc | |
8 | : ${TERMUX_TOPDIR:="$HOME/.termux-build"} | |
9 | ||
59f0d218 | 10 | BUILDSCRIPT=`dirname $0`/build-package.sh |
a0057943 FF |
11 | BUILDORDER_FILE=$TERMUX_TOPDIR/_buildall/buildorder.txt |
12 | BUILDSTATUS_FILE=$TERMUX_TOPDIR/_buildall/buildstatus.txt | |
59f0d218 FF |
13 | |
14 | if [ -e $BUILDORDER_FILE ]; then | |
12622a95 | 15 | echo "Using existing buildorder file: $BUILDORDER_FILE" |
59f0d218 | 16 | else |
a0057943 | 17 | mkdir -p $TERMUX_TOPDIR/_buildall |
658bba67 | 18 | ./scripts/buildorder.py > $BUILDORDER_FILE |
59f0d218 | 19 | fi |
12622a95 GS |
20 | if [ -e $BUILDSTATUS_FILE ]; then |
21 | echo "Continuing build-all from: $BUILDSTATUS_FILE" | |
22 | fi | |
59f0d218 | 23 | |
a0057943 FF |
24 | exec > >(tee -a $TERMUX_TOPDIR/_buildall/ALL.out) |
25 | exec 2> >(tee -a $TERMUX_TOPDIR/_buildall/ALL.err >&2) | |
26 | trap 'echo failure; echo See: $TERMUX_TOPDIR/_buildall/${package}.err' ERR | |
59f0d218 FF |
27 | |
28 | for package in `cat $BUILDORDER_FILE`; do | |
12622a95 GS |
29 | # Check build status (grepping is a bit crude, but it works) |
30 | if [ -e $BUILDSTATUS_FILE ] && \ | |
31 | grep "^$package\$" $BUILDSTATUS_FILE >/dev/null; then | |
32 | echo "Skipping $package" | |
33 | continue | |
34 | fi | |
35 | ||
36 | echo -n "Building $package... " | |
59f0d218 | 37 | BUILD_START=`date "+%s"` |
fc89df4d | 38 | bash -x $BUILDSCRIPT -s $package > $TERMUX_TOPDIR/_buildall/${package}.out 2> $TERMUX_TOPDIR/_buildall/${package}.err |
59f0d218 FF |
39 | BUILD_END=`date "+%s"` |
40 | BUILD_SECONDS=$(( $BUILD_END - $BUILD_START )) | |
41 | echo "done in $BUILD_SECONDS" | |
12622a95 GS |
42 | |
43 | # Update build status | |
44 | echo "$package" >> $BUILDSTATUS_FILE | |
59f0d218 | 45 | done |
12622a95 GS |
46 | |
47 | # Update build status | |
48 | rm -f $BUILDSTATUS_FILE | |
49 | echo "Finished" |