termux-packages/scripts/build/termux_step_handle_hostbuild.sh
Henrik Grimler ecd214881a build-package: add new arg -c for "continue build"
As replacement for TERMUX_PKG_QUICK_REBUILD. Running
./build-package.sh -c <package> starts a build for <package>, but does
not extract and patch the source from scratch. Instead it sets up the
build variables and starts from termux_step_make.

When working on a big package that can take hours to build it is
convenient to be able to build until there is an error, then apply
some new patch (manually) to the source, and then continue from where
the build failed.
2021-08-24 21:40:46 +02:00

20 lines
689 B
Bash

termux_step_handle_hostbuild() {
[ "$TERMUX_PKG_METAPACKAGE" = "true" ] && return
[ "$TERMUX_PKG_HOSTBUILD" = "false" ] && return
cd "$TERMUX_PKG_SRCDIR"
for patch in $TERMUX_PKG_BUILDER_DIR/*.patch.beforehostbuild; do
echo "Applying patch: $(basename $patch)"
test -f "$patch" && sed "s%\@TERMUX_PREFIX\@%${TERMUX_PREFIX}%g" "$patch" | patch --silent -p1
done
local TERMUX_HOSTBUILD_MARKER="$TERMUX_PKG_HOSTBUILD_DIR/TERMUX_BUILT_FOR_$TERMUX_PKG_VERSION"
if [ ! -f "$TERMUX_HOSTBUILD_MARKER" ]; then
rm -Rf "$TERMUX_PKG_HOSTBUILD_DIR"
mkdir -p "$TERMUX_PKG_HOSTBUILD_DIR"
cd "$TERMUX_PKG_HOSTBUILD_DIR"
termux_step_host_build
touch "$TERMUX_HOSTBUILD_MARKER"
fi
}