Browse Source

Update NDK used to r16

Run scripts/update-docker.sh to update the docker image.
android-5
Fredrik Fornwall 7 years ago
parent
commit
392b4b6ba5
  1. 12
      build-package.sh
  2. 111
      ndk-patches/arpa-ftp.patch
  3. 88
      ndk-patches/arpa-tftp.patch
  4. 17
      ndk-patches/fcntl.h.patch
  5. 12
      ndk-patches/grp.h.patch
  6. 6
      ndk-patches/langinfo.h.patch
  7. 12
      ndk-patches/limits.h.patch
  8. 10
      ndk-patches/linux-fcntl.h.patch
  9. 8
      ndk-patches/paths.h.patch
  10. 23
      ndk-patches/pty.h.patch
  11. 20
      ndk-patches/spawn.h.patch
  12. 44
      ndk-patches/stdio.h.patch
  13. 19
      ndk-patches/stdlib.h.patch
  14. 35
      ndk-patches/string.h.patch
  15. 14
      ndk-patches/sys-ttydefault.h.patch
  16. 13
      ndk-patches/utmp.h.patch
  17. 2
      packages/aapt/build.sh
  18. 4
      packages/ecj/build.sh
  19. 4
      scripts/setup-android-sdk.sh

12
build-package.sh

