From 88cc36098422aa37954858c7bbd5de7cac8f2d7f Mon Sep 17 00:00:00 2001 From: Leonid Plyushch Date: Sat, 10 Aug 2019 01:11:26 +0300 Subject: [PATCH] build-package.sh: for on-device builds value of TERMUX_ARCH should not be overridable This should be allowed only when cross-compiling. --- build-package.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/build-package.sh b/build-package.sh index 69ac034bb..b948098fc 100755 --- a/build-package.sh +++ b/build-package.sh @@ -12,8 +12,6 @@ if [ "$(uname -o)" = "Android" ] || [ -e "/system/bin/app_process" ]; then exit 1 fi - export TERMUX_ARCH=$(dpkg --print-architecture) - # This variable tells all parts of build system that build # is performed on device. export TERMUX_ON_DEVICE_BUILD=true @@ -170,6 +168,12 @@ export TERMUX_SCRIPTDIR # shellcheck source=scripts/properties.sh . "$TERMUX_SCRIPTDIR/scripts/properties.sh" +if [ -n "$TERMUX_ON_DEVICE_BUILD" ]; then + # For on device builds cross compiling is not supported. + # Target architecture must be same as for environment used currently. + export TERMUX_ARCH=$(dpkg --print-architecture) +fi + _show_usage() { echo "Usage: ./build-package.sh [options] PACKAGE_1 PACKAGE_2 ..." echo