build-package.sh: add option to move debs to another folder

This commit is contained in:
Henrik Grimler 2018-08-23 22:18:10 +02:00 committed by Fredrik Fornwall
parent 9c85626bce
commit 2e114a4b8d

View File

@ -212,17 +212,18 @@ termux_step_handle_arguments() {
# Handle command-line arguments: # Handle command-line arguments:
_show_usage () { _show_usage () {
echo "Usage: ./build-package.sh [-a ARCH] [-d] [-D] [-f] [-q] [-s] PACKAGE" echo "Usage: ./build-package.sh [-a ARCH] [-d] [-D] [-f] [-q] [-s] [-o DIR] PACKAGE"
echo "Build a package by creating a .deb file in the debs/ folder." echo "Build a package by creating a .deb file in the debs/ folder."
echo " -a The architecture to build for: aarch64(default), arm, i686, x86_64 or all." echo " -a The architecture to build for: aarch64(default), arm, i686, x86_64 or all."
echo " -d Build with debug symbols." echo " -d Build with debug symbols."
echo " -D Build a disabled package in disabled-packages/." echo " -D Build a disabled package in disabled-packages/."
echo " -f Force build even if package has already been built." echo " -f Force build even if package has already been built."
echo " -q Quiet build" echo " -q Quiet build."
echo " -s Skip dependency check." echo " -s Skip dependency check."
echo " -o Specify deb directory. Default: debs/."
exit 1 exit 1
} }
while getopts :a:hdDfqs option; do while getopts :a:hdDfqso: option; do
case "$option" in case "$option" in
a) TERMUX_ARCH="$OPTARG";; a) TERMUX_ARCH="$OPTARG";;
h) _show_usage;; h) _show_usage;;
@ -231,6 +232,7 @@ termux_step_handle_arguments() {
f) TERMUX_FORCE_BUILD=true;; f) TERMUX_FORCE_BUILD=true;;
q) export TERMUX_QUIET_BUILD=true;; q) export TERMUX_QUIET_BUILD=true;;
s) export TERMUX_SKIP_DEPCHECK=true;; s) export TERMUX_SKIP_DEPCHECK=true;;
o) TERMUX_DEBDIR="$(realpath -m $OPTARG)";;
?) termux_error_exit "./build-package.sh: illegal option -$OPTARG";; ?) termux_error_exit "./build-package.sh: illegal option -$OPTARG";;
esac esac
done done
@ -242,7 +244,11 @@ termux_step_handle_arguments() {
# Handle 'all' arch: # Handle 'all' arch:
if [ -n "${TERMUX_ARCH+x}" ] && [ "${TERMUX_ARCH}" = 'all' ]; then if [ -n "${TERMUX_ARCH+x}" ] && [ "${TERMUX_ARCH}" = 'all' ]; then
for arch in 'aarch64' 'arm' 'i686' 'x86_64'; do for arch in 'aarch64' 'arm' 'i686' 'x86_64'; do
./build-package.sh ${TERMUX_FORCE_BUILD+-f} -a $arch "$1" if [ -n "${TERMUX_DEBDIR+x}" ]; then
./build-package.sh ${TERMUX_FORCE_BUILD+-f} -a $arch -o $TERMUX_DEBDIR "$1"
else
./build-package.sh ${TERMUX_FORCE_BUILD+-f} -a $arch "$"
fi
done done
exit exit
fi fi
@ -406,6 +412,7 @@ termux_step_start_build() {
TERMUX_ALL_DEPS=$(./scripts/buildorder.py "$TERMUX_PKG_BUILDER_DIR") TERMUX_ALL_DEPS=$(./scripts/buildorder.py "$TERMUX_PKG_BUILDER_DIR")
for p in $TERMUX_ALL_DEPS; do for p in $TERMUX_ALL_DEPS; do
echo "Building dependency $p if necessary..." echo "Building dependency $p if necessary..."
# Built dependencies are put in the default TERMUX_DEBDIR instead of the specified one
./build-package.sh -a $TERMUX_ARCH -s "$p" ./build-package.sh -a $TERMUX_ARCH -s "$p"
done done
fi fi