@ -254,8 +254,8 @@ termux_step_setup_variables() {
: "${TERMUX_ANDROID_HOME:="/data/data/com.termux/files/home"}" : "${TERMUX_ANDROID_HOME:="/data/data/com.termux/files/home"}"
: "${TERMUX_DEBUG:=""}" : "${TERMUX_DEBUG:=""}"
: "${TERMUX_PKG_API_LEVEL:="21"}" : "${TERMUX_PKG_API_LEVEL:="21"}"
: "${TERMUX_ANDROID_BUILD_TOOLS_VERSION:="26.0.1"}" : "${TERMUX_ANDROID_BUILD_TOOLS_VERSION:="27.0.1"}"
: "${TERMUX_NDK_VERSION:="15.2"}" : "${TERMUX_NDK_VERSION:="16"}"
if [ "x86_64" = "$TERMUX_ARCH" ] || [ "aarch64" = "$TERMUX_ARCH" ]; then if [ "x86_64" = "$TERMUX_ARCH" ] || [ "aarch64" = "$TERMUX_ARCH" ]; then
TERMUX_ARCH_BITS=64 TERMUX_ARCH_BITS=64
@ -364,7 +364,7 @@ termux_step_start_build() {
TERMUX_STANDALONE_TOOLCHAIN="$TERMUX_TOPDIR/_lib/${TERMUX_NDK_VERSION}-${TERMUX_ARCH}-${TERMUX_PKG_API_LEVEL}" 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 # Bump the below version if a change is made in toolchain setup to ensure
# that everyone gets an updated toolchain: # that everyone gets an updated toolchain:
TERMUX_STANDALONE_TOOLCHAIN+="-v14" TERMUX_STANDALONE_TOOLCHAIN+="-v1"
if [ -n "${TERMUX_PKG_BLACKLISTED_ARCHES:=""}" ] && [ "$TERMUX_PKG_BLACKLISTED_ARCHES" != "${TERMUX_PKG_BLACKLISTED_ARCHES/$TERMUX_ARCH/}" ]; then 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" echo "Skipping building $TERMUX_PKG_NAME for arch $TERMUX_ARCH"
@ -668,8 +668,10 @@ termux_step_setup_toolchain() {
cp "$TERMUX_SCRIPTDIR"/ndk-patches/{elf.h,sysexits.h,ifaddrs.h,libintl.h} usr/include cp "$TERMUX_SCRIPTDIR"/ndk-patches/{elf.h,sysexits.h,ifaddrs.h,libintl.h} usr/include
# Remove <sys/shm.h> from the NDK in favour of that from the libandroid-shmem. # Remove <sys/shm.h> from the NDK in favour of that from the libandroid-shmem.
# Also remove <sys/sem.h> as it doesn't work for non-root. # Remove <sys/sem.h> as it doesn't work for non-root.
rm usr/include/sys/{shm.h,sem.h} # Remove <iconv.h> as we currently provide it from libandroid-support.
# Remove <glob.h> as we currently provide it from libandroid-glob.
rm usr/include/sys/{shm.h,sem.h} usr/include/{iconv.h,glob.h}
sed -i "s/define __ANDROID_API__ __ANDROID_API_FUTURE__/define __ANDROID_API__ $TERMUX_PKG_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

111
ndk-patches/arpa-ftp.patch

@ -1,111 +0,0 @@
Add <arpa/ftp.h> for some ftp defines which some packages needs.
diff -Nur /Users/fornwall/lib/android-ndk/platforms/android-18/arch-arm/usr/include/arpa/ftp.h ./usr/include/arpa/ftp.h
--- /Users/fornwall/lib/android-ndk/platforms/android-18/arch-arm/usr/include/arpa/ftp.h 1970-01-01 01:00:00.000000000 +0100
+++ ./usr/include/arpa/ftp.h 2014-02-07 02:07:52.000000000 +0100
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 1983, 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)ftp.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _ARPA_FTP_H
+#define _ARPA_FTP_H 1
+
+/* Definitions for FTP; see RFC-765. */
+
+/*
+ * Reply codes.
+ */
+#define PRELIM 1 /* positive preliminary */
+#define COMPLETE 2 /* positive completion */
+#define CONTINUE 3 /* positive intermediate */
+#define TRANSIENT 4 /* transient negative completion */
+#define ERROR 5 /* permanent negative completion */
+
+/*
+ * Type codes
+ */
+#define TYPE_A 1 /* ASCII */
+#define TYPE_E 2 /* EBCDIC */
+#define TYPE_I 3 /* image */
+#define TYPE_L 4 /* local byte size */
+
+#ifdef FTP_NAMES
+char *typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local" };
+#endif
+
+/*
+ * Form codes
+ */
+#define FORM_N 1 /* non-print */
+#define FORM_T 2 /* telnet format effectors */
+#define FORM_C 3 /* carriage control (ASA) */
+#ifdef FTP_NAMES
+char *formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control" };
+#endif
+
+/*
+ * Structure codes
+ */
+#define STRU_F 1 /* file (no record structure) */
+#define STRU_R 2 /* record structure */
+#define STRU_P 3 /* page structure */
+#ifdef FTP_NAMES
+char *strunames[] = {"0", "File", "Record", "Page" };
+#endif
+
+/*
+ * Mode types
+ */
+#define MODE_S 1 /* stream */
+#define MODE_B 2 /* block */
+#define MODE_C 3 /* compressed */
+#ifdef FTP_NAMES
+char *modenames[] = {"0", "Stream", "Block", "Compressed" };
+#endif
+
+/*
+ * Record Tokens
+ */
+#define REC_ESC '\377' /* Record-mode Escape */
+#define REC_EOR '\001' /* Record-mode End-of-Record */
+#define REC_EOF '\002' /* Record-mode End-of-File */
+
+/*
+ * Block Header
+ */
+#define BLK_EOR 0x80 /* Block is End-of-Record */
+#define BLK_EOF 0x40 /* Block is End-of-File */
+#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */
+#define BLK_RESTART 0x10 /* Block is Restart Marker */
+
+#define BLK_BYTECOUNT 2 /* Bytes in this block */
+
+#endif /* arpa/ftp.h */

88
ndk-patches/arpa-tftp.patch

@ -1,88 +0,0 @@
The <arpa/tftp.h> header is needed by inetutils.
diff -N -a -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/arpa/tftp.h ./usr/include/arpa/tftp.h
--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/arpa/tftp.h 1969-12-31 19:00:00.000000000 -0500
+++ ./usr/include/arpa/tftp.h 2015-05-12 15:40:31.648145474 -0400
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)tftp.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _ARPA_TFTP_H
+#define _ARPA_TFTP_H 1
+
+/*
+ * Trivial File Transfer Protocol (IEN-133)
+ */
+#define SEGSIZE 512 /* data segment size */
+
+/*
+ * Packet types.
+ */
+#define RRQ 01 /* read request */
+#define WRQ 02 /* write request */
+#define DATA 03 /* data packet */
+#define ACK 04 /* acknowledgement */
+#define ERROR 05 /* error code */
+
+struct tftphdr {
+ short th_opcode; /* packet type */
+ union {
+ char tu_padding[3]; /* sizeof() compat */
+ struct {
+ union {
+ unsigned short tu_block; /* block # */
+ short tu_code; /* error code */
+ } __attribute__ ((__packed__)) th_u3;
+ char tu_data[0]; /* data or error string */
+ } __attribute__ ((__packed__)) th_u2;
+ char tu_stuff[0]; /* request packet stuff */
+ } __attribute__ ((__packed__)) th_u1;
+} __attribute__ ((__packed__));
+
+#define th_block th_u1.th_u2.th_u3.tu_block
+#define th_code th_u1.th_u2.th_u3.tu_code
+#define th_stuff th_u1.tu_stuff
+#define th_data th_u1.th_u2.tu_data
+#define th_msg th_u1.th_u2.tu_data
+
+/*
+ * Error codes.
+ */
+#define EUNDEF 0 /* not defined */
+#define ENOTFOUND 1 /* file not found */
+#define EACCESS 2 /* access violation */
+#define ENOSPACE 3 /* disk full or allocation exceeded */
+#define EBADOP 4 /* illegal TFTP operation */
+#define EBADID 5 /* unknown transfer ID */
+#define EEXISTS 6 /* file already exists */
+#define ENOUSER 7 /* no such user */
+
+#endif /* arpa/tftp.h */

17
ndk-patches/fcntl.h.patch

@ -1,17 +0,0 @@
Avoid defining constants which causes at least dpkg build to think that
sync_file_range(2) is available - which it is not.
diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/fcntl.h ./usr/include/fcntl.h
--- /home/fornwall/lib/android-ndk/sysroot/usr/include/fcntl.h 2017-06-07 01:07:52.000000000 +0200
+++ ./usr/include/fcntl.h 2017-06-18 02:03:25.533276409 +0200
@@ -61,10 +61,6 @@
#define SPLICE_F_MORE 4
#define SPLICE_F_GIFT 8
-#define SYNC_FILE_RANGE_WAIT_BEFORE 1
-#define SYNC_FILE_RANGE_WRITE 2
-#define SYNC_FILE_RANGE_WAIT_AFTER 4
-
int creat(const char*, mode_t);
#if __ANDROID_API__ >= 21

12
ndk-patches/grp.h.patch

@ -1,6 +1,6 @@
diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/grp.h ./usr/include/grp.h diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/grp.h ./usr/include/grp.h
--- /home/fornwall/lib/android-ndk/sysroot/usr/include/grp.h 2017-06-07 01:07:52.000000000 +0200 --- /home/fornwall/lib/android-ndk/sysroot/usr/include/grp.h 2017-11-09 09:57:12.000000000 +0100
+++ ./usr/include/grp.h 2017-06-18 01:40:08.452570901 +0200 +++ ./usr/include/grp.h 2017-11-15 11:43:43.065533963 +0100
@@ -52,18 +52,11 @@ @@ -52,18 +52,11 @@
/* Note: Android has thousands and thousands of ids to iterate through. */ /* Note: Android has thousands and thousands of ids to iterate through. */
@ -14,8 +14,8 @@ diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/grp.h ./usr/includ
- -
- -
-#if __ANDROID_API__ >= 24 -#if __ANDROID_API__ >= 24
-int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**) __INTRODUCED_IN(24); -int getgrgid_r(gid_t __gid, struct group* __group, char* __buf, size_t __n, struct group** __result) __INTRODUCED_IN(24);
-int getgrnam_r(const char*, struct group*, char*, size_t, struct group**) __INTRODUCED_IN(24); -int getgrnam_r(const char* __name, struct group* __group, char* __buf, size_t __n, struct group** __result) __INTRODUCED_IN(24);
-#endif /* __ANDROID_API__ >= 24 */ -#endif /* __ANDROID_API__ >= 24 */
+static struct group* getgrent(void) { return 0; } +static struct group* getgrent(void) { return 0; }
+static void setgrent(void) {} +static void setgrent(void) {}
@ -23,5 +23,5 @@ diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/grp.h ./usr/includ
+static int getgrgid_r(gid_t gid, struct group * grp, char * buf, size_t buflen, struct group ** result) { *result = 0; return 0; } +static int getgrgid_r(gid_t gid, struct group * grp, char * buf, size_t buflen, struct group ** result) { *result = 0; return 0; }
+static int getgrnam_r(const char * name, struct group * grp, char * buf, size_t buflen, struct group ** result) { *result = 0; return 0; } +static int getgrnam_r(const char * name, struct group * grp, char * buf, size_t buflen, struct group ** result) { *result = 0; return 0; }
int getgrouplist (const char*, gid_t, gid_t*, int*); int getgrouplist(const char* __user, gid_t __group, gid_t* __groups, int* __group_count);
int initgroups (const char*, gid_t); int initgroups(const char* __user, gid_t __group);

