Browse Source

Define __TERMUX__ and __TERMUX_PREFIX__

By defining __TERMUX__ and __TERMUX_PREFIX__ in <sys/cdefs.h> (which is
basically always included) one can more easily target Termux
specifically, both when cross-compiling packages and when code is built
on-device.
emacs-27
Fredrik Fornwall 5 years ago
parent
commit
b9d83f9fb8
  1. 7
      ndk-patches/sys-cdefs.h.patch
  2. 2
      packages/ndk-sysroot/build.sh
  3. 2
      scripts/build/termux_step_start_build.sh

7
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 <android/versioning.h>
#include <android/api-level.h>
+
+#define __TERMUX__ 1
+#define __TERMUX_PREFIX__ "@TERMUX_PREFIX@"

2
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 <pty.h> from the previous libutil-dev
# and iconv.h from libandroid-support-dev:

2
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"

Loading…
Cancel
Save