libandroid-support: 32-bit build same as 64-bit
Fixes e.g. wide character problems with the fish shell.
This commit is contained in:
parent
c8b6264e23
commit
0c1ada1f25
@ -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 \
|
||||
|
@ -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";
|
||||
}
|
Loading…
Reference in New Issue
Block a user