6
ndk-patches/langinfo.h.patch

@ -1,5 +1,5 @@
diff -N -a -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/langinfo.h ./usr/include/langinfo.h diff -N -a -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/langinfo.h ./usr/include/langinfo.h
--- /home/fornwall/lib/android-ndk/sysroot/usr/include/langinfo.h 2017-06-20 17:41:56.000000000 +0200 --- /home/fornwall/lib/android-ndk/sysroot/usr/include/langinfo.h 2017-11-09 09:57:12.000000000 +0100
+++ ./usr/include/langinfo.h 1970-01-01 01:00:00.000000000 +0100 +++ ./usr/include/langinfo.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,104 +0,0 @@ @@ -1,104 +0,0 @@
-/* -/*
@ -98,8 +98,8 @@ diff -N -a -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/langinfo.h .
- -
- -
-#if __ANDROID_API__ >= 26 -#if __ANDROID_API__ >= 26
-char* nl_langinfo(nl_item) __INTRODUCED_IN(26); -char* nl_langinfo(nl_item __item) __INTRODUCED_IN(26);
-char* nl_langinfo_l(nl_item, locale_t) __INTRODUCED_IN(26); -char* nl_langinfo_l(nl_item __item, locale_t __l) __INTRODUCED_IN(26);
-#endif /* __ANDROID_API__ >= 26 */ -#endif /* __ANDROID_API__ >= 26 */
- -
- -

