From 627fdeb1628e78ae5c617c0e137b375daa4dbe37 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Sat, 7 Jan 2017 01:45:46 -0500 Subject: [PATCH] ndk_patches: Define _POSIX2_VERSION to 200809 coreutils looks at _POSIX2_VERSION and enables broken obsolete behaviour if not set. Fixes https://github.com/termux/termux-app/issues/232. --- build-package.sh | 2 +- ndk_patches/sys-limits.h.patch | 12 ++++++++++++ packages/coreutils/build.sh | 1 + packages/coreutils/tests/tails-c-flag.sh | 7 +++++++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 ndk_patches/sys-limits.h.patch create mode 100644 packages/coreutils/tests/tails-c-flag.sh diff --git a/build-package.sh b/build-package.sh index 6dc2cf9ad..93c8bdc43 100755 --- a/build-package.sh +++ b/build-package.sh @@ -187,7 +187,7 @@ termux_step_setup_variables() { TERMUX_STANDALONE_TOOLCHAIN="$TERMUX_TOPDIR/_lib/toolchain-${TERMUX_ARCH}-ndk${TERMUX_NDK_VERSION}-api${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+="-v3" + TERMUX_STANDALONE_TOOLCHAIN+="-v4" export TERMUX_TAR="tar" export TERMUX_TOUCH="touch" diff --git a/ndk_patches/sys-limits.h.patch b/ndk_patches/sys-limits.h.patch new file mode 100644 index 000000000..3a2de4959 --- /dev/null +++ b/ndk_patches/sys-limits.h.patch @@ -0,0 +1,12 @@ +diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm64/usr/include/sys/limits.h ./usr/include/sys/limits.h +--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm64/usr/include/sys/limits.h 2016-09-29 14:42:26.000000000 -0400 ++++ ./usr/include/sys/limits.h 2017-01-07 01:23:19.004048281 -0500 +@@ -116,7 +116,7 @@ + /* Bionic-specific definitions */ + + #define _POSIX_VERSION 200112L /* 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 _POSIX2_C_VERSION _POSIX_VERSION + #define _XOPEN_VERSION 500 /* by Posix definition */ + #define _XOPEN_XCU_VERSION -1 /* we don't support command-line utilities */ diff --git a/packages/coreutils/build.sh b/packages/coreutils/build.sh index f392a18fd..1977e902d 100755 --- a/packages/coreutils/build.sh +++ b/packages/coreutils/build.sh @@ -1,6 +1,7 @@ TERMUX_PKG_HOMEPAGE=https://www.gnu.org/software/coreutils/ TERMUX_PKG_DESCRIPTION="Basic file, shell and text manipulation utilities from the GNU project" TERMUX_PKG_VERSION=8.26 +TERMUX_PKG_BUILD_REVISION=1 TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/coreutils/coreutils-${TERMUX_PKG_VERSION}.tar.xz TERMUX_PKG_SHA256=155e94d748f8e2bc327c66e0cbebdb8d6ab265d2f37c3c928f7bf6c3beba9a8e TERMUX_PKG_EXTRA_CONFIGURE_ARGS="ac_cv_func_mkfifo=yes gl_cv_host_operating_system=Android --without-gmp --enable-single-binary=symlinks ac_cv_func_endpwent=no" diff --git a/packages/coreutils/tests/tails-c-flag.sh b/packages/coreutils/tests/tails-c-flag.sh new file mode 100644 index 000000000..1993d1a82 --- /dev/null +++ b/packages/coreutils/tests/tails-c-flag.sh @@ -0,0 +1,7 @@ +set -e -u + +RESULT=$(echo -n 123456 | tail -c 3) +if [ "$RESULT" != 456 ]; then + echo "Test failed - expectd 456, got $RESULT" + exit 1 +fi