diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 9bd9adc1d7744f3..8ccef00f88c4bf2 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -159,7 +159,9 @@ jobs: firefox google-chrome-stable microsoft-edge-stable mono-runtime-common monodoc-manual ruby sudo apt autoremove -yq sudo rm -fr /opt/hostedtoolcache /usr/share/dotnet /usr/share/swift - NDK=$ANDROID_NDK_LATEST_HOME ANDROID_HOME=$ANDROID_SDK_ROOT ./build-package.sh -I -a ${{ matrix.target_arch }} $packages + NDK=$ANDROID_NDK_ROOT ANDROID_HOME=$ANDROID_SDK_ROOT ./build-package.sh -I -a ${{ matrix.target_arch }} ndk-multilib + mv ~/.termux-build/ndk-multilib/massage/data/data/com.termux/files/usr/opt /data/data/com.termux/files/usr + NDK=$ANDROID_NDK_ROOT ANDROID_HOME=$ANDROID_SDK_ROOT ./build-package.sh -I -a ${{ matrix.target_arch }} $packages else ./scripts/run-docker.sh ./build-package.sh -I -a ${{ matrix.target_arch }} $packages fi diff --git a/build-package.sh b/build-package.sh index 254f3e3536002b8..35c71cb1a037f94 100755 --- a/build-package.sh +++ b/build-package.sh @@ -228,9 +228,9 @@ source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_handle_hostbuild.sh" # shellcheck source=scripts/build/termux_step_host_build.sh source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_host_build.sh" -# Setup a standalone Android NDK toolchain. Called from termux_step_setup_toolchain. -# shellcheck source=scripts/build/toolchain/termux_setup_toolchain_26b.sh -source "$TERMUX_SCRIPTDIR/scripts/build/toolchain/termux_setup_toolchain_26b.sh" +# Setup a standalone Android NDK 25c toolchain. Called from termux_step_setup_toolchain. +# shellcheck source=scripts/build/toolchain/termux_setup_toolchain_25c.sh +source "$TERMUX_SCRIPTDIR/scripts/build/toolchain/termux_setup_toolchain_25c.sh" # Setup a standalone Android NDK 23c toolchain. Called from termux_step_setup_toolchain. # shellcheck source=scripts/build/toolchain/termux_setup_toolchain_23c.sh diff --git a/ndk-patches/25c b/ndk-patches/25c new file mode 120000 index 000000000000000..4e60d61a0180a00 --- /dev/null +++ b/ndk-patches/25c @@ -0,0 +1 @@ +23c \ No newline at end of file diff --git a/ndk-patches/26b/bits-struct_file.h.patch b/ndk-patches/26b/bits-struct_file.h.patch deleted file mode 100644 index 7e5bf09b33a2355..000000000000000 --- a/ndk-patches/26b/bits-struct_file.h.patch +++ /dev/null @@ -1,85 +0,0 @@ ---- ./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 - - __BEGIN_DECLS -+#if defined(__LP64__) -+struct __sbuf { -+ unsigned char* _base; -+ size_t _size; -+}; -+#else -+struct __sbuf { -+ unsigned char *_base; -+ int _size; -+}; -+#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() */ - #if defined(__LP64__) -- char __private[152]; -+ 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 */ - #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); -+ -+ /* extension data, to avoid further ABI breakage */ -+ 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 */ -+ -+ /* 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 */ -+ -+ /* separate buffer for fgetln() when line crosses buffer boundary */ -+ 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 */ -+}; -+#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 */ - - __END_DECLS diff --git a/ndk-patches/26b/dirent.h.patch b/ndk-patches/26b/dirent.h.patch deleted file mode 100644 index 5865a94871f8e79..000000000000000 --- a/ndk-patches/26b/dirent.h.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ./usr/include/dirent.h.orig -+++ ./usr/include/dirent.h -@@ -57,6 +57,9 @@ - #define DT_SOCK 12 - #define DT_WHT 14 - -+#define IFTODT(x) ((x)>>12 & 0xF) -+#define DTTOIF(x) ((x)<<12) -+ - #if defined(__LP64__) - #define __DIRENT64_INO_T ino_t - #else diff --git a/ndk-patches/26b/grp.h.patch b/ndk-patches/26b/grp.h.patch deleted file mode 100644 index 5afe4fa72589896..000000000000000 --- a/ndk-patches/26b/grp.h.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ./usr/include/grp.h.orig -+++ ./usr/include/grp.h -@@ -50,21 +50,15 @@ - struct group* _Nullable getgrgid(gid_t __gid); - struct group* _Nullable getgrnam(const char* _Nonnull __name); - --/* Note: Android has thousands and thousands of ids to iterate through. */ -- --#if __ANDROID_API__ >= 26 --struct group* _Nullable getgrent(void) __INTRODUCED_IN(26); -- --void setgrent(void) __INTRODUCED_IN(26); --void endgrent(void) __INTRODUCED_IN(26); --#endif /* __ANDROID_API__ >= 26 */ -- -- - #if __ANDROID_API__ >= 24 - int getgrgid_r(gid_t __gid, struct group* __BIONIC_COMPLICATED_NULLNESS __group, char* _Nonnull __buf, size_t __n, struct group* _Nullable * _Nonnull __result) __INTRODUCED_IN(24); - int getgrnam_r(const char* _Nonnull __name, struct group* __BIONIC_COMPLICATED_NULLNESS __group, char* _Nonnull __buf, size_t __n, struct group* _Nullable *_Nonnull __result) __INTRODUCED_IN(24); - #endif /* __ANDROID_API__ >= 24 */ - -+static struct group* _Nullable getgrent(void) { return 0; } -+static void setgrent(void) {} -+static void endgrent(void) {} -+ - int getgrouplist(const char* _Nonnull __user, gid_t __group, gid_t* __BIONIC_COMPLICATED_NULLNESS __groups, int* _Nonnull __group_count); - int initgroups(const char* _Nonnull __user, gid_t __group); - diff --git a/ndk-patches/26b/linux-fcntl.h.patch b/ndk-patches/26b/linux-fcntl.h.patch deleted file mode 100644 index 727c39832863b5f..000000000000000 --- a/ndk-patches/26b/linux-fcntl.h.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ./usr/include/linux/fcntl.h -+++ ./usr/include/linux/fcntl.h -@@ -54,7 +54,7 @@ - #define DN_MULTISHOT 0x80000000 - #define AT_FDCWD - 100 - #define AT_SYMLINK_NOFOLLOW 0x100 --#define AT_EACCESS 0x200 -+#define AT_EACCESS 0 - #define AT_REMOVEDIR 0x200 - #define AT_SYMLINK_FOLLOW 0x400 - #define AT_NO_AUTOMOUNT 0x800 diff --git a/ndk-patches/26b/paths.h.patch b/ndk-patches/26b/paths.h.patch deleted file mode 100644 index b5c2684da46d7dc..000000000000000 --- a/ndk-patches/26b/paths.h.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- ./usr/include/paths.h.orig 2021-08-16 11:55:04.492150066 +0200 -+++ ./usr/include/paths.h 2021-08-16 11:55:42.498804733 +0200 -@@ -40,14 +40,14 @@ - - #ifndef _PATH_BSHELL - /** Path to the default system shell. Historically the 'B' was to specify the Bourne shell. */ --#define _PATH_BSHELL "/system/bin/sh" -+#define _PATH_BSHELL "@TERMUX_PREFIX@/bin/sh" - #endif - - /** Path to the system console. */ - #define _PATH_CONSOLE "/dev/console" - - /** Default shell search path. */ --#define _PATH_DEFPATH "/product/bin:/apex/com.android.runtime/bin:/apex/com.android.art/bin:/system_ext/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin" -+#define _PATH_DEFPATH "@TERMUX_PREFIX@/bin" - - /** Path to the directory containing device files. */ - #define _PATH_DEV "/dev/" -@@ -63,3 +63,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/" diff --git a/ndk-patches/26b/pwd.h.patch b/ndk-patches/26b/pwd.h.patch deleted file mode 100644 index b7e360392d2f13e..000000000000000 --- a/ndk-patches/26b/pwd.h.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- ./usr/include/pwd.h.orig -+++ ./usr/include/pwd.h -@@ -89,13 +89,60 @@ - struct passwd* _Nullable getpwent(void) __INTRODUCED_IN(26); - - void setpwent(void) __INTRODUCED_IN(26); --void endpwent(void) __INTRODUCED_IN(26); - #endif /* __ANDROID_API__ >= 26 */ - - - int getpwnam_r(const char* _Nonnull __name, struct passwd* _Nonnull __pwd, char* _Nonnull __buf, size_t __n, struct passwd* _Nullable * _Nonnull __result); - int getpwuid_r(uid_t __uid, struct passwd* _Nonnull __pwd, char* _Nonnull __buf, size_t __n, struct passwd* _Nullable * _Nonnull __result); - -+int access(const char* __path, int __mode); -+ -+static void android_setup_pwd(struct passwd* pw) { -+ char const* result = "@TERMUX_PREFIX@/bin/login"; -+ if (result == NULL || access(result, /*X_OK*/1) == -1) { -+ pw->pw_shell = "@TERMUX_PREFIX@/bin/bash"; -+ } else { -+ pw->pw_shell = (char*) result; -+ } -+ pw->pw_dir = "@TERMUX_HOME@"; -+ pw->pw_passwd = "*"; -+#ifdef __LP64__ -+ pw->pw_gecos = ""; /* Avoid NULL field. */ -+#endif -+} -+ -+static struct passwd* android_polyfill_getpwuid(uid_t t) { -+ struct passwd* pw = getpwuid(t); -+ if (pw == NULL) return NULL; -+ android_setup_pwd(pw); -+ return pw; -+} -+ -+static struct passwd* android_polyfill_getpwnam(const char* name) { -+ struct passwd* pw = getpwnam(name); -+ if (pw == NULL) return NULL; -+ android_setup_pwd(pw); -+ return pw; -+} -+ -+static int android_polyfill_getpwuid_r(uid_t uid, -+ struct passwd *pwd, -+ char *buffer, -+ size_t bufsize, -+ struct passwd **result) { -+ int ret = getpwuid_r(uid, pwd, buffer, bufsize, result); -+ if (ret != 0) return ret; -+ android_setup_pwd(pwd); -+ return 0; -+} -+ -+#define getpwnam android_polyfill_getpwnam -+#define getpwuid android_polyfill_getpwuid -+#define getpwuid_r android_polyfill_getpwuid_r -+static void endpwent(void) { /* Do nothing. */ } -+ -+ -+ - __END_DECLS - - #endif diff --git a/ndk-patches/26b/redefine-TCSAFLUSH.patch b/ndk-patches/26b/redefine-TCSAFLUSH.patch deleted file mode 100644 index c063a89586181e1..000000000000000 --- a/ndk-patches/26b/redefine-TCSAFLUSH.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -u -r /home/builder/lib/android-ndk/sysroot/usr/include/asm-generic/termbits.h ./usr/include/asm-generic/termbits.h ---- /home/builder/lib/android-ndk/sysroot/usr/include/asm-generic/termbits.h 2018-09-10 17:37:50.000000000 +0000 -+++ ./usr/include/asm-generic/termbits.h 2019-01-16 04:54:01.117253378 +0000 -@@ -190,5 +190,6 @@ - #define TCIOFLUSH 2 - #define TCSANOW 0 - #define TCSADRAIN 1 --#define TCSAFLUSH 2 -+/* TCSAFLUSH is patched to be TCSANOW in Termux to work around Android SELinux rule */ -+#define TCSAFLUSH 0 - #endif ---- ./usr/include/bits/termios_inlines.h.orig 2021-08-16 17:05:16.001067630 +0200 -+++ ./usr/include/bits/termios_inlines.h 2021-08-16 17:05:05.851074187 +0200 -@@ -117,7 +117,6 @@ - switch (optional_actions) { - case TCSANOW: cmd = TCSETS; break; - case TCSADRAIN: cmd = TCSETSW; break; -- case TCSAFLUSH: cmd = TCSETSF; break; - default: errno = EINVAL; return -1; - } - return ioctl(fd, cmd, s); diff --git a/ndk-patches/26b/semaphore.h.patch b/ndk-patches/26b/semaphore.h.patch deleted file mode 100644 index 4e02017a71ce293..000000000000000 --- a/ndk-patches/26b/semaphore.h.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- ./usr/include/semaphore.h.orig -+++ ./usr/include/semaphore.h -@@ -71,9 +71,14 @@ - int sem_trywait(sem_t* _Nonnull __sem); - int sem_wait(sem_t* _Nonnull __sem); - --/* These aren't actually implemented. */ -+#undef sem_open -+#define sem_open libandroid_sem_open - sem_t* _Nullable sem_open(const char* _Nonnull __name, int _flags, ...); -+#undef sem_close -+#define sem_close libandroid_sem_close - int sem_close(sem_t* _Nonnull __sem); -+#undef sem_unlink -+#define sem_unlink libandroid_sem_unlink - int sem_unlink(const char* _Nonnull __name); - - __END_DECLS diff --git a/ndk-patches/26b/stdio.h.patch b/ndk-patches/26b/stdio.h.patch deleted file mode 100644 index 3b8e976dbf7ca38..000000000000000 --- a/ndk-patches/26b/stdio.h.patch +++ /dev/null @@ -1,80 +0,0 @@ ---- ./usr/include/stdio.h.orig 2021-08-16 11:48:44.308954400 +0200 -+++ ./usr/include/stdio.h 2021-08-16 11:50:00.438924014 +0200 -@@ -44,6 +44,9 @@ - #include - #include - -+#include /* For strcpy(3) used by ctermid() */ -+#include /* For O_RDWR and other O_* constants */ -+ - #include - - #if __ANDROID_API__ < 24 -@@ -165,7 +166,7 @@ - __printflike(2, 0) __warnattr_strict("vsprintf is often misused; please use vsnprintf"); - char* _Nullable tmpnam(char* _Nullable __s) - __warnattr("tmpnam is unsafe, use mkstemp or tmpfile instead"); --#define P_tmpdir "/tmp/" /* deprecated */ -+#define P_tmpdir "@TERMUX_PREFIX@/tmp/" /* deprecated */ - char* _Nullable tempnam(const char* _Nullable __dir, const char* _Nullable __prefix) - __warnattr("tempnam is unsafe, use mkstemp or tmpfile instead"); - -@@ -289,8 +290,6 @@ - FILE* _Nullable freopen64(const char* _Nullable __path, const char* _Nonnull __mode, FILE* _Nonnull __fp) __INTRODUCED_IN(24); - #endif /* __ANDROID_API__ >= 24 */ - --FILE* _Nullable tmpfile(void); -- - #if __ANDROID_API__ >= 24 - FILE* _Nullable tmpfile64(void) __INTRODUCED_IN(24); - #endif /* __ANDROID_API__ >= 24 */ -@@ -304,10 +303,15 @@ - - #define L_ctermid 1024 /* size for ctermid() */ - --#if __ANDROID_API__ >= 26 --char* _Nonnull ctermid(char* _Nullable __buf) __INTRODUCED_IN(26); --#endif /* __ANDROID_API__ >= 26 */ -+/* Needed by gnulibs freading(). */ -+#define __sferror(p) (((p)->_flags & __SERR) != 0) - -+/* Used by perl, fish, and others. */ -+static __inline__ char* _Nonnull ctermid(char* _Nullable s) { -+ if (s == 0) return (char*) "/dev/tty"; -+ strcpy(s, "/dev/tty"); -+ return s; -+} - - FILE* fdopen(int __fd, const char* __mode); - int fileno(FILE* __fp); -@@ -376,6 +380,30 @@ - #include - #endif - -+int open(const char*, int, ...); -+extern pid_t getpid(); -+extern int unlink(const char*); -+void free(void* p); -+uint32_t arc4random(void); -+static __inline__ FILE* _Nullable tmpfile() { -+ int p = getpid(); -+ char* path; -+ int i; -+ for (i = 0; i < 100; i++) { -+ unsigned int r = arc4random(); -+ if (asprintf(&path, "@TERMUX_PREFIX@/tmp/tmpfile.%d-%u", p, r) == -1) return NULL; -+ int fd = open(path, O_RDWR | O_CREAT | O_EXCL | O_LARGEFILE, 0600); -+ if (fd >= 0) { -+ FILE* result = fdopen(fd, "w+"); -+ unlink(path); -+ free(path); -+ return result; -+ } -+ free(path); -+ } -+ return NULL; -+} -+ - __END_DECLS - - #endif diff --git a/ndk-patches/26b/stdlib.h.patch b/ndk-patches/26b/stdlib.h.patch deleted file mode 100644 index e00a71d814c350f..000000000000000 --- a/ndk-patches/26b/stdlib.h.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- ./usr/include/stdlib.h.orig 2021-08-16 11:50:47.432239182 +0200 -+++ ./usr/include/stdlib.h 2021-08-16 11:51:31.102222894 +0200 -@@ -33,6 +33,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -223,12 +224,8 @@ - - size_t wcstombs(char* _Nullable __dst, const wchar_t* _Nullable __src, size_t __n) __INTRODUCED_IN_NO_GUARD_FOR_NDK(21); - - --#if __ANDROID_API__ >= 21 --size_t __ctype_get_mb_cur_max(void) __INTRODUCED_IN(21); --#endif /* __ANDROID_API__ >= 21 */ -- --#define MB_CUR_MAX __ctype_get_mb_cur_max() -+#define MB_CUR_MAX 4 - - #if defined(__BIONIC_INCLUDE_FORTIFY_HEADERS) - #include diff --git a/ndk-patches/26b/sys-cdefs.h.patch b/ndk-patches/26b/sys-cdefs.h.patch deleted file mode 100644 index 35508ca4444a203..000000000000000 --- a/ndk-patches/26b/sys-cdefs.h.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- ./usr/include/sys/cdefs.h.orig 2021-08-16 11:52:08.128876161 +0200 -+++ ./usr/include/sys/cdefs.h 2021-08-16 11:52:08.555542676 +0200 -@@ -372,3 +372,6 @@ - #if __has_include() - #include - #endif -+#define __TERMUX__ 1 -+#define __TERMUX_PREFIX__ "@TERMUX_PREFIX@" -+ diff --git a/ndk-patches/26b/syslog.patch b/ndk-patches/26b/syslog.patch deleted file mode 100644 index f29784aeda9361c..000000000000000 --- a/ndk-patches/26b/syslog.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff -uNr sysroot.orig/usr/include/syslog.h sysroot/usr/include/syslog.h ---- sysroot.orig/usr/include/syslog.h 2019-02-12 16:12:24.000000000 +0000 -+++ sysroot/usr/include/syslog.h 2019-03-20 13:19:44.315965728 +0000 -@@ -158,4 +158,22 @@ - */ - void vsyslog(int __priority, const char* __fmt, va_list __args) __printflike(2, 0); - -+static __inline__ void android_polyfill_syslog_r(int syslog_priority, void* d, const char* format, ...) -+{ -+ (void) d; -+ va_list myargs; -+ va_start(myargs, format); -+ vsyslog(syslog_priority, format, myargs); -+ va_end(myargs); -+} -+ -+static __inline__ void android_polyfill_vsyslog_r(int syslog_priority, void* d, const char* fmt, va_list ap) -+{ -+ (void) d; -+ vsyslog(syslog_priority, fmt, ap); -+} -+ -+#define syslog_r android_polyfill_syslog_r -+#define vsyslog_r android_polyfill_vsyslog_r -+ - __END_DECLS diff --git a/ndk-patches/26b/unistd.h.patch b/ndk-patches/26b/unistd.h.patch deleted file mode 100644 index 37ea0a2fe20c7aa..000000000000000 --- a/ndk-patches/26b/unistd.h.patch +++ /dev/null @@ -1,77 +0,0 @@ ---- ./usr/include/unistd.h.orig 2021-08-16 11:52:08.095542840 +0200 -+++ ./usr/include/unistd.h 2021-08-16 11:52:08.565542673 +0200 -@@ -375,6 +375,74 @@ - #undef _UNISTD_H_ - #endif - -+#if !defined GETPASS_H && !defined getpass && !defined HAVE_GETPASS && !defined HAS_GETPASS && !defined NO_INLINE_GETPASS -+#define GETPASS_H 1 -+#define HAVE_GETPASS 1 -+#define HAS_GETPASS 1 -+#define PASSWORDLEN 512 -+ -+static __inline__ char* getpass(const char* prompt) { -+ // termios struct as in asm-generic/termbits.h -+ struct _termios { -+ unsigned int c_iflag; /* input mode flags */ -+ unsigned int c_oflag; /* output mode flags */ -+ unsigned int c_cflag; /* control mode flags */ -+ unsigned int c_lflag; /* local mode flags */ -+ unsigned char c_line; /* line discipline */ -+ unsigned char c_cc[19/* NCCS */]; /* control characters */ -+ }; -+ -+ struct _termios term_old, term_new; -+ static char password[513] = { 0 }; /* 512 1-byte charactes and '0' */ -+ int len = 0, tty_changed = 0; -+ -+ // print prompt -+ while (*prompt) { -+ write(1, prompt, 1); -+ prompt++; -+ } -+ -+ // try to disable echoing on terminal -+ if (ioctl(0, 0x5401 /* TCGETS */, &term_old) == 0) { -+ term_new = term_old; -+ term_new.c_lflag &= ~0000010;/* ~ECHO */ -+ -+ if (ioctl(0, 0x5402+0 /* TCSETS+TCSANOW */, &term_new) == 0) { -+ tty_changed = 1; -+ } else { -+ tty_changed = 0; -+ } -+ } -+ -+ // read password -+ char chr; -+ while (read(0, &chr, sizeof(char)) > 0) { -+ if (chr == '\r' || chr == '\n' || chr == 0) { -+ break; -+ } -+ -+ if (len == sizeof(password)-1) { -+ // we should consume all entered characters even -+ // if maximal input length reached -+ continue; -+ } else { -+ password[len++] = chr; -+ } -+ } -+ password[len] = 0; -+ -+ // restore terminal to previous state if needed -+ if (tty_changed) { -+ ioctl(0, 0x5402+0 /* TCSETS+TCSANOW */, &term_old); -+ } -+ -+ // force new line -+ write(1, "\n", 1); -+ -+ return password; -+} -+#endif -+ - __END_DECLS - - #include diff --git a/ndk-patches/26b/utmp.h.patch b/ndk-patches/26b/utmp.h.patch deleted file mode 100644 index 51932dd25f870de..000000000000000 --- a/ndk-patches/26b/utmp.h.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ./usr/include/utmp.h.orig 2021-08-16 11:52:08.095542840 +0200 -+++ ./usr/include/utmp.h 2021-08-16 11:52:08.565542673 +0200 -@@ -37,9 +37,9 @@ - #include - #include - --#define _PATH_UTMP "/var/run/utmp" --#define _PATH_WTMP "/var/log/wtmp" --#define _PATH_LASTLOG "/var/log/lastlog" -+#define _PATH_UTMP "@TERMUX_PREFIX@/var/run/utmp" -+#define _PATH_WTMP "@TERMUX_PREFIX@/var/log/wtmp" -+#define _PATH_LASTLOG "@TERMUX_PREFIX@/var/log/lastlog" - - #ifdef __LP64__ - #define UT_NAMESIZE 32 diff --git a/packages/libandroid-stub/build.sh b/packages/libandroid-stub/build.sh index b2700e3ded5d8d6..cc50bfe81e32bdd 100644 --- a/packages/libandroid-stub/build.sh +++ b/packages/libandroid-stub/build.sh @@ -2,9 +2,9 @@ TERMUX_PKG_HOMEPAGE=https://android.googlesource.com/platform/frameworks/base/+/ TERMUX_PKG_DESCRIPTION="Stub libandroid.so for non-Android certified environment" TERMUX_PKG_LICENSE="NCSA" TERMUX_PKG_MAINTAINER="@termux" -TERMUX_PKG_VERSION=26b +TERMUX_PKG_VERSION=25c TERMUX_PKG_SRCURL=https://dl.google.com/android/repository/android-ndk-r${TERMUX_PKG_VERSION}-linux.zip -TERMUX_PKG_SHA256=ad73c0370f0b0a87d1671ed2fd5a9ac9acfd1eb5c43a7fbfbd330f85d19dd632 +TERMUX_PKG_SHA256=769ee342ea75f80619d985c2da990c48b3d8eaf45f48783a2d48870d04b46108 TERMUX_PKG_AUTO_UPDATE=false TERMUX_PKG_CONFLICTS="libandroid" TERMUX_PKG_REPLACES="libandroid" diff --git a/packages/libc++/build.sh b/packages/libc++/build.sh index 6e82ec994cd59f3..e3aacf4317765c2 100644 --- a/packages/libc++/build.sh +++ b/packages/libc++/build.sh @@ -4,9 +4,9 @@ TERMUX_PKG_LICENSE="NCSA" TERMUX_PKG_MAINTAINER="@termux" # Version should be equal to TERMUX_NDK_{VERSION_NUM,REVISION} in # scripts/properties.sh -TERMUX_PKG_VERSION=26b +TERMUX_PKG_VERSION=25c TERMUX_PKG_SRCURL=https://dl.google.com/android/repository/android-ndk-r${TERMUX_PKG_VERSION}-linux.zip -TERMUX_PKG_SHA256=ad73c0370f0b0a87d1671ed2fd5a9ac9acfd1eb5c43a7fbfbd330f85d19dd632 +TERMUX_PKG_SHA256=769ee342ea75f80619d985c2da990c48b3d8eaf45f48783a2d48870d04b46108 TERMUX_PKG_AUTO_UPDATE=false TERMUX_PKG_ESSENTIAL=true TERMUX_PKG_BUILD_IN_SRC=true diff --git a/packages/ndk-multilib/build.sh b/packages/ndk-multilib/build.sh index 63923c58cd88e8a..61c71d74a49c795 100644 --- a/packages/ndk-multilib/build.sh +++ b/packages/ndk-multilib/build.sh @@ -4,9 +4,10 @@ TERMUX_PKG_LICENSE="NCSA" TERMUX_PKG_MAINTAINER="@termux" # Version should be equal to TERMUX_NDK_{VERSION_NUM,REVISION} in # scripts/properties.sh -TERMUX_PKG_VERSION=26b +TERMUX_PKG_VERSION=25c +TERMUX_PKG_REVISION=4 TERMUX_PKG_SRCURL=https://dl.google.com/android/repository/android-ndk-r${TERMUX_PKG_VERSION}-linux.zip -TERMUX_PKG_SHA256=ad73c0370f0b0a87d1671ed2fd5a9ac9acfd1eb5c43a7fbfbd330f85d19dd632 +TERMUX_PKG_SHA256=769ee342ea75f80619d985c2da990c48b3d8eaf45f48783a2d48870d04b46108 TERMUX_PKG_AUTO_UPDATE=false TERMUX_PKG_PLATFORM_INDEPENDENT=true TERMUX_PKG_NO_STATICSPLIT=true @@ -38,11 +39,11 @@ prepare_libs() { done if [ $ARCH == "x86" ]; then - LIBATOMIC=toolchains/llvm/prebuilt/linux-x86_64/lib/clang/*/lib/linux/i386 + LIBATOMIC=toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/*/lib/linux/i386 elif [ $ARCH == "arm64" ]; then - LIBATOMIC=toolchains/llvm/prebuilt/linux-x86_64/lib/clang/*/lib/linux/aarch64 + LIBATOMIC=toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/*/lib/linux/aarch64 else - LIBATOMIC=toolchains/llvm/prebuilt/linux-x86_64/lib/clang/*/lib/linux/$ARCH + LIBATOMIC=toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/*/lib/linux/$ARCH fi cp $LIBATOMIC/libatomic.a $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/$SUFFIX/lib/ @@ -51,7 +52,7 @@ prepare_libs() { } add_cross_compiler_rt() { - RT_PREFIX=toolchains/llvm/prebuilt/linux-x86_64/lib/clang/*/lib/linux + RT_PREFIX=toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/*/lib/linux RT_OPT_DIR=$TERMUX_PREFIX/opt/ndk-multilib/cross-compiler-rt mkdir -p $TERMUX_PKG_MASSAGEDIR/$RT_OPT_DIR cp $RT_PREFIX/* $TERMUX_PKG_MASSAGEDIR/$RT_OPT_DIR || true diff --git a/packages/ndk-sysroot/build.sh b/packages/ndk-sysroot/build.sh index a43b2657fc355da..8400f96288d2418 100644 --- a/packages/ndk-sysroot/build.sh +++ b/packages/ndk-sysroot/build.sh @@ -4,9 +4,9 @@ TERMUX_PKG_LICENSE="NCSA" TERMUX_PKG_MAINTAINER="@termux" # Version should be equal to TERMUX_NDK_{VERSION_NUM,REVISION} in # scripts/properties.sh -TERMUX_PKG_VERSION=26b +TERMUX_PKG_VERSION=25c TERMUX_PKG_SRCURL=https://dl.google.com/android/repository/android-ndk-r${TERMUX_PKG_VERSION}-linux.zip -TERMUX_PKG_SHA256=ad73c0370f0b0a87d1671ed2fd5a9ac9acfd1eb5c43a7fbfbd330f85d19dd632 +TERMUX_PKG_SHA256=769ee342ea75f80619d985c2da990c48b3d8eaf45f48783a2d48870d04b46108 TERMUX_PKG_AUTO_UPDATE=false # This package has taken over from the previous libutil-dev # and iconv.h from libandroid-support-dev: @@ -66,20 +66,29 @@ termux_step_make_install() { cp toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/$TERMUX_HOST_PLATFORM/$TERMUX_PKG_API_LEVEL/*.o \ $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib + if [ $TERMUX_ARCH == "i686" ]; then + LIBATOMIC=toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/*/lib/linux/i386 + elif [ $TERMUX_ARCH == "arm64" ]; then + LIBATOMIC=toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/*/lib/linux/aarch64 + else + LIBATOMIC=toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/*/lib/linux/$TERMUX_ARCH + fi + + cp $LIBATOMIC/libatomic.a $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib/ + cp toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/$TERMUX_HOST_PLATFORM/libcompiler_rt-extras.a \ $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib/ - + # librt and libpthread are built into libc on android, so setup them as symlinks + # to libc for compatibility with programs that users try to build: + local _SYSTEM_LIBDIR=/system/lib64 + if [ $TERMUX_ARCH_BITS = 32 ]; then _SYSTEM_LIBDIR=/system/lib; fi NDK_ARCH=$TERMUX_ARCH test $NDK_ARCH == 'i686' && NDK_ARCH='i386' + mkdir -p $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib # clang 13 requires libunwind on Android. - cp toolchains/llvm/prebuilt/linux-x86_64/lib/clang/17/lib/linux/$NDK_ARCH/libatomic.a \ + cp toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/14.0.7/lib/linux/$NDK_ARCH/libunwind.a \ $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib - cp toolchains/llvm/prebuilt/linux-x86_64/lib/clang/17/lib/linux/$NDK_ARCH/libunwind.a \ - $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib - - # librt and libpthread are built into libc on android, so setup them as symlinks - # to libc for compatibility with programs that users try to build: for lib in librt.so libpthread.so libutil.so; do echo 'INPUT(-lc)' > $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib/$lib done diff --git a/packages/ndk-sysroot/math-header.patch b/packages/ndk-sysroot/math-header.patch index 82065aa27a04cb2..392c191ba3b5570 100644 --- a/packages/ndk-sysroot/math-header.patch +++ b/packages/ndk-sysroot/math-header.patch @@ -1,23 +1,21 @@ ---- ./toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/cmath -+++ ./toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/cmath +--- ./toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/cmath.orig 2023-01-04 23:26:10.402017181 +0100 ++++ ./toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/cmath 2023-01-04 23:27:42.228693072 +0100 @@ -301,7 +301,7 @@ - #include <__type_traits/remove_cv.h> - #include "version" + */ + #include <__config> -#include +#include + #include "version" + #include - #ifndef _LIBCPP_MATH_H - # error tried including but didn't find libc++'s header. \ ---- ./toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/math.h -+++ ./toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/math.h -@@ -297,9 +297,7 @@ - # pragma GCC system_header - #endif +--- ./toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/math.h.orig 2023-01-04 22:39:35.231736330 +0100 ++++ ./toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/math.h 2023-01-04 22:41:40.911748958 +0100 +@@ -300,7 +300,7 @@ + #define _LIBCPP_STDLIB_INCLUDE_NEXT + #include --# if __has_include_next() --# include_next --# endif +-#include_next +#include "../../math.h" #ifdef __cplusplus diff --git a/packages/vulkan-loader-android/build.sh b/packages/vulkan-loader-android/build.sh index 56e1d7c5dd2e03f..2368485993ac8d7 100644 --- a/packages/vulkan-loader-android/build.sh +++ b/packages/vulkan-loader-android/build.sh @@ -2,9 +2,10 @@ TERMUX_PKG_HOMEPAGE=https://source.android.com/devices/graphics/arch-vulkan TERMUX_PKG_DESCRIPTION="Vulkan Loader for Android" TERMUX_PKG_LICENSE="NCSA" TERMUX_PKG_MAINTAINER="@termux" -TERMUX_PKG_VERSION=26b +TERMUX_PKG_VERSION=25c +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=https://dl.google.com/android/repository/android-ndk-r${TERMUX_PKG_VERSION}-linux.zip -TERMUX_PKG_SHA256=ad73c0370f0b0a87d1671ed2fd5a9ac9acfd1eb5c43a7fbfbd330f85d19dd632 +TERMUX_PKG_SHA256=769ee342ea75f80619d985c2da990c48b3d8eaf45f48783a2d48870d04b46108 TERMUX_PKG_AUTO_UPDATE=false TERMUX_PKG_HOSTBUILD=true TERMUX_PKG_BUILD_IN_SRC=true diff --git a/scripts/build/termux_step_setup_toolchain.sh b/scripts/build/termux_step_setup_toolchain.sh index ca3b4c95732c16f..f36c709a7745d8a 100644 --- a/scripts/build/termux_step_setup_toolchain.sh +++ b/scripts/build/termux_step_setup_toolchain.sh @@ -6,9 +6,9 @@ termux_step_setup_toolchain() { # Bump TERMUX_STANDALONE_TOOLCHAIN if a change is made in # toolchain setup to ensure that everyone gets an updated # toolchain - if [ "${TERMUX_NDK_VERSION}" = "26b" ]; then - TERMUX_STANDALONE_TOOLCHAIN+="-v0" - termux_setup_toolchain_26b + if [ "${TERMUX_NDK_VERSION}" = 25c ]; then + TERMUX_STANDALONE_TOOLCHAIN+="-v2" + termux_setup_toolchain_25c elif [ "${TERMUX_NDK_VERSION}" = 23c ]; then TERMUX_STANDALONE_TOOLCHAIN+="-v5" termux_setup_toolchain_23c diff --git a/scripts/build/toolchain/termux_setup_toolchain_26b.sh b/scripts/build/toolchain/termux_setup_toolchain_25c.sh similarity index 96% rename from scripts/build/toolchain/termux_setup_toolchain_26b.sh rename to scripts/build/toolchain/termux_setup_toolchain_25c.sh index 3e775cabdeacc62..4191953d492cfc6 100644 --- a/scripts/build/toolchain/termux_setup_toolchain_26b.sh +++ b/scripts/build/toolchain/termux_setup_toolchain_25c.sh @@ -1,4 +1,4 @@ -termux_setup_toolchain_26b() { +termux_setup_toolchain_25c() { export CFLAGS="" export CPPFLAGS="" export LDFLAGS="-L${TERMUX_PREFIX}/lib" @@ -171,8 +171,8 @@ termux_setup_toolchain_26b() { $_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT-clang.no-16-porting cp $_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT-clang.no-16-porting \ $_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT-clang.16-porting - sed -i 's/"\$@"/--start-no-unused-arguments -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=int-conversion -Wno-error=incompatible-function-pointer-types --end-no-unused-arguments \0/g' \ - $_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT-clang.no-16-porting + sed -i 's/"\$@"/--start-no-unused-arguments -Werror=implicit-function-declaration -Werror=implicit-int -Werror=int-conversion -Werror=incompatible-function-pointer-types --end-no-unused-arguments \0/g' \ + $_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT-clang.16-porting if [ "$TERMUX_PKG_ENABLE_CLANG16_PORTING" = "true" ]; then cp $_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT-clang.16-porting \ $_TERMUX_TOOLCHAIN_TMPDIR/bin/$HOST_PLAT-clang diff --git a/scripts/properties.sh b/scripts/properties.sh index 4341478c2433f25..29500ae46fe7f6a 100644 --- a/scripts/properties.sh +++ b/scripts/properties.sh @@ -9,12 +9,12 @@ TERMUX_ANDROID_BUILD_TOOLS_VERSION=33.0.1 # change TERMUX_PKG_VERSION (and remove TERMUX_PKG_REVISION if necessary) in: # apksigner, d8 # and trigger rebuild of them -: "${TERMUX_NDK_VERSION_NUM:="26"}" -: "${TERMUX_NDK_REVISION:="b"}" +: "${TERMUX_NDK_VERSION_NUM:="25"}" +: "${TERMUX_NDK_REVISION:="c"}" TERMUX_NDK_VERSION=$TERMUX_NDK_VERSION_NUM$TERMUX_NDK_REVISION # when changing the above: # update version and hashsum in packages -# libandroid-stub, libc++, ndk-multilib, ndk-sysroot, vulkan-loader-android +# libc++, ndk-multilib, ndk-sysroot, vulkan-loader-android # and update SHA256 sums in scripts/setup-android-sdk.sh # check all packages build and run correctly and bump if needed diff --git a/scripts/setup-android-sdk.sh b/scripts/setup-android-sdk.sh index 691d24906dbedd1..7bb6359971184d4 100755 --- a/scripts/setup-android-sdk.sh +++ b/scripts/setup-android-sdk.sh @@ -10,9 +10,9 @@ set -e -u ANDROID_SDK_FILE=commandlinetools-linux-${TERMUX_SDK_REVISION}_latest.zip ANDROID_SDK_SHA256=0bebf59339eaa534f4217f8aa0972d14dc49e7207be225511073c661ae01da0a -if [ "$TERMUX_NDK_VERSION" = "26b" ]; then +if [ "$TERMUX_NDK_VERSION" = 25c ]; then ANDROID_NDK_FILE=android-ndk-r${TERMUX_NDK_VERSION}-linux.zip - ANDROID_NDK_SHA256=ad73c0370f0b0a87d1671ed2fd5a9ac9acfd1eb5c43a7fbfbd330f85d19dd632 + ANDROID_NDK_SHA256=769ee342ea75f80619d985c2da990c48b3d8eaf45f48783a2d48870d04b46108 elif [ "$TERMUX_NDK_VERSION" = 23c ]; then ANDROID_NDK_FILE=android-ndk-r${TERMUX_NDK_VERSION}-linux.zip ANDROID_NDK_SHA256=6ce94604b77d28113ecd588d425363624a5228d9662450c48d2e4053f8039242