12
ndk-patches/limits.h.patch

@ -1,12 +0,0 @@
diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/limits.h ./usr/include/limits.h
--- /home/fornwall/lib/android-ndk/sysroot/usr/include/limits.h 2017-06-07 01:07:52.000000000 +0200
+++ ./usr/include/limits.h 2017-06-18 02:05:17.404056395 +0200
@@ -139,7 +139,7 @@
#define HOST_NAME_MAX _POSIX_HOST_NAME_MAX
#define _POSIX_VERSION 200809L /* Posix C language bindings version */
-#define _POSIX2_VERSION -1 /* we don't support Posix command-line tools */
+#define _POSIX2_VERSION 200809 /* Termux change to avoid coreutils obsolete breakage */
#define _XOPEN_VERSION 700 /* by Posix definition */
/* >= _POSIX_THREAD_DESTRUCTOR_ITERATIONS */

10
ndk-patches/linux-fcntl.h.patch

@ -1,18 +1,16 @@
diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/linux/fcntl.h ./usr/include/linux/fcntl.h diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/linux/fcntl.h ./usr/include/linux/fcntl.h
--- /home/fornwall/lib/android-ndk/sysroot/usr/include/linux/fcntl.h 2017-06-07 01:07:52.000000000 +0200 --- /home/fornwall/lib/android-ndk/sysroot/usr/include/linux/fcntl.h 2017-11-09 09:57:12.000000000 +0100
+++ ./usr/include/linux/fcntl.h 2017-06-18 01:44:54.697429382 +0200 +++ ./usr/include/linux/fcntl.h 2017-11-15 11:49:10.709710452 +0100
@@ -46,6 +46,14 @@ @@ -40,6 +40,12 @@
#define DN_ATTRIB 0x00000020
#define DN_MULTISHOT 0x80000000 #define DN_MULTISHOT 0x80000000
#define AT_FDCWD - 100 #define AT_FDCWD - 100
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+
+/* Termux patch: This flag is not supported on Android 6.0+, and should not +/* Termux patch: This flag is not supported on Android 6.0+, and should not
+ be needed since there are not setuid binaries. Define AT_EACCESS to 0 to + be needed since there are not setuid binaries. Define AT_EACCESS to 0 to
+ avoid packages defining their own AT_EACCESS (which e.g. coreutil does) + avoid packages defining their own AT_EACCESS (which e.g. coreutil does)
+ since that will only result in errors. See: + since that will only result in errors. See:
+ https://android.googlesource.com/platform/bionic/+/3577825%5E!/ */ + https://android.googlesource.com/platform/bionic/+/3577825%5E!/ */
+#define AT_EACCESS 0 +#define AT_EACCESS 0
+
#define AT_SYMLINK_NOFOLLOW 0x100 #define AT_SYMLINK_NOFOLLOW 0x100
#define AT_REMOVEDIR 0x200 #define AT_REMOVEDIR 0x200
#define AT_SYMLINK_FOLLOW 0x400 #define AT_SYMLINK_FOLLOW 0x400

8
ndk-patches/paths.h.patch

@ -1,11 +1,13 @@
diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/paths.h ./usr/include/paths.h 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-06-07 01:07:52.000000000 +0200 --- /home/fornwall/lib/android-ndk/sysroot/usr/include/paths.h 2017-11-09 09:57:12.000000000 +0100
+++ ./usr/include/paths.h 2017-06-18 01:49:55.374140031 +0200 +++ ./usr/include/paths.h 2017-11-15 11:51:24.456129565 +0100
@@ -34,13 +34,19 @@ @@ -34,15 +34,19 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
-#ifndef _PATH_BSHELL
-#define _PATH_BSHELL "/system/bin/sh" -#define _PATH_BSHELL "/system/bin/sh"
-#endif
+#define _PATH_BSHELL "@TERMUX_PREFIX@/bin/sh" +#define _PATH_BSHELL "@TERMUX_PREFIX@/bin/sh"
#define _PATH_CONSOLE "/dev/console" #define _PATH_CONSOLE "/dev/console"
-#define _PATH_DEFPATH "/sbin:/system/sbin:/system/bin:/system/xbin:/vendor/bin:/vendor/xbin" -#define _PATH_DEFPATH "/sbin:/system/sbin:/system/bin:/system/xbin:/vendor/bin:/vendor/xbin"

