chiark / gitweb /
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 142d6c0cb1ddab46beee0bef6b37b1eea8705c14..a382020d7d86d3c7f2cf42ace9d645c0068f7e43 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 87c7109b40ec5a6fb9d649c03035fc5075f5455f..f4aae0f823802c6031ed9fe9a440481c36577618 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
  
@@ -16,6 +16,12 @@ diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/bits/struct_file.h
 +      int     _size;
 +};
 +#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 */
@@ -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 218a0f07289f9a25824cbdefb7fe61d445e777b8..549b5b78075fe23b603a4c335b498ed049d5be72 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"