2019-02-27 19:38:58 +01:00
|
|
|
termux_step_patch_package() {
|
2019-08-14 19:29:58 +02:00
|
|
|
[ "$TERMUX_PKG_METAPACKAGE" = "true" ] && return
|
|
|
|
|
2019-02-27 19:38:58 +01:00
|
|
|
cd "$TERMUX_PKG_SRCDIR"
|
2021-09-01 11:05:30 +02:00
|
|
|
# Suffix patch with ".patch32" or ".patch64" to only apply for
|
|
|
|
# these bitnesses
|
|
|
|
local PATCHES=$(find $TERMUX_PKG_BUILDER_DIR -mindepth 1 -maxdepth 1 \
|
2021-09-02 17:43:34 +02:00
|
|
|
-name \*.patch -o -name \*.patch$TERMUX_ARCH_BITS | sort)
|
2019-02-27 19:38:58 +01:00
|
|
|
local DEBUG_PATCHES=""
|
2021-08-21 16:50:05 +02:00
|
|
|
if [ "$TERMUX_DEBUG_BUILD" = "true" ]; then
|
2021-09-02 17:43:34 +02:00
|
|
|
DEBUG_PATCHES=$(find $TERMUX_PKG_BUILDER_DIR -mindepth 1 -maxdepth 1 -name \*.patch.debug | sort)
|
2019-02-27 19:38:58 +01:00
|
|
|
fi
|
2021-09-01 11:05:30 +02:00
|
|
|
local ON_DEVICE_PATCHES=""
|
|
|
|
# .patch.ondevice patches should only be applied when building
|
|
|
|
# on device
|
|
|
|
if [ "$TERMUX_ON_DEVICE_BUILD" = "true" ]; then
|
2021-09-02 17:43:34 +02:00
|
|
|
ON_DEVICE_PATCHES=$(find $TERMUX_PKG_BUILDER_DIR -mindepth 1 -maxdepth 1 -name \*.patch.ondevice | sort)
|
2021-09-01 11:05:30 +02:00
|
|
|
fi
|
2021-08-21 18:08:57 +02:00
|
|
|
shopt -s nullglob
|
2021-09-01 11:05:30 +02:00
|
|
|
for patch in $PATCHES $DEBUG_PATCHES $ON_DEVICE_PATCHES; do
|
2021-08-21 18:08:57 +02:00
|
|
|
echo "Applying patch: $(basename $patch)"
|
|
|
|
test -f "$patch" && sed \
|
|
|
|
-e "s%\@TERMUX_APP_PACKAGE\@%${TERMUX_APP_PACKAGE}%g" \
|
|
|
|
-e "s%\@TERMUX_BASE_DIR\@%${TERMUX_BASE_DIR}%g" \
|
|
|
|
-e "s%\@TERMUX_CACHE_DIR\@%${TERMUX_CACHE_DIR}%g" \
|
|
|
|
-e "s%\@TERMUX_HOME\@%${TERMUX_ANDROID_HOME}%g" \
|
|
|
|
-e "s%\@TERMUX_PREFIX\@%${TERMUX_PREFIX}%g" \
|
|
|
|
"$patch" | patch --silent -p1
|
|
|
|
done
|
|
|
|
shopt -u nullglob
|
2019-02-27 19:38:58 +01:00
|
|
|
}
|