23
ndk-patches/pty.h.patch

@ -1,18 +1,19 @@
In Termux these are implemented in the libutil package to support android-21.
diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/pty.h ./usr/include/pty.h diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/pty.h ./usr/include/pty.h
--- /home/fornwall/lib/android-ndk/sysroot/usr/include/pty.h 2017-06-20 17:41:56.000000000 +0200 --- /home/fornwall/lib/android-ndk/sysroot/usr/include/pty.h 2017-11-09 09:57:12.000000000 +0100
+++ ./usr/include/pty.h 2017-07-02 11:42:39.244882732 +0200 +++ ./usr/include/pty.h 2017-11-15 11:52:53.115077179 +0100
@@ -37,10 +37,8 @@ @@ -36,12 +36,9 @@
__BEGIN_DECLS
__BEGIN_DECLS
-
-#if __ANDROID_API__ >= 23 -#if __ANDROID_API__ >= 23
-int openpty(int*, int*, char*, const struct termios*, const struct winsize*) __INTRODUCED_IN(23); -int openpty(int* __master_fd, int* __slave_fd, char* __slave_name, const struct termios* __termios_ptr, const struct winsize* __winsize_ptr) __INTRODUCED_IN(23);
-int forkpty(int*, char*, const struct termios*, const struct winsize*) __INTRODUCED_IN(23); -int forkpty(int* __master_fd, char* __slave_name, const struct termios* __termios_ptr, const struct winsize* __winsize_ptr) __INTRODUCED_IN(23);
-#endif /* __ANDROID_API__ >= 23 */ -#endif /* __ANDROID_API__ >= 23 */
+int openpty(int*, int*, char*, const struct termios*, const struct winsize*); -
+int forkpty(int*, char*, const struct termios*, const struct winsize*); +/* In Termux these are implemented in the libutil package to support android-21. */
+int openpty(int* __master_fd, int* __slave_fd, char* __slave_name, const struct termios* __termios_ptr, const struct winsize* __winsize_ptr);
+int forkpty(int* __master_fd, char* __slave_name, const struct termios* __termios_ptr, const struct winsize* __winsize_ptr);
__END_DECLS __END_DECLS

20
ndk-patches/spawn.h.patch

@ -0,0 +1,20 @@
diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/spawn.h ./usr/include/spawn.h
--- /home/fornwall/lib/android-ndk/sysroot/usr/include/spawn.h 2017-11-09 09:57:12.000000000 +0100
+++ ./usr/include/spawn.h 2017-11-15 12:08:34.911786251 +0100
@@ -36,6 +36,8 @@
__BEGIN_DECLS
+#if __ANDROID_API__ >= __ANDROID_API_FUTURE__
+
#define POSIX_SPAWN_RESETIDS 1
#define POSIX_SPAWN_SETPGROUP 2
#define POSIX_SPAWN_SETSIGDEF 4
@@ -51,7 +53,6 @@
typedef struct __posix_spawn_file_actions* posix_spawn_file_actions_t;
-#if __ANDROID_API__ >= __ANDROID_API_FUTURE__
int posix_spawn(pid_t* __pid, const char* __path, const posix_spawn_file_actions_t* __actions, const posix_spawnattr_t* __attr, char* const __argv[], char* const __env[]) __INTRODUCED_IN_FUTURE;
int posix_spawnp(pid_t* __pid, const char* __file, const posix_spawn_file_actions_t* __actions, const posix_spawnattr_t* __attr, char* const __argv[], char* const __env[]) __INTRODUCED_IN_FUTURE;

44
ndk-patches/stdio.h.patch

