ndk-20 update

This commit is contained in:
its-pointless 2019-06-12 12:09:22 +10:00 committed by Leonid Pliushch
parent ae1f88bad3
commit 5eada22838
5 changed files with 107 additions and 102 deletions

View File

@ -1,10 +1,9 @@
diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/bits/struct_file.h ./usr/include/bits/struct_file.h
--- /home/fornwall/lib/android-ndk/sysroot/usr/include/bits/struct_file.h 2017-06-20 17:41:56.000000000 +0200
+++ ./usr/include/bits/struct_file.h 2017-06-26 13:35:19.040117023 +0200
@@ -33,13 +33,80 @@
--- ./usr/include/bits/struct_file.h.orig 2019-06-10 09:40:35.872857650 +1000
+++ ./usr/include/bits/struct_file.h 2019-06-10 09:55:10.890308649 +1000
@@ -31,14 +31,79 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
+#if defined(__LP64__)
+struct __sbuf {
+ unsigned char* _base;
@ -13,75 +12,74 @@ diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/bits/struct_file.h
+#else
+struct __sbuf {
+ unsigned char *_base;
+ int _size;
+ int _size;
+};
+#endif
+
+#endif
+#if defined(__LP64__)
+typedef int64_t _struct_file_off_t;
+#else
+typedef __kernel_off_t _struct_file_off_t;
+#endif
+
+
/** The opaque structure implementing `FILE`. Do not make any assumptions about its content. */
struct __sFILE {
+ unsigned char *_p; /* current position in (some) buffer */
+ int _r; /* read space left for getc() */
+ int _w; /* write space left for putc() */
+ unsigned char *_p; /* current position in (some) buffer */
+ int _r; /* read space left for getc() */
+ int _w; /* write space left for putc() */
#if defined(__LP64__)
- char __private[152];
+ int _flags; /* flags, below; this FILE is free if 0 */
+ int _file; /* fileno, if Unix descriptor, else -1 */
+ int _flags; /* flags, below; this FILE is free if 0 */
+ int _file; /* fileno, if Unix descriptor, else -1 */
#else
- char __private[84];
+ short _flags; /* flags, below; this FILE is free if 0 */
+ short _file; /* fileno, if Unix descriptor, else -1 */
+ short _flags; /* flags, below; this FILE is free if 0 */
+ short _file; /* fileno, if Unix descriptor, else -1 */
#endif
-} __attribute__((aligned(sizeof(void*))));
+ struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */
+ int _lbfsize; /* 0 or -_bf._size, for inline putc */
+
+ /* operations */
+ void *_cookie; /* cookie passed to io functions */
+ int (*_close)(void *);
+ int (*_read)(void *, char *, int);
+ _struct_file_off_t (*_seek)(void *, _struct_file_off_t, int);
+ int (*_write)(void *, const char *, int);
+
+ struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */
+ int _lbfsize; /* 0 or -_bf._size, for inline putc */
+
+ /* operations */
+ void *_cookie; /* cookie passed to io functions */
+ int (*_close)(void *);
+ int (*_read)(void *, char *, int);
+ _struct_file_off_t (*_seek)(void *, _struct_file_off_t, int);
+ int (*_write)(void *, const char *, int);
+
+ /* extension data, to avoid further ABI breakage */
+ struct __sbuf _ext;
+ struct __sbuf _ext;
+ /* data for long sequences of ungetc() */
+ unsigned char *_up; /* saved _p when _p is doing ungetc data */
+ int _ur; /* saved _r when _r is counting ungetc data */
+
+ unsigned char *_up; /* saved _p when _p is doing ungetc data */
+ int _ur; /* saved _r when _r is counting ungetc data */
+
+ /* tricks to meet minimum requirements even when malloc() fails */
+ unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */
+ unsigned char _nbuf[1]; /* guarantee a getc() buffer */
+
+ unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */
+ unsigned char _nbuf[1]; /* guarantee a getc() buffer */
+
+ /* separate buffer for fgetln() when line crosses buffer boundary */
+ struct __sbuf _lb; /* buffer for fgetln() */
+
+ struct __sbuf _lb; /* buffer for fgetln() */
+
+ /* Unix stdio files get aligned to block boundaries on fseek() */
+ int _blksize; /* stat.st_blksize (may be != _bf._size) */
+ _struct_file_off_t _offset; /* current lseek offset */
+ int _blksize; /* stat.st_blksize (may be != _bf._size) */
+ _struct_file_off_t _offset; /* current lseek offset */
+};
+
+#define __SLBF 0x0001 /* line buffered */
+#define __SNBF 0x0002 /* unbuffered */
+#define __SRD 0x0004 /* OK to read */
+#define __SWR 0x0008 /* OK to write */
+#define __SLBF 0x0001 /* line buffered */
+#define __SNBF 0x0002 /* unbuffered */
+#define __SRD 0x0004 /* OK to read */
+#define __SWR 0x0008 /* OK to write */
+ /* RD and WR are never simultaneously asserted */
+#define __SRW 0x0010 /* open for reading & writing */
+#define __SEOF 0x0020 /* found EOF */
+#define __SERR 0x0040 /* found error */
+#define __SMBF 0x0080 /* _buf is from malloc */
+#define __SAPP 0x0100 /* fdopen()ed in append mode */
+#define __SSTR 0x0200 /* this is an sprintf/snprintf string */
+#define __SOPT 0x0400 /* do fseek() optimization */
+#define __SNPT 0x0800 /* do not do fseek() optimization */
+#define __SOFF 0x1000 /* set iff _offset is in fact correct */
+#define __SMOD 0x2000 /* true => fgetln modified _p text */
+#define __SALC 0x4000 /* allocate string space dynamically */
+#define __SIGN 0x8000 /* ignore this file in _fwalk */
+#define __SRW 0x0010 /* open for reading & writing */
+#define __SEOF 0x0020 /* found EOF */
+#define __SERR 0x0040 /* found error */
+#define __SMBF 0x0080 /* _buf is from malloc */
+#define __SAPP 0x0100 /* fdopen()ed in append mode */
+#define __SSTR 0x0200 /* this is an sprintf/snprintf string */
+#define __SOPT 0x0400 /* do fseek() optimization */
+#define __SNPT 0x0800 /* do not do fseek() optimization */
+#define __SOFF 0x1000 /* set iff _offset is in fact correct */
+#define __SMOD 0x2000 /* true => fgetln modified _p text */
+#define __SALC 0x4000 /* allocate string space dynamically */
+#define __SIGN 0x8000 /* ignore this file in _fwalk */
__END_DECLS

