Commit | Line | Data |
---|---|---|
59f0d218 FF |
1 | TERMUX_PKG_HOMEPAGE=https://developer.android.com/tools/sdk/ndk/index.html |
2 | TERMUX_PKG_DESCRIPTION="Library extending the Android C library (Bionic) for additional multibyte, locale and math support" | |
3 | # Increase last digit each time a patch changes. | |
fa85bc7b | 4 | TERMUX_PKG_VERSION=${TERMUX_NDK_VERSION}.4 |
59f0d218 FF |
5 | TERMUX_PKG_BUILD_IN_SRC=yes |
6 | TERMUX_PKG_ESSENTIAL=yes | |
7 | ||
8 | termux_step_post_extract_package () { | |
9 | cd $TERMUX_PKG_SRCDIR | |
8f7dda83 FF |
10 | if [ "$TERMUX_ARCH_BITS" = "64" ]; then |
11 | # https://android.googlesource.com/platform/ndk.git/+/7c811775212f8ae0ecdcf60d05fefb1582207038 | |
12 | # For 64-bit bionic has almost everything except the following: | |
ce2a8eac FF |
13 | mkdir -p src/musl-locale/ src/musl-multibyte/ include/ |
14 | cp $NDK/sources/android/support/src/musl-multibyte/mblen.c src/musl-multibyte/ | |
8f7dda83 | 15 | cp $NDK/sources/android/support/src/musl-locale/{catclose.c,catgets.c,catopen.c} src/musl-locale/ |
12f6ac00 | 16 | cp $NDK/sources/android/support/src/musl-locale/{langinfo.c,intl.c,iconv.c} src/musl-locale/ |
8f7dda83 | 17 | cp $NDK/sources/android/support/include/* include/ |
12f6ac00 | 18 | 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/ |
8f7dda83 FF |
19 | else |
20 | cp -Rf $NDK/sources/android/support/* . | |
21 | # See Android.mk for files not to build: | |
22 | rm src/musl-stdio/vwscanf.c \ | |
23 | src/musl-stdio/wscanf.c \ | |
24 | src/musl-locale/newlocale.c \ | |
25 | src/musl-locale/nl_langinfo_l.c \ | |
26 | src/musl-locale/strcoll_l.c \ | |
27 | src/musl-locale/strxfrm_l.c \ | |
28 | src/musl-locale/wcscoll_l.c \ | |
c8c9d0b8 FF |
29 | src/musl-locale/wcsxfrm_l.c \ |
30 | src/locale/uselocale.c | |
8f7dda83 | 31 | fi |
59f0d218 FF |
32 | } |
33 | ||
34 | termux_step_make_install () { | |
8f7dda83 FF |
35 | if [ "$TERMUX_ARCH_BITS" = "64" ]; then |
36 | _C_FILES="src/musl-*/*.c" | |
37 | else | |
38 | _C_FILES="src/locale/*.c src/musl-*/*.c src/stdio/*.c src/*.c" | |
39 | fi | |
59f0d218 FF |
40 | # Link against libm to avoid linkers having to do it |
41 | $CC $CFLAGS -std=c99 -DNULL=0 $CPPFLAGS $LDFLAGS -lm \ | |
42 | -Iinclude -Isrc/locale \ | |
8f7dda83 | 43 | $_C_FILES \ |
59f0d218 FF |
44 | -shared -fpic \ |
45 | -o libandroid-support.so | |
46 | ||
47 | cp libandroid-support.so $TERMUX_PREFIX/lib/ | |
48 | ||
49 | (cd $TERMUX_PREFIX/lib; rm -f libiconv.so libintl.so; ln -s libandroid-support.so libiconv.so; ln -s libandroid-support.so libintl.so) | |
50 | ||
51 | rm -Rf $TERMUX_PREFIX/include/libandroid-support | |
52 | mkdir -p $TERMUX_PREFIX/include/libandroid-support | |
53 | cp -Rf include/* $TERMUX_PREFIX/include/libandroid-support/ | |
54 | ||
55 | (cd $TERMUX_PREFIX/include; rm -f libintl.h iconv.h; ln -s libandroid-support/libintl.h libintl.h; ln -s libandroid-support/iconv.h iconv.h) | |
56 | } |