c352216c63
Variables TERMUX_PKG_PLATFORM_INDEPENDENT TERMUX_DEBUG TERMUX_PKG_HAS_DEBUG TERMUX_PKG_ESSENTIAL TERMUX_SUBPKG_ESSENTIAL TERMUX_PKG_NO_STATICSPLIT TERMUX_PKG_BUILD_IN_SRC TERMUX_PKG_FORCE_CMAKE TERMUX_PKG_HOSTBUILD should not accept arbitrary values for marking them "enabled". Instead they should accept boolean values which makes them easier to handle and also makes their meaning clear. build-package.sh should make decision based on variable's value but not on whether it is set or empty. %ci:no-build
31 lines
1.1 KiB
Bash
31 lines
1.1 KiB
Bash
termux_step_handle_buildarch() {
|
|
$TERMUX_ON_DEVICE_BUILD && return
|
|
|
|
# If $TERMUX_PREFIX already exists, it may have been built for a different arch
|
|
local TERMUX_ARCH_FILE=/data/TERMUX_ARCH
|
|
if [ -f "${TERMUX_ARCH_FILE}" ]; then
|
|
local TERMUX_PREVIOUS_ARCH
|
|
TERMUX_PREVIOUS_ARCH=$(cat $TERMUX_ARCH_FILE)
|
|
if [ "$TERMUX_PREVIOUS_ARCH" != "$TERMUX_ARCH" ]; then
|
|
local TERMUX_DATA_BACKUPDIRS=$TERMUX_TOPDIR/_databackups
|
|
mkdir -p "$TERMUX_DATA_BACKUPDIRS"
|
|
local TERMUX_DATA_PREVIOUS_BACKUPDIR=$TERMUX_DATA_BACKUPDIRS/$TERMUX_PREVIOUS_ARCH
|
|
local TERMUX_DATA_CURRENT_BACKUPDIR=$TERMUX_DATA_BACKUPDIRS/$TERMUX_ARCH
|
|
# Save current /data (removing old backup if any)
|
|
if test -e "$TERMUX_DATA_PREVIOUS_BACKUPDIR"; then
|
|
termux_error_exit "Directory already exists"
|
|
fi
|
|
if [ -d /data/data ]; then
|
|
mv /data/data "$TERMUX_DATA_PREVIOUS_BACKUPDIR"
|
|
fi
|
|
# Restore new one (if any)
|
|
if [ -d "$TERMUX_DATA_CURRENT_BACKUPDIR" ]; then
|
|
mv "$TERMUX_DATA_CURRENT_BACKUPDIR" /data/data
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
# Keep track of current arch we are building for.
|
|
echo "$TERMUX_ARCH" > $TERMUX_ARCH_FILE
|
|
}
|