View File

@ -1,27 +1,31 @@
diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/paths.h ./usr/include/paths.h
--- /home/fornwall/lib/android-ndk/sysroot/usr/include/paths.h 2017-11-09 09:57:12.000000000 +0100
+++ ./usr/include/paths.h 2017-11-15 11:51:24.456129565 +0100
@@ -34,15 +34,19 @@
--- ./usr/include/paths.h.orig 2019-06-10 00:10:55.544212642 +0000
+++ ./usr/include/paths.h 2019-06-10 00:16:51.514412646 +0000
@@ -38,16 +38,14 @@
#include <sys/cdefs.h>
-#ifndef _PATH_BSHELL
-#define _PATH_BSHELL "/system/bin/sh"
/** Path to the default system shell. Historically the 'B' was to specify the Bourne shell. */
-#define _PATH_BSHELL "/system/bin/sh"
-#endif
+#define _PATH_BSHELL "@TERMUX_PREFIX@/bin/sh"
#define _PATH_CONSOLE "/dev/console"
-#define _PATH_DEFPATH "/sbin:/system/sbin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin"
+#define _PATH_DEFPATH "@TERMUX_PREFIX@/bin:@TERMUX_PREFIX@/bin/applets"
#define _PATH_DEV "/dev/"
#define _PATH_DEVNULL "/dev/null"
#define _PATH_KLOG "/proc/kmsg"
#define _PATH_MOUNTED "/proc/mounts"
#define _PATH_TTY "/dev/tty"
+#define _PATH_BSHELL "@TERMUX_PREFIX@/bin/sh"
+#define _PATH_STDPATH _PATH_DEFPATH
+#define _PATH_TMP "@TERMUX_PREFIX@/tmp/"
+#define _PATH_VARDB "@TERMUX_PREFIX@/var/db/"
+#define _PATH_VARRUN "@TERMUX_PREFIX@/var/run/"
+#define _PATH_VARTMP "@TERMUX_PREFIX@/var/tmp/"
/** Path to the system console. */
#define _PATH_CONSOLE "/dev/console"
/** Default shell search path. */
-#define _PATH_DEFPATH "/sbin:/system/sbin:/product/bin:/apex/com.android.runtime/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin"
+#define _PATH_DEFPATH "@TERMUX_PREFIX@/bin:@TERMUX_PREFIX@/bin/applets"
/** Path to the directory containing device files. */
#define _PATH_DEV "/dev/"
@@ -63,3 +61,9 @@
/** Path to the calling process' tty. */
#define _PATH_TTY "/dev/tty"
+#define _PATH_STDPATH _PATH_DEFPATH
+#define _PATH_TMP "@TERMUX_PREFIX@/tmp/"
+#define _PATH_VARDB "@TERMUX_PREFIX@/var/db/"
+#define _PATH_VARRUN "@TERMUX_PREFIX@/var/run/"
+#define _PATH_VARTMP "@TERMUX_PREFIX@/var/tmp/"
+
#endif /* !_PATHS_H_ */

