Browse Source

Fix incorrect struct __sFILE

The __sFILE struct cannot change size when _FILE_OFFSET_BITS=64
is set as it is an API into libc.
android-5
Fredrik Fornwall 8 years ago
parent
commit
bda6056389
  1. 2
      build-package.sh
  2. 12
      ndk-patches/bits-struct_file.h.patch
  3. 1
      packages/ndk-sysroot/build.sh

2
build-package.sh

@ -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}

12
ndk-patches/bits-struct_file.h.patch

@ -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 */

1
packages/ndk-sysroot/build.sh

@ -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"

Loading…
Cancel
Save