3af25bc2a9
This new variable is extremely useful when iterating on creating a large package, as otherwise you have to wipe the source and rebuild each time you make a mistake with the patches or build.sh script. Simply set TERMUX_PKG_QUICK_REBUILD=true in build.sh if a build fails and then the TERMUX_PKG_SRCDIR and TERMUX_PKG_BUILDDIR will not be touched when you rebuild, including that the patches will not be applied again. When you're done iterating, diff for any new patches, save them, and remove this variable before rebuilding from scratch, hopefully for the last time. ;) An example is shown for the giant libllvm package, where other modifications are also excluded if this variable is set.
20 lines
700 B
Bash
20 lines
700 B
Bash
termux_step_patch_package() {
|
|
[ "$TERMUX_PKG_METAPACKAGE" = "true" ] && return
|
|
|
|
cd "$TERMUX_PKG_SRCDIR"
|
|
local DEBUG_PATCHES=""
|
|
if [ "$TERMUX_DEBUG" = "true" ]; then
|
|
DEBUG_PATCHES=$(find $TERMUX_PKG_BUILDER_DIR -mindepth 1 -maxdepth 1 -name \*.patch.debug)
|
|
fi
|
|
if [ "$TERMUX_PKG_QUICK_REBUILD" != "true" ]; then
|
|
# Suffix patch with ".patch32" or ".patch64" to only apply for these bitnesses:
|
|
shopt -s nullglob
|
|
for patch in $TERMUX_PKG_BUILDER_DIR/*.patch{$TERMUX_ARCH_BITS,} $DEBUG_PATCHES; do
|
|
test -f "$patch" && sed "s%\@TERMUX_PREFIX\@%${TERMUX_PREFIX}%g" "$patch" | \
|
|
sed "s%\@TERMUX_HOME\@%${TERMUX_ANDROID_HOME}%g" | \
|
|
patch --silent -p1
|
|
done
|
|
shopt -u nullglob
|
|
fi
|
|
}
|