View File

@ -80,48 +80,51 @@ termux_step_setup_toolchain() {
elif [ "$TERMUX_ARCH" = "i686" ]; then
_NDK_ARCHNAME=x86
fi
"$NDK/build/tools/make_standalone_toolchain.py" \
--api "$TERMUX_PKG_API_LEVEL" \
--arch $_NDK_ARCHNAME \
--stl=libc++ \
--install-dir $_TERMUX_TOOLCHAIN_TMPDIR
cp $NDK/toolchains/llvm/prebuilt/linux-x86_64 $_TERMUX_TOOLCHAIN_TMPDIR -r
# Remove android-support header wrapping not needed on android-21:
rm -Rf $_TERMUX_TOOLCHAIN_TMPDIR/sysroot/usr/local
if [ "$TERMUX_ARCH" = "aarch64" ]; then
# Use gold by default to work around https://github.com/android-ndk/ndk/issues/148
cp $_TERMUX_TOOLCHAIN_TMPDIR/bin/aarch64-linux-android-ld.gold \
$_TERMUX_TOOLCHAIN_TMPDIR/bin/aarch64-linux-android-ld
cp $_TERMUX_TOOLCHAIN_TMPDIR/aarch64-linux-android/bin/ld.gold \
$_TERMUX_TOOLCHAIN_TMPDIR/aarch64-linux-android/bin/ld
fi
# Use gold by default to work around https://github.com/android-ndk/ndk/issues/148
cp $_TERMUX_TOOLCHAIN_TMPDIR/bin/aarch64-linux-android-ld.gold \
$_TERMUX_TOOLCHAIN_TMPDIR/bin/aarch64-linux-android-ld
cp $_TERMUX_TOOLCHAIN_TMPDIR/aarch64-linux-android/bin/ld.gold \
$_TERMUX_TOOLCHAIN_TMPDIR/aarch64-linux-android/bin/ld
if [ "$TERMUX_ARCH" = "arm" ]; then
# Linker wrapper script to add '--exclude-libs libgcc.a', see
# https://github.com/android-ndk/ndk/issues/379
# https://android-review.googlesource.com/#/c/389852/
local linker
for linker in ld ld.bfd ld.gold; do
local wrap_linker=$_TERMUX_TOOLCHAIN_TMPDIR/$TERMUX_HOST_PLATFORM/bin/$linker
local real_linker=$_TERMUX_TOOLCHAIN_TMPDIR/$TERMUX_HOST_PLATFORM/bin/$linker.real
local wrap_linker=$_TERMUX_TOOLCHAIN_TMPDIR/arm-linux-androideabi/bin/$linker
local real_linker=$_TERMUX_TOOLCHAIN_TMPDIR/arm-linux-androideabi/bin/$linker.real
cp $wrap_linker $real_linker
echo '#!/bin/bash' > $wrap_linker
echo -n '$(dirname $0)/' >> $wrap_linker
echo -n $linker.real >> $wrap_linker
echo ' --exclude-libs libunwind.a --exclude-libs libgcc_real.a "$@"' >> $wrap_linker
done
fi
for HOST_PLAT in aarch64-linux-android armv7a-linux-androideabi i686-linux-android x86_64-linux-android; do
# Setup the cpp preprocessor:
cp $_TERMUX_TOOLCHAIN_TMPDIR/bin/$TERMUX_HOST_PLATFORM-clang \
$_TERMUX_TOOLCHAIN_TMPDIR/bin/$TERMUX_HOST_PLATFORM-cpp
sed -i 's/clang80/clang80 -E/' \
$_TERMUX_TOOLCHAIN_TMPDIR/bin/$TERMUX_HOST_PLATFORM-cpp
cp $_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT$TERMUX_PKG_API_LEVEL-clang \
$_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT-clang
cp $_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT$TERMUX_PKG_API_LEVEL-clang++ \
$_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT-clang++
cp $_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT$TERMUX_PKG_API_LEVEL-clang \
$_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT-cpp
sed -i 's/clang/clang -E/' \
$_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT-cpp
cp $_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT-clang \
$_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT-gcc
cp $_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT-clang++ \
$_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT-gcc
done
cp $_TERMUX_TOOLCHAIN_TMPDIR/bin/armv7a-linux-androideabi$TERMUX_PKG_API_LEVEL-clang \
$_TERMUX_TOOLCHAIN_TMPDIR/bin/arm-linux-androideabi-clang
cp $_TERMUX_TOOLCHAIN_TMPDIR/bin/armv7a-linux-androideabi$TERMUX_PKG_API_LEVEL-clang++ \
$_TERMUX_TOOLCHAIN_TMPDIR/bin/arm-linux-androideabi-clang++
cd $_TERMUX_TOOLCHAIN_TMPDIR/sysroot
for f in $TERMUX_SCRIPTDIR/ndk-patches/*.patch; do
sed "s%\@TERMUX_PREFIX\@%${TERMUX_PREFIX}%g" "$f" | \
sed "s%\@TERMUX_HOME\@%${TERMUX_ANDROID_HOME}%g" | \

View File

@ -2,10 +2,10 @@ termux_step_start_build() {
# shellcheck source=/dev/null
source "$TERMUX_PKG_BUILDER_SCRIPT"
TERMUX_STANDALONE_TOOLCHAIN="$TERMUX_COMMON_CACHEDIR/${TERMUX_NDK_VERSION}-${TERMUX_ARCH}-${TERMUX_PKG_API_LEVEL}"
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+="-v5"
TERMUX_STANDALONE_TOOLCHAIN+="-v1"
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"

View File

@ -1,6 +1,6 @@
TERMUX_ANDROID_BUILD_TOOLS_VERSION=28.0.3
TERMUX_NDK_VERSION_NUM=19
TERMUX_NDK_REVISION=b
TERMUX_NDK_VERSION_NUM=20
TERMUX_NDK_REVISION=""
TERMUX_NDK_VERSION=$TERMUX_NDK_VERSION_NUM$TERMUX_NDK_REVISION
test -f "$HOME/.termuxrc" && . "$HOME/.termuxrc"