chiark / gitweb /
libandroid-support: 32-bit build same as 64-bit
authorFredrik Fornwall <fredrik@fornwall.net>
Sun, 13 Mar 2016 22:13:26 +0000 (18:13 -0400)
committerFredrik Fornwall <fredrik@fornwall.net>
Sun, 13 Mar 2016 22:13:26 +0000 (18:13 -0400)
Fixes e.g. wide character problems with the fish shell.

packages/libandroid-support/build.sh
packages/libandroid-support/setlocale.c.patch32 [deleted file]

index 30ab92cffec34ee4415c33762bfee5f29a78ed3f..992dfb2bd6d949b3901150c53d92e1d0b3205bc1 100755 (executable)
@@ -1,42 +1,22 @@
 TERMUX_PKG_HOMEPAGE=https://developer.android.com/tools/sdk/ndk/index.html
 TERMUX_PKG_DESCRIPTION="Library extending the Android C library (Bionic) for additional multibyte, locale and math support"
 # Increase last digit each time a patch changes.
-TERMUX_PKG_VERSION=${TERMUX_NDK_VERSION}.4
+TERMUX_PKG_VERSION=${TERMUX_NDK_VERSION}.5
 TERMUX_PKG_BUILD_IN_SRC=yes
 TERMUX_PKG_ESSENTIAL=yes
 
 termux_step_post_extract_package () {
         cd $TERMUX_PKG_SRCDIR
-       if [ "$TERMUX_ARCH_BITS" = "64" ]; then
-               # https://android.googlesource.com/platform/ndk.git/+/7c811775212f8ae0ecdcf60d05fefb1582207038
-               # For 64-bit bionic has almost everything except the following:
-               mkdir -p src/musl-locale/ src/musl-multibyte/ include/
-               cp $NDK/sources/android/support/src/musl-multibyte/mblen.c src/musl-multibyte/
-               cp $NDK/sources/android/support/src/musl-locale/{catclose.c,catgets.c,catopen.c} src/musl-locale/
-               cp $NDK/sources/android/support/src/musl-locale/{langinfo.c,intl.c,iconv.c} src/musl-locale/
-               cp $NDK/sources/android/support/include/* include/
-               cp $NDK/sources/android/support/src/musl-locale/{libc.h,codepages.h,legacychars.h,jis0208.h,gb18030.h,big5.h,hkscs.h,ksc.h} include/
-       else
-               cp -Rf $NDK/sources/android/support/* .
-               # See Android.mk for files not to build:
-               rm      src/musl-stdio/vwscanf.c \
-                       src/musl-stdio/wscanf.c \
-                       src/musl-locale/newlocale.c \
-                       src/musl-locale/nl_langinfo_l.c \
-                       src/musl-locale/strcoll_l.c \
-                       src/musl-locale/strxfrm_l.c \
-                       src/musl-locale/wcscoll_l.c \
-                       src/musl-locale/wcsxfrm_l.c \
-                       src/locale/uselocale.c
-       fi
+       mkdir -p src/musl-locale/ src/musl-multibyte/ include/
+       cp $NDK/sources/android/support/src/musl-multibyte/mblen.c src/musl-multibyte/
+       cp $NDK/sources/android/support/src/musl-locale/{catclose.c,catgets.c,catopen.c} src/musl-locale/
+       cp $NDK/sources/android/support/src/musl-locale/{langinfo.c,intl.c,iconv.c} src/musl-locale/
+       cp $NDK/sources/android/support/include/* include/
+       cp $NDK/sources/android/support/src/musl-locale/{libc.h,codepages.h,legacychars.h,jis0208.h,gb18030.h,big5.h,hkscs.h,ksc.h} include/
 }
 
 termux_step_make_install () {
-       if [ "$TERMUX_ARCH_BITS" = "64" ]; then
-               _C_FILES="src/musl-*/*.c"
-       else
-               _C_FILES="src/locale/*.c src/musl-*/*.c src/stdio/*.c src/*.c"
-       fi
+       _C_FILES="src/musl-*/*.c"
        # Link against libm to avoid linkers having to do it
         $CC $CFLAGS -std=c99 -DNULL=0 $CPPFLAGS $LDFLAGS -lm \
                 -Iinclude -Isrc/locale \
diff --git a/packages/libandroid-support/setlocale.c.patch32 b/packages/libandroid-support/setlocale.c.patch32
deleted file mode 100644 (file)
index e2edef3..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-diff -u -r /home/fornwall/lib/android-ndk/sources/android/support/src/locale/setlocale.c ./src/locale/setlocale.c
---- /home/fornwall/lib/android-ndk/sources/android/support/src/locale/setlocale.c      2013-07-26 23:37:59.000000000 -0400
-+++ ./src/locale/setlocale.c   2015-01-01 17:16:29.488323212 -0500
-@@ -25,23 +25,18 @@
-  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-  * SUCH DAMAGE.
-  */
--#include <errno.h>
-+#include <string.h>
- #include "locale_impl.h"
- char *setlocale(int category, const char *locale) {
--  // Sanity check.
--  if (locale == NULL) {
--    errno = EINVAL;
--    return NULL;
--  }
--  // Only accept "", "C" or "POSIX", all equivalent on Android.
--  if (*locale && strcmp(locale, "C") && strcmp(locale, "POSIX")) {
--    errno = EINVAL;
--    return NULL;
--  }
-+  // setlocale(3): "If locale is NULL, the current locale is only queried, not modified."
-+  if (locale == NULL) return "en_US.UTF-8";
-+
-+  // Only accept "", "C" or "POSIX", all equivalent on Android, and any locale with UTF-8/UTF8 in it.
-+  if (*locale && strcmp(locale, "C") && strcmp(locale, "POSIX") && strstr(locale, "UTF-8") == 0 && strstr(locale, "UTF8") == 0) return NULL;
-+
-   // The function returns a char* but the caller is not supposed to
-   // modify it. Just to a type cast. If the caller tries to write to
-   // it, it will simply segfault.
--  static const char C_LOCALE_SETTING[] = "C";
--  return (char*) C_LOCALE_SETTING;
-+  return "en_US.UTF-8";
- }