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: | |
13 | mkdir -p src/musl-locale/ include/ | |
14 | cp $NDK/sources/android/support/src/musl-locale/{catclose.c,catgets.c,catopen.c} src/musl-locale/ | |
15 | cp $NDK/sources/android/support/include/* include/ | |
16 | else | |
17 | cp -Rf $NDK/sources/android/support/* . | |
18 | # See Android.mk for files not to build: | |
19 | rm src/musl-stdio/vwscanf.c \ | |
20 | src/musl-stdio/wscanf.c \ | |
21 | src/musl-locale/newlocale.c \ | |
22 | src/musl-locale/nl_langinfo_l.c \ | |
23 | src/musl-locale/strcoll_l.c \ | |
24 | src/musl-locale/strxfrm_l.c \ | |
25 | src/musl-locale/wcscoll_l.c \ | |
c8c9d0b8 FF |
26 | src/musl-locale/wcsxfrm_l.c \ |
27 | src/locale/uselocale.c | |
8f7dda83 | 28 | fi |
59f0d218 FF |
29 | } |
30 | ||
31 | termux_step_make_install () { | |
8f7dda83 FF |
32 | if [ "$TERMUX_ARCH_BITS" = "64" ]; then |
33 | _C_FILES="src/musl-*/*.c" | |
34 | else | |
35 | _C_FILES="src/locale/*.c src/musl-*/*.c src/stdio/*.c src/*.c" | |
36 | fi | |
59f0d218 FF |
37 | # Link against libm to avoid linkers having to do it |
38 | $CC $CFLAGS -std=c99 -DNULL=0 $CPPFLAGS $LDFLAGS -lm \ | |
39 | -Iinclude -Isrc/locale \ | |
8f7dda83 | 40 | $_C_FILES \ |
59f0d218 FF |
41 | -shared -fpic \ |
42 | -o libandroid-support.so | |
43 | ||
44 | cp libandroid-support.so $TERMUX_PREFIX/lib/ | |
45 | ||
46 | (cd $TERMUX_PREFIX/lib; rm -f libiconv.so libintl.so; ln -s libandroid-support.so libiconv.so; ln -s libandroid-support.so libintl.so) | |
47 | ||
48 | rm -Rf $TERMUX_PREFIX/include/libandroid-support | |
49 | mkdir -p $TERMUX_PREFIX/include/libandroid-support | |
50 | cp -Rf include/* $TERMUX_PREFIX/include/libandroid-support/ | |
51 | ||
52 | (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) | |
53 | } |