Drop -D_FILE_OFFSET_BITS=64 support for now
authorFredrik Fornwall <fredrik@fornwall.net>
Fri, 7 Jul 2017 01:52:46 +0000 (03:52 +0200)
committerFredrik Fornwall <fredrik@fornwall.net>
Fri, 7 Jul 2017 01:52:46 +0000 (03:52 +0200)
32-bit android uses 32-bit off_t by default. When building with
-D_FILE_OFFSET_BITS=64 with unified headers off_t are promoted
to 64-bit, but there are bugs in the toolchain and spotty support
for it in the platform (not all functions are available until
android-24, and the platform zlib is compiled with 32-bit off_t).

Also, unless every library&program is rebuilt with 64-bit off_t,
including user-built ones, we risk a mismatch between programs and
libraries which can cause serious (but sometimes subtle) runtime
failures.

As -D_FILE_OFFSET_BITS=64 is not that important for most users
(with mariadb requiring it as an exception), we drop the support
for now by patching it away in <sys/cdefs.h>.

build-package.sh
ndk-patches/sys-cdefs.h.patch [new file with mode: 0644]
packages/coreutils/build.sh
packages/mariadb/build.sh
packages/ndk-sysroot/build.sh
packages/openssh/build.sh

index a382020..b387181 100755 (executable)
@@ -221,7 +221,7 @@ termux_step_setup_variables() {
        TERMUX_STANDALONE_TOOLCHAIN="$TERMUX_TOPDIR/_lib/${TERMUX_NDK_VERSION}-${TERMUX_ARCH}-${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+="-v5"
+       TERMUX_STANDALONE_TOOLCHAIN+="-v6"
 
        export prefix=${TERMUX_PREFIX}
        export PREFIX=${TERMUX_PREFIX}
@@ -451,7 +451,7 @@ termux_step_setup_toolchain() {
        # We put this after system PATH to avoid picking up toolchain stripped python
        export PATH=$PATH:$TERMUX_STANDALONE_TOOLCHAIN/bin
 
-       export CFLAGS=""
+       export CFLAGS="" #-Werror=implicit-function-declaration"
        export LDFLAGS="-L${TERMUX_PREFIX}/lib"
 
        if [ "$TERMUX_PKG_CLANG" = "no" ]; then
@@ -516,6 +516,7 @@ termux_step_setup_toolchain() {
        export ac_cv_func_getpwent=no
        export ac_cv_func_getpwnam=no
        export ac_cv_func_getpwuid=no
+       export ac_cv_func_sigsetmask=no
 
        if [ ! -d $TERMUX_STANDALONE_TOOLCHAIN ]; then
                # Do not put toolchain in place until we are done with setup, to avoid having a half setup
diff --git a/ndk-patches/sys-cdefs.h.patch b/ndk-patches/sys-cdefs.h.patch
new file mode 100644 (file)
index 0000000..3842b33
--- /dev/null
@@ -0,0 +1,17 @@
+diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/sys/cdefs.h ./usr/include/sys/cdefs.h
+--- /home/fornwall/lib/android-ndk/sysroot/usr/include/sys/cdefs.h     2017-06-20 17:41:56.000000000 +0200
++++ ./usr/include/sys/cdefs.h  2017-07-07 03:27:59.327850834 +0200
+@@ -234,13 +234,6 @@
+ # define __USE_BSD 1
+ #endif
+-/* _FILE_OFFSET_BITS 64 support. */
+-#if !defined(__LP64__) && defined(_FILE_OFFSET_BITS)
+-#if _FILE_OFFSET_BITS == 64
+-#define __USE_FILE_OFFSET64 1
+-#endif
+-#endif
+-
+ #define  __BIONIC__   1
+ #include <android/api-level.h>
index 47556be..c1ea396 100755 (executable)
@@ -1,7 +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.27
-TERMUX_PKG_REVISION=1
+TERMUX_PKG_REVISION=2
 TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/coreutils/coreutils-${TERMUX_PKG_VERSION}.tar.xz
 TERMUX_PKG_SHA256=8891d349ee87b9ff7870f52b6d9312a9db672d2439d289bc57084771ca21656b
 # pinky has no usage on Android.
index 9035f4f..a27bfd7 100644 (file)
@@ -46,6 +46,9 @@ TERMUX_PKG_DEPENDS="liblzma, ncurses, libedit, openssl, pcre, libcrypt, libandro
 TERMUX_PKG_MAINTAINER="Vishal Biswas @vishalbiswas"
 TERMUX_PKG_CONFLICTS="mysql"
 TERMUX_PKG_RM_AFTER_INSTALL="bin/mysqltest*"
+# Does not build with 32-bit off_t, and Termux does not use
+# _FILE_OFFSET_BITS=64 as it doesn't work very well on Android.
+TERMUX_PKG_BLACKLISTED_ARCHES="arm,i686"
 
 termux_step_host_build () {
        termux_setup_cmake
@@ -59,7 +62,7 @@ termux_step_host_build () {
 termux_step_pre_configure () {
        # it will try to define off64_t with off_t if unset
        # and 32 bit Android has wrong off_t defined
-       CPPFLAGS="$CPPFLAGS -Dushort=u_short -D__off64_t_defined"
+       CPPFLAGS="$CPPFLAGS -Dushort=u_short"
 
        if [ $TERMUX_ARCH = "i686" ]; then
                # Avoid undefined reference to __atomic_load_8:
index 549b5b7..6500d3b 100644 (file)
@@ -1,7 +1,7 @@
 TERMUX_PKG_HOMEPAGE=https://developer.android.com/tools/sdk/ndk/index.html
 TERMUX_PKG_DESCRIPTION="System header and library files from the Android NDK needed for compiling C programs"
 TERMUX_PKG_VERSION=$TERMUX_NDK_VERSION
-TERMUX_PKG_REVISION=1
+TERMUX_PKG_REVISION=2
 TERMUX_PKG_NO_DEVELSPLIT=yes
 # Depend on libandroid-support-dev so that iconv.h and libintl.h are available:
 TERMUX_PKG_DEPENDS="libandroid-support-dev"
index 34d21e3..7aa80b9 100755 (executable)
@@ -1,7 +1,7 @@
 TERMUX_PKG_HOMEPAGE=https://www.openssh.com/
 TERMUX_PKG_DESCRIPTION="Secure shell for logging into a remote machine"
 TERMUX_PKG_VERSION=7.5p1
-TERMUX_PKG_REVISION=2
+TERMUX_PKG_REVISION=3
 TERMUX_PKG_SRCURL=http://mirrors.evowise.com/pub/OpenBSD/OpenSSH/portable/openssh-${TERMUX_PKG_VERSION}.tar.gz
 TERMUX_PKG_SHA256=9846e3c5fab9f0547400b4d2c017992f914222b3fd1f8eee6c7dc6bc5e59f9f0
 TERMUX_PKG_DEPENDS="libandroid-support, ldns, openssl, libedit, libutil"