Browse Source

Introduce TERMUX_PKG_API_LEVEL

By setting the TERMUX_PKG_API_LEVEL property to an android api
level packages can build against later API levels than the current
Termux default of 21.
android-5
Fredrik Fornwall 8 years ago
parent
commit
272404e1fe
  1. 18
      build-package.sh

18
build-package.sh

@ -184,7 +184,7 @@ termux_step_setup_variables() {
: "${TERMUX_PREFIX:="/data/data/com.termux/files/usr"}" : "${TERMUX_PREFIX:="/data/data/com.termux/files/usr"}"
: "${TERMUX_ANDROID_HOME:="/data/data/com.termux/files/home"}" : "${TERMUX_ANDROID_HOME:="/data/data/com.termux/files/home"}"
: "${TERMUX_DEBUG:=""}" : "${TERMUX_DEBUG:=""}"
: "${TERMUX_API_LEVEL:="21"}" : "${TERMUX_PKG_API_LEVEL:="21"}"
: "${TERMUX_ANDROID_BUILD_TOOLS_VERSION:="25.0.3"}" : "${TERMUX_ANDROID_BUILD_TOOLS_VERSION:="25.0.3"}"
: "${TERMUX_NDK_VERSION:="15.1"}" : "${TERMUX_NDK_VERSION:="15.1"}"
@ -218,11 +218,6 @@ termux_step_setup_variables() {
TERMUX_DEBDIR="$TERMUX_SCRIPTDIR/debs" TERMUX_DEBDIR="$TERMUX_SCRIPTDIR/debs"
TERMUX_ELF_CLEANER=$TERMUX_COMMON_CACHEDIR/termux-elf-cleaner TERMUX_ELF_CLEANER=$TERMUX_COMMON_CACHEDIR/termux-elf-cleaner
TERMUX_STANDALONE_TOOLCHAIN="$TERMUX_TOPDIR/_lib/${TERMUX_NDK_VERSION}-${TERMUX_ARCH}-${TERMUX_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+="-v6"
export prefix=${TERMUX_PREFIX} export prefix=${TERMUX_PREFIX}
export PREFIX=${TERMUX_PREFIX} export PREFIX=${TERMUX_PREFIX}
@ -448,10 +443,15 @@ termux_step_host_build() {
# Setup a standalone Android NDK toolchain. Not to be overridden by packages. # Setup a standalone Android NDK toolchain. Not to be overridden by packages.
termux_step_setup_toolchain() { termux_step_setup_toolchain() {
TERMUX_STANDALONE_TOOLCHAIN="$TERMUX_TOPDIR/_lib/${TERMUX_NDK_VERSION}-${TERMUX_ARCH}-${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+="-v6"
# We put this after system PATH to avoid picking up toolchain stripped python # We put this after system PATH to avoid picking up toolchain stripped python
export PATH=$PATH:$TERMUX_STANDALONE_TOOLCHAIN/bin export PATH=$PATH:$TERMUX_STANDALONE_TOOLCHAIN/bin
export CFLAGS="" #-Werror=implicit-function-declaration" export CFLAGS=""
export LDFLAGS="-L${TERMUX_PREFIX}/lib" export LDFLAGS="-L${TERMUX_PREFIX}/lib"
if [ "$TERMUX_PKG_CLANG" = "no" ]; then if [ "$TERMUX_PKG_CLANG" = "no" ]; then
@ -532,7 +532,7 @@ termux_step_setup_toolchain() {
fi fi
"$NDK/build/tools/make_standalone_toolchain.py" \ "$NDK/build/tools/make_standalone_toolchain.py" \
--api "$TERMUX_API_LEVEL" \ --api "$TERMUX_PKG_API_LEVEL" \
--arch $_NDK_ARCHNAME \ --arch $_NDK_ARCHNAME \
--install-dir $_TERMUX_TOOLCHAIN_TMPDIR --install-dir $_TERMUX_TOOLCHAIN_TMPDIR
@ -578,7 +578,7 @@ termux_step_setup_toolchain() {
# Also remove <sys/sem.h> as it doesn't work for non-root. # Also remove <sys/sem.h> as it doesn't work for non-root.
rm usr/include/sys/{shm.h,sem.h} rm usr/include/sys/{shm.h,sem.h}
sed -i "s/define __ANDROID_API__ __ANDROID_API_FUTURE__/define __ANDROID_API__ $TERMUX_API_LEVEL/" \ sed -i "s/define __ANDROID_API__ __ANDROID_API_FUTURE__/define __ANDROID_API__ $TERMUX_PKG_API_LEVEL/" \
usr/include/android/api-level.h usr/include/android/api-level.h
local _LIBDIR=usr/lib local _LIBDIR=usr/lib

Loading…
Cancel
Save