termux-packages/build-all.sh
Fredrik Fornwall a005794323 Tweak build script and docker setup
- Output deb files to debs/ folder by default.
- Use $HOME/.termux-build for build folder by default (changed
  from previous $HOME/termux).
- Make scripts/run-docker.sh re-use a single container instead of
  creating new ones for each run.
- Avoid mounting the whole Termux build folder in docker. This
  fixes #294, mmap not supported host folders under OS X.
- Add a scripts/update-docker.sh utility for checking for an
  updated docker image..
- Make build-package.sh support the [-a ARCH] flag to specify arch.
- Make aarch64 the default arch (from previous arm).
- Try to improve the README a bit.
2016-06-03 18:41:30 -04:00

50 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
# build-all.sh - script to build all packages with a build order specified by buildorder.py
set -e -u -o pipefail
# Read settings from .termuxrc if existing
test -f $HOME/.termuxrc && . $HOME/.termuxrc
: ${TERMUX_TOPDIR:="$HOME/.termux-build"}
BUILDSCRIPT=`dirname $0`/build-package.sh
BUILDORDER_FILE=$TERMUX_TOPDIR/_buildall/buildorder.txt
BUILDSTATUS_FILE=$TERMUX_TOPDIR/_buildall/buildstatus.txt
if [ -e $BUILDORDER_FILE ]; then
echo "Using existing buildorder file: $BUILDORDER_FILE"
else
mkdir -p $TERMUX_TOPDIR/_buildall
./scripts/buildorder.py > $BUILDORDER_FILE
fi
if [ -e $BUILDSTATUS_FILE ]; then
echo "Continuing build-all from: $BUILDSTATUS_FILE"
fi
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
for package in `cat $BUILDORDER_FILE`; do
# 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... "
BUILD_START=`date "+%s"`
bash -x $BUILDSCRIPT $package > $TERMUX_TOPDIR/_buildall/${package}.out 2> $TERMUX_TOPDIR/_buildall/${package}.err
BUILD_END=`date "+%s"`
BUILD_SECONDS=$(( $BUILD_END - $BUILD_START ))
echo "done in $BUILD_SECONDS"
# Update build status
echo "$package" >> $BUILDSTATUS_FILE
done
# Update build status
rm -f $BUILDSTATUS_FILE
echo "Finished"