From b9d83f9fb83e42b3fbd2d515412d44111846ef96 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Thu, 19 Sep 2019 21:22:21 +0200 Subject: [PATCH] Define __TERMUX__ and __TERMUX_PREFIX__ By defining __TERMUX__ and __TERMUX_PREFIX__ in (which is basically always included) one can more easily target Termux specifically, both when cross-compiling packages and when code is built on-device. --- ndk-patches/sys-cdefs.h.patch | 7 +++++++ packages/ndk-sysroot/build.sh | 2 +- scripts/build/termux_step_start_build.sh | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ndk-patches/sys-cdefs.h.patch b/ndk-patches/sys-cdefs.h.patch index 66b536dfb..058e8ee18 100644 --- a/ndk-patches/sys-cdefs.h.patch +++ b/ndk-patches/sys-cdefs.h.patch @@ -14,3 +14,10 @@ diff -uNr sysroot.orig/usr/include/sys/cdefs.h sysroot/usr/include/sys/cdefs.h # define __USE_FILE_OFFSET64 1 /* * Note that __RENAME_IF_FILE_OFFSET64 is only valid if the off_t and off64_t +@@ -336,3 +340,6 @@ + + #include + #include ++ ++#define __TERMUX__ 1 ++#define __TERMUX_PREFIX__ "@TERMUX_PREFIX@" diff --git a/packages/ndk-sysroot/build.sh b/packages/ndk-sysroot/build.sh index 9ab4c0567..654d22733 100644 --- a/packages/ndk-sysroot/build.sh +++ b/packages/ndk-sysroot/build.sh @@ -2,7 +2,7 @@ TERMUX_PKG_HOMEPAGE=https://developer.android.com/tools/sdk/ndk/index.html TERMUX_PKG_DESCRIPTION="System header and library files from the Android NDK needed for compiling C programs" TERMUX_PKG_LICENSE="NCSA" TERMUX_PKG_VERSION=$TERMUX_NDK_VERSION -TERMUX_PKG_REVISION=3 +TERMUX_PKG_REVISION=4 TERMUX_PKG_SKIP_SRC_EXTRACT=true # This package has taken over from the previous libutil-dev # and iconv.h from libandroid-support-dev: diff --git a/scripts/build/termux_step_start_build.sh b/scripts/build/termux_step_start_build.sh index 1433d9ef2..5f6266480 100644 --- a/scripts/build/termux_step_start_build.sh +++ b/scripts/build/termux_step_start_build.sh @@ -11,7 +11,7 @@ termux_step_start_build() { TERMUX_STANDALONE_TOOLCHAIN="$TERMUX_COMMON_CACHEDIR/android-r${TERMUX_NDK_VERSION}-api-${TERMUX_PKG_API_LEVEL}" # Bump the below version if a change is made in toolchain setup to ensure # that everyone gets an updated toolchain: - TERMUX_STANDALONE_TOOLCHAIN+="-v1" + TERMUX_STANDALONE_TOOLCHAIN+="-v2" if [ -n "${TERMUX_PKG_BLACKLISTED_ARCHES:=""}" ] && [ "$TERMUX_PKG_BLACKLISTED_ARCHES" != "${TERMUX_PKG_BLACKLISTED_ARCHES/$TERMUX_ARCH/}" ]; then echo "Skipping building $TERMUX_PKG_NAME for arch $TERMUX_ARCH"