@ -1,6 +1,6 @@
diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/stdio.h ./usr/include/stdio.h diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/stdio.h ./usr/include/stdio.h
--- /home/fornwall/lib/android-ndk/sysroot/usr/include/stdio.h 2017-06-07 01:07:52.000000000 +0200 --- /home/fornwall/lib/android-ndk/sysroot/usr/include/stdio.h 2017-11-09 09:57:12.000000000 +0100
+++ ./usr/include/stdio.h 2017-06-18 01:59:17.835984565 +0200 +++ ./usr/include/stdio.h 2017-11-15 11:57:58.567432093 +0100
@@ -44,6 +44,9 @@ @@ -44,6 +44,9 @@
#include <stdarg.h> #include <stdarg.h>
#include <stddef.h> #include <stddef.h>
@ -8,20 +8,20 @@ diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/stdio.h ./usr/incl
+#include <string.h> /* For strcpy(3) used by ctermid() */ +#include <string.h> /* For strcpy(3) used by ctermid() */
+#include <asm/fcntl.h> /* For O_RDWR and other O_* constants */ +#include <asm/fcntl.h> /* For O_RDWR and other O_* constants */
+ +
#define __need_NULL #include <bits/seek_constants.h>
#include <stddef.h>
@@ -174,7 +178,7 @@ #if __ANDROID_API__ < __ANDROID_API_N__
@@ -167,7 +170,7 @@
__warnattr_strict("vsprintf is often misused; please use vsnprintf"); __warnattr_strict("vsprintf is often misused; please use vsnprintf");
char* tmpnam(char*) char* tmpnam(char* __s)
__warnattr("tempnam is unsafe, use mkstemp or tmpfile instead"); __warnattr("tempnam is unsafe, use mkstemp or tmpfile instead");
-#define P_tmpdir "/tmp/" /* deprecated */ -#define P_tmpdir "/tmp/" /* deprecated */
+#define P_tmpdir "@TERMUX_PREFIX@/tmp/" /* deprecated */ +#define P_tmpdir "@TERMUX_PREFIX@/tmp/" /* deprecated */
char* tempnam(const char*, const char*) char* tempnam(const char* __dir, const char* __prefix)
__warnattr("tempnam is unsafe, use mkstemp or tmpfile instead"); __warnattr("tempnam is unsafe, use mkstemp or tmpfile instead");
@@ -239,8 +243,6 @@ @@ -242,8 +245,6 @@
__INTRODUCED_IN(24); FILE* freopen64(const char* __path, const char* __mode, FILE* __fp) __INTRODUCED_IN(24);
#endif /* __ANDROID_API__ >= 24 */ #endif /* __ANDROID_API__ >= 24 */
-FILE* tmpfile(void); -FILE* tmpfile(void);
@ -29,31 +29,29 @@ diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/stdio.h ./usr/incl
#if __ANDROID_API__ >= 24 #if __ANDROID_API__ >= 24
FILE* tmpfile64(void) __INTRODUCED_IN(24); FILE* tmpfile64(void) __INTRODUCED_IN(24);
#endif /* __ANDROID_API__ >= 24 */ #endif /* __ANDROID_API__ >= 24 */
@@ -256,10 +258,15 @@ @@ -259,10 +260,15 @@
#define L_ctermid 1024 /* size for ctermid() */ #define L_ctermid 1024 /* size for ctermid() */
-#if __ANDROID_API__ >= 26 -#if __ANDROID_API__ >= 26
-char* ctermid(char*) __INTRODUCED_IN(26); -char* ctermid(char* __buf) __INTRODUCED_IN(26);
-#endif /* __ANDROID_API__ >= 26 */ -#endif /* __ANDROID_API__ >= 26 */
+/* Needed by gnulibs freading() */ +/* Needed by gnulibs freading(). */
+#define __sferror(p) (((p)->_flags & __SERR) != 0) +#define __sferror(p) (((p)->_flags & __SERR) != 0)
+/* Used by perl, fish, and others */ +/* Used by perl, fish, and others. */
+static __inline__ char* ctermid(char* s) { +static __inline__ char* ctermid(char* s) {
+ if (s == 0) return (char*) "/dev/tty"; + if (s == 0) return (char*) "/dev/tty";
+ strcpy(s, "/dev/tty"); + strcpy(s, "/dev/tty");
+ return s; + return s;
+} +}
FILE* fdopen(int, const char*); FILE* fdopen(int __fd, const char* __mode);
int fileno(FILE*); int fileno(FILE* __fp);
@@ -577,4 +584,31 @@ @@ -310,6 +316,29 @@
#include <bits/fortify/stdio.h>
__END_DECLS #endif
+__BEGIN_DECLS
+
+int open(const char*, int, ...) __overloadable __RENAME_CLANG(open); +int open(const char*, int, ...) __overloadable __RENAME_CLANG(open);
+extern pid_t getpid(); +extern pid_t getpid();
+extern int unlink(const char*); +extern int unlink(const char*);
@ -77,6 +75,6 @@ diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/stdio.h ./usr/incl
+ return NULL; + return NULL;
+} +}
+ +
+__END_DECLS __END_DECLS
+
#endif /* _STDIO_H_ */ #endif

19
ndk-patches/stdlib.h.patch

