Fix incorrect struct __sFILE
authorFredrik Fornwall <fredrik@fornwall.net>
Sun, 2 Jul 2017 23:27:32 +0000 (01:27 +0200)
committerFredrik Fornwall <fredrik@fornwall.net>
Sun, 2 Jul 2017 23:27:32 +0000 (01:27 +0200)
The __sFILE struct cannot change size when _FILE_OFFSET_BITS=64
is set as it is an API into libc.

build-package.sh
ndk-patches/bits-struct_file.h.patch
packages/ndk-sysroot/build.sh

index 142d6c0..a382020 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+="-v4"
+       TERMUX_STANDALONE_TOOLCHAIN+="-v5"
 
        export prefix=${TERMUX_PREFIX}
        export PREFIX=${TERMUX_PREFIX}
index 87c7109..f4aae0f 100644 (file)
@@ -1,7 +1,7 @@
 diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/bits/struct_file.h ./usr/include/bits/struct_file.h
 --- /home/fornwall/lib/android-ndk/sysroot/usr/include/bits/struct_file.h      2017-06-20 17:41:56.000000000 +0200
 +++ ./usr/include/bits/struct_file.h   2017-06-26 13:35:19.040117023 +0200
-@@ -33,13 +33,74 @@
+@@ -33,13 +33,80 @@
  
  __BEGIN_DECLS
  
@@ -17,6 +17,12 @@ diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/bits/struct_file.h
 +};
 +#endif
 +
++#if defined(__LP64__)
++typedef int64_t _struct_file_off_t;
++#else
++typedef __kernel_off_t _struct_file_off_t;
++#endif
++
  struct __sFILE {
 +      unsigned char *_p;      /* current position in (some) buffer */
 +      int     _r;             /* read space left for getc() */
@@ -38,7 +44,7 @@ diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/bits/struct_file.h
 +      void    *_cookie;       /* cookie passed to io functions */
 +      int     (*_close)(void *);
 +      int     (*_read)(void *, char *, int);
-+      off_t   (*_seek)(void *, off_t, 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 */
@@ -56,7 +62,7 @@ diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/bits/struct_file.h
 +
 +      /* Unix stdio files get aligned to block boundaries on fseek() */
 +      int     _blksize;       /* stat.st_blksize (may be != _bf._size) */
-+      off_t   _offset;        /* current lseek offset */
++      _struct_file_off_t      _offset;        /* current lseek offset */
 +};
 +
 +#define       __SLBF  0x0001          /* line buffered */
index 218a0f0..549b5b7 100644 (file)
@@ -1,6 +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_NO_DEVELSPLIT=yes
 # Depend on libandroid-support-dev so that iconv.h and libintl.h are available:
 TERMUX_PKG_DEPENDS="libandroid-support-dev"