From 54975d7db5d4e2442f983158c9b51745e400b27f Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Fri, 7 May 2021 07:58:58 +0200 Subject: [PATCH] ndk-headers: fix paths in utmp.h And bump toolchain and ndk-sysroot. Also update patch offsets while we are at it. --- ndk-patches/linux-fcntl.h.patch | 2 +- ndk-patches/stdio.h.patch | 6 +++--- ndk-patches/stdlib.h.patch | 2 +- ndk-patches/unistd.h.patch | 6 ++---- ndk-patches/utmp.h.patch | 15 +++++++++++++++ packages/ndk-sysroot/build.sh | 1 + packages/ndk-sysroot/math-header.diff | 10 +++++----- scripts/build/termux_step_start_build.sh | 2 +- 8 files changed, 29 insertions(+), 15 deletions(-) create mode 100644 ndk-patches/utmp.h.patch diff --git a/ndk-patches/linux-fcntl.h.patch b/ndk-patches/linux-fcntl.h.patch index 421a39d03..a3472b35d 100644 --- a/ndk-patches/linux-fcntl.h.patch +++ b/ndk-patches/linux-fcntl.h.patch @@ -1,7 +1,7 @@ diff -uNr sysroot.orig/usr/include/linux/fcntl.h sysroot/usr/include/linux/fcntl.h --- sysroot.orig/usr/include/linux/fcntl.h 2019-02-12 16:12:24.000000000 +0000 +++ sysroot/usr/include/linux/fcntl.h 2019-03-20 13:22:32.823142545 +0000 -@@ -50,6 +50,12 @@ +@@ -51,6 +51,12 @@ #define DN_ATTRIB 0x00000020 #define DN_MULTISHOT 0x80000000 #define AT_FDCWD - 100 diff --git a/ndk-patches/stdio.h.patch b/ndk-patches/stdio.h.patch index 9d276e4fd..64a267a41 100644 --- a/ndk-patches/stdio.h.patch +++ b/ndk-patches/stdio.h.patch @@ -25,7 +25,7 @@ diff -uNr ./usr.old/include/stdio.h ./usr/include/stdio.h char* tempnam(const char* __dir, const char* __prefix) __warnattr("tempnam is unsafe, use mkstemp or tmpfile instead"); -@@ -241,8 +242,6 @@ +@@ -289,8 +290,6 @@ FILE* freopen64(const char* __path, const char* __mode, FILE* __fp) __INTRODUCED_IN(24); #endif /* __ANDROID_API__ >= 24 */ @@ -34,7 +34,7 @@ diff -uNr ./usr.old/include/stdio.h ./usr/include/stdio.h #if __ANDROID_API__ >= 24 FILE* tmpfile64(void) __INTRODUCED_IN(24); #endif /* __ANDROID_API__ >= 24 */ -@@ -256,10 +255,15 @@ +@@ -304,10 +303,15 @@ #define L_ctermid 1024 /* size for ctermid() */ @@ -53,7 +53,7 @@ diff -uNr ./usr.old/include/stdio.h ./usr/include/stdio.h FILE* fdopen(int __fd, const char* __mode); int fileno(FILE* __fp); -@@ -328,6 +332,30 @@ +@@ -376,6 +380,30 @@ #include #endif diff --git a/ndk-patches/stdlib.h.patch b/ndk-patches/stdlib.h.patch index 475d1ddd5..9ef1371c2 100644 --- a/ndk-patches/stdlib.h.patch +++ b/ndk-patches/stdlib.h.patch @@ -9,7 +9,7 @@ diff -uNr sysroot.orig/usr/include/stdlib.h sysroot/usr/include/stdlib.h #include #include -@@ -211,8 +212,7 @@ +@@ -224,8 +225,7 @@ size_t wcstombs(char* __dst, const wchar_t* __src, size_t __n); #if __ANDROID_API__ >= __ANDROID_API_L__ diff --git a/ndk-patches/unistd.h.patch b/ndk-patches/unistd.h.patch index 9e9339dce..4b7a4ce56 100644 --- a/ndk-patches/unistd.h.patch +++ b/ndk-patches/unistd.h.patch @@ -1,7 +1,7 @@ --- sysroot/usr/include/unistd.h 2018-04-30 19:24:22.000000000 +0000 +++ usr/include/unistd.h 2018-08-16 10:42:51.158596753 +0000 -@@ -302,6 +302,74 @@ - #include +@@ -377,4 +377,72 @@ + #undef _UNISTD_H_ #endif +#if !defined GETPASS_H && !defined getpass && !defined HAVE_GETPASS && !defined HAS_GETPASS && !defined NO_INLINE_GETPASS @@ -73,5 +73,3 @@ +#endif + __END_DECLS - - #endif diff --git a/ndk-patches/utmp.h.patch b/ndk-patches/utmp.h.patch new file mode 100644 index 000000000..45cc642e2 --- /dev/null +++ b/ndk-patches/utmp.h.patch @@ -0,0 +1,15 @@ +--- sysroot/usr/include/utmp.h 2021-05-07 05:45:33.518467959 +0000 ++++ usr/include/utmp.h 2021-05-07 05:46:25.195022662 +0000 +@@ -32,9 +32,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/ndk-sysroot/build.sh b/packages/ndk-sysroot/build.sh index 490acc0aa..374cdbb5b 100644 --- a/packages/ndk-sysroot/build.sh +++ b/packages/ndk-sysroot/build.sh @@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="System header and library files from the Android NDK nee TERMUX_PKG_LICENSE="NCSA" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=$TERMUX_NDK_VERSION +TERMUX_PKG_REVISION=1 TERMUX_PKG_SKIP_SRC_EXTRACT=true # This package has taken over from the previous libutil-dev # and iconv.h from libandroid-support-dev: diff --git a/packages/ndk-sysroot/math-header.diff b/packages/ndk-sysroot/math-header.diff index 391099a00..e597cd1fc 100644 --- a/packages/ndk-sysroot/math-header.diff +++ b/packages/ndk-sysroot/math-header.diff @@ -1,19 +1,19 @@ --- data/data/com.termux/files/usr/include/c++/v1/cmath.orig 2019-03-24 00:31:49.512145195 +0000 +++ ./cmath 2019-03-24 00:32:19.392703442 +0000 -@@ -302,7 +302,7 @@ +@@ -301,7 +301,7 @@ */ #include <__config> -#include +#include #include "version" + #include - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) --- data/data/com.termux/files/usr/include/c++/v1/math.h.orig 2019-03-24 01:10:28.881807799 +0000 +++ ./math.h 2019-03-24 01:11:01.078384393 +0000 -@@ -298,7 +298,7 @@ - #pragma GCC system_header - #endif +@@ -300,7 +300,7 @@ + #define _LIBCPP_STDLIB_INCLUDE_NEXT + #include -#include_next +#include "../../math.h" diff --git a/scripts/build/termux_step_start_build.sh b/scripts/build/termux_step_start_build.sh index fb12b0235..ffcdb5232 100644 --- a/scripts/build/termux_step_start_build.sh +++ b/scripts/build/termux_step_start_build.sh @@ -2,7 +2,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+="-v3" + TERMUX_STANDALONE_TOOLCHAIN+="-v4" # shellcheck source=/dev/null source "$TERMUX_PKG_BUILDER_SCRIPT"