@ -1,6 +1,6 @@
diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/stdlib.h ./usr/include/stdlib.h diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/stdlib.h ./usr/include/stdlib.h
--- /home/fornwall/lib/android-ndk/sysroot/usr/include/stdlib.h 2017-06-20 17:41:56.000000000 +0200 --- /home/fornwall/lib/android-ndk/sysroot/usr/include/stdlib.h 2017-11-09 09:57:12.000000000 +0100
+++ ./usr/include/stdlib.h 2017-07-16 12:30:31.724463111 +0200 +++ ./usr/include/stdlib.h 2017-11-15 12:49:51.790799140 +0100
@@ -35,6 +35,7 @@ @@ -35,6 +35,7 @@
#include <alloca.h> #include <alloca.h>
#include <malloc.h> #include <malloc.h>
@ -9,8 +9,8 @@ diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/stdlib.h ./usr/inc
__BEGIN_DECLS __BEGIN_DECLS
@@ -210,8 +211,7 @@ @@ -205,8 +206,7 @@
size_t wcstombs(char*, const wchar_t*, size_t); size_t wcstombs(char* __dst, const wchar_t* __src, size_t __n);
#if __ANDROID_API__ >= __ANDROID_API_L__ #if __ANDROID_API__ >= __ANDROID_API_L__
-size_t __ctype_get_mb_cur_max(void) __INTRODUCED_IN(21); -size_t __ctype_get_mb_cur_max(void) __INTRODUCED_IN(21);
@ -19,3 +19,14 @@ diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/stdlib.h ./usr/inc
#else #else
/* /*
* Pre-L we didn't have any locale support and so we were always the POSIX * Pre-L we didn't have any locale support and so we were always the POSIX
@@ -244,7 +244,9 @@
float strtof_l(const char* __s, char** __end_ptr, locale_t __l) __INTRODUCED_IN(26);
long strtol_l(const char* __s, char** __end_ptr, int, locale_t __l) __INTRODUCED_IN(26);
#else
-// Implemented as static inlines before 26.
+static __inline__ double strtod_l(const char* __s, char** __end_ptr, locale_t __l) { return strtod(__s, __end_ptr); }
+static __inline__ float strtof_l(const char* __s, char** __end_ptr, locale_t __l) { return strtof(__s, __end_ptr); }
+static __inline__ long strtol_l(const char* __s, char** __end_ptr, int __b, locale_t __l) { return strtol(__s, __end_ptr, __b); }
#endif
__END_DECLS

35
ndk-patches/string.h.patch

@ -1,35 +0,0 @@
See https://github.com/android-ndk/ndk/issues/440
diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/string.h ./usr/include/string.h
--- /home/fornwall/lib/android-ndk/sysroot/usr/include/string.h 2017-06-20 17:41:56.000000000 +0200
+++ ./usr/include/string.h 2017-06-30 22:15:01.161342640 +0200
@@ -74,12 +74,12 @@
#endif /* __ANDROID_API__ >= 18 */
#if defined(__USE_GNU)
+#if __ANDROID_API__ >= 24
#if defined(__cplusplus)
extern "C++" char* strchrnul(char* _Nonnull, int) __RENAME(strchrnul) __attribute_pure__;
extern "C++" const char* strchrnul(const char* _Nonnull, int) __RENAME(strchrnul) __attribute_pure__;
#else
-#if __ANDROID_API__ >= 24
char* strchrnul(const char* _Nonnull, int) __attribute_pure__ __INTRODUCED_IN(24);
#endif /* __ANDROID_API__ >= 24 */
@@ -169,6 +169,7 @@
#endif
#if defined(__USE_GNU) && !defined(basename)
+#if __ANDROID_API__ >= 23
/*
* glibc has a basename in <string.h> that's different to the POSIX one in <libgen.h>.
* It doesn't modify its argument, and in C++ it's const-correct.
@@ -178,7 +179,6 @@
extern "C++" const char* basename(const char* _Nonnull) __RENAME(__gnu_basename);
#else
-#if __ANDROID_API__ >= 23
char* basename(const char* _Nonnull) __RENAME(__gnu_basename) __INTRODUCED_IN(23);
#endif /* __ANDROID_API__ >= 23 */

14
ndk-patches/sys-ttydefault.h.patch

@ -1,14 +0,0 @@
Needed by util-linux.
diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/sys/ttydefaults.h ./usr/include/sys/ttydefaults.h
--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/sys/ttydefaults.h 2016-06-01 12:53:26.000000000 -0400
+++ ./usr/include/sys/ttydefaults.h 2016-06-22 06:29:26.247578626 -0400
@@ -46,7 +46,7 @@
* Defaults on "first" open.
*/
#define TTYDEF_IFLAG (BRKINT | ICRNL | IMAXBEL | IXON | IXANY)
-#define TTYDEF_OFLAG (OPOST | ONLCR | OXTABS)
+#define TTYDEF_OFLAG (OPOST | ONLCR | XTABS)
#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL)
#define TTYDEF_CFLAG (CREAD | CS8 | HUPCL)
#define TTYDEF_SPEED (B9600)

13
ndk-patches/utmp.h.patch

