| 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. |
| 4 | TERMUX_PKG_VERSION=${TERMUX_NDK_VERSION}.10 |
| 5 | TERMUX_PKG_BUILD_IN_SRC=yes |
| 6 | TERMUX_PKG_ESSENTIAL=yes |
| 7 | |
| 8 | termux_step_post_extract_package () { |
| 9 | mkdir -p src/musl-locale/ src/musl-multibyte/ include/ src/musl-ctype/ |
| 10 | cp $NDK/sources/android/support/src/musl-multibyte/{mblen.c,mbsrtowcs.c,mbsnrtowcs.c,libc.h,internal.h,internal.c} src/musl-multibyte/ |
| 11 | cp $NDK/sources/android/support/src/musl-locale/{catclose.c,catgets.c,catopen.c} src/musl-locale/ |
| 12 | cp $NDK/sources/android/support/src/musl-locale/{langinfo.c,intl.c,iconv.c,strfmon.c} src/musl-locale/ |
| 13 | cp $NDK/sources/android/support/src/musl-ctype/* src/musl-ctype/ |
| 14 | |
| 15 | cp $NDK/sources/android/support/include/* include/ |
| 16 | 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/ |
| 17 | |
| 18 | # Use up-to-date (Unicode 9) wcwidth: |
| 19 | cp $TERMUX_PKG_BUILDER_DIR/wcwidth.c $NDK/sources/android/support/src/musl-ctype/wcwidth.c |
| 20 | } |
| 21 | |
| 22 | termux_step_make_install () { |
| 23 | _C_FILES="src/musl-*/*.c" |
| 24 | # Link against libm to avoid linkers having to do it |
| 25 | $CC $CFLAGS -std=c99 -DNULL=0 $CPPFLAGS $LDFLAGS -lm \ |
| 26 | -Iinclude -Isrc/locale \ |
| 27 | $_C_FILES \ |
| 28 | -shared -fpic \ |
| 29 | -o libandroid-support.so |
| 30 | |
| 31 | cp libandroid-support.so $TERMUX_PREFIX/lib/ |
| 32 | |
| 33 | (cd $TERMUX_PREFIX/lib; ln -f -s libandroid-support.so libiconv.so; ln -f -s libandroid-support.so libintl.so) |
| 34 | |
| 35 | rm -Rf $TERMUX_PREFIX/include/libandroid-support |
| 36 | mkdir -p $TERMUX_PREFIX/include/libandroid-support |
| 37 | cp -Rf include/* $TERMUX_PREFIX/include/libandroid-support/ |
| 38 | |
| 39 | (cd $TERMUX_PREFIX/include; ln -f -s libandroid-support/libintl.h libintl.h; ln -f -s libandroid-support/iconv.h iconv.h) |
| 40 | } |