@ -1,18 +1,17 @@
In Termux login_tty() is implemented in the libutil package to support android-21.
diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/utmp.h ./usr/include/utmp.h diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/utmp.h ./usr/include/utmp.h
--- /home/fornwall/lib/android-ndk/sysroot/usr/include/utmp.h 2017-06-20 17:41:56.000000000 +0200 --- /home/fornwall/lib/android-ndk/sysroot/usr/include/utmp.h 2017-11-09 09:57:12.000000000 +0100
+++ ./usr/include/utmp.h 2017-07-10 09:47:42.422659110 +0200 +++ ./usr/include/utmp.h 2017-11-15 12:01:37.108811692 +0100
@@ -101,11 +101,7 @@ @@ -101,11 +101,8 @@
struct utmp* getutent(void); struct utmp* getutent(void);
void endutent(void); void endutent(void);
- -
-#if __ANDROID_API__ >= 23 -#if __ANDROID_API__ >= 23
-int login_tty(int) __INTRODUCED_IN(23); -int login_tty(int __fd) __INTRODUCED_IN(23);
-#endif /* __ANDROID_API__ >= 23 */ -#endif /* __ANDROID_API__ >= 23 */
- -
+int login_tty(int); +/* In Termux login_tty() is implemented in the libutil package to support android-21. */
+int login_tty(int __fd);
__END_DECLS __END_DECLS

2
packages/aapt/build.sh

@ -298,7 +298,7 @@ termux_step_make_install () {
rm -rf android-jar rm -rf android-jar
mkdir android-jar mkdir android-jar
cd android-jar cd android-jar
cp $ANDROID_HOME/platforms/android-26/android.jar . cp $ANDROID_HOME/platforms/android-27/android.jar .
unzip -q android.jar unzip -q android.jar
mkdir -p $TERMUX_PREFIX/share/aapt mkdir -p $TERMUX_PREFIX/share/aapt
zip -q $TERMUX_PREFIX/share/aapt/android.jar AndroidManifest.xml resources.arsc zip -q $TERMUX_PREFIX/share/aapt/android.jar AndroidManifest.xml resources.arsc

4
packages/ecj/build.sh

@ -1,7 +1,7 @@
TERMUX_PKG_HOMEPAGE=http://www.eclipse.org/jdt/core/ TERMUX_PKG_HOMEPAGE=http://www.eclipse.org/jdt/core/
TERMUX_PKG_DESCRIPTION="Eclipse Compiler for Java" TERMUX_PKG_DESCRIPTION="Eclipse Compiler for Java"
TERMUX_PKG_VERSION=4.6.2 TERMUX_PKG_VERSION=4.6.2
TERMUX_PKG_REVISION=1 TERMUX_PKG_REVISION=2
TERMUX_PKG_SRCURL=http://eclipse.mirror.wearetriple.com/eclipse/downloads/drops4/R-4.6.2-201611241400/ecj-4.6.2.jar TERMUX_PKG_SRCURL=http://eclipse.mirror.wearetriple.com/eclipse/downloads/drops4/R-4.6.2-201611241400/ecj-4.6.2.jar
TERMUX_PKG_PLATFORM_INDEPENDENT=true TERMUX_PKG_PLATFORM_INDEPENDENT=true
@ -28,7 +28,7 @@ termux_step_make () {
cd android-jar cd android-jar
# We need the android classes for JDT to compile against. # We need the android classes for JDT to compile against.
cp $ANDROID_HOME/platforms/android-26/android.jar . cp $ANDROID_HOME/platforms/android-27/android.jar .
unzip -q android.jar unzip -q android.jar
rm -Rf android.jar resources.arsc res assets rm -Rf android.jar resources.arsc res assets
zip -q -r android.jar . zip -q -r android.jar .

4
scripts/setup-android-sdk.sh

@ -25,7 +25,7 @@ if [ ! -d $NDK ]; then
mkdir -p $NDK mkdir -p $NDK
cd $NDK/.. cd $NDK/..
rm -Rf `basename $NDK` rm -Rf `basename $NDK`
NDK_VERSION=r15c NDK_VERSION=r16
curl --fail --retry 3 -o ndk.zip \ curl --fail --retry 3 -o ndk.zip \
http://dl.google.com/android/repository/android-ndk-${NDK_VERSION}-`uname`-x86_64.zip http://dl.google.com/android/repository/android-ndk-${NDK_VERSION}-`uname`-x86_64.zip
@ -38,4 +38,4 @@ fi
yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses
# The android-16 platform is used in the ecj package: # The android-16 platform is used in the ecj package:
$ANDROID_HOME/tools/bin/sdkmanager "build-tools;26.0.1" "platforms;android-26" "platforms;android-16" $ANDROID_HOME/tools/bin/sdkmanager "build-tools;27.0.1" "platforms;android-27" "platforms;android-16"

Loading…
Cancel
Save