Skip to content

Commit

Permalink
Added x86_64 and arm64-v8a architectures, updated to build with NDK r…
Browse files Browse the repository at this point in the history
…15 and clang
  • Loading branch information
pelya committed Jun 20, 2017
1 parent a6a6531 commit e90c044
Show file tree
Hide file tree
Showing 15 changed files with 604 additions and 526 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ armeabi
armeabi-v7a
mips
x86
arm64-v8a
x86_64
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ libiconv-libicu-android

Port of libiconv and libicu to Android

You will need NDK r10e, curl, autoconf, automake, libtool, and git installed.
You will need NDK r15, curl, autoconf, automake, libtool, and git installed.

There are no sources and no patches - everything is done with magical build scripts,
just run build.sh and enjoy.
Don't forget to strip them, because they are huge with debug info included.

There are no armv5 and mips builds, because there are very few devices using these architectures in the wild.

If you need libintl, you may download it here:
https://github.com/pelya/commandergenius/tree/sdl_android/project/jni/intl
55 changes: 42 additions & 13 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ NDK=`which ndk-build`
NDK=`dirname $NDK`
NDK=`readlink -f $NDK`

for ARCH in armeabi armeabi-v7a x86 mips; do
export CLANG=1

for ARCH in armeabi-v7a arm64-v8a x86 x86_64; do

cd $BUILDDIR

GCCPREFIX="`env CLANG= ./setCrossEnvironment-$ARCH.sh sh -c 'basename $CC | sed s/-gcc//'`"
echo "ARCH $ARCH GCCPREFIX $GCCPREFIX"

mkdir -p $ARCH
cd $BUILDDIR/$ARCH

Expand All @@ -24,8 +30,9 @@ mkdir -p android_support
cd android_support
ln -sf $NDK/sources/android/support jni

ndk-build -j$NCPU APP_ABI=$ARCH || exit 1
cp -f obj/local/$ARCH/libandroid_support.a ../
#ndk-build -j$NCPU APP_ABI=$ARCH APP_MODULES=android_support LIBCXX_FORCE_REBUILD=true CLANG=1 || exit 1
#cp -f obj/local/$ARCH/libandroid_support.a ../
ln -sf $NDK/sources/cxx-stl/llvm-libc++/libs/$ARCH/libandroid_support.a ../

} || exit 1

Expand All @@ -35,11 +42,11 @@ cd $BUILDDIR/$ARCH

[ -e libiconv.so ] || {

[ -e ../libiconv-1.14.tar.gz ] || curl -L http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz -o ../libiconv-1.14.tar.gz || exit 1
rm -rf libiconv-1.15

tar xvf ../libiconv-1.14.tar.gz
tar xvf ../libiconv-1.15.tar.gz

cd libiconv-1.14
cd libiconv-1.15

cp -f $BUILDDIR/config.sub build-aux/
cp -f $BUILDDIR/config.guess build-aux/
Expand All @@ -50,14 +57,36 @@ cd $BUILDDIR/$ARCH
LDFLAGS="-L$BUILDDIR/$ARCH -landroid_support" \
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
./configure \
--host=arm-linux-androideabi \
--host=$GCCPREFIX \
--prefix=`pwd`/.. \
--enable-static --enable-shared \
|| exit 1

env PATH=`pwd`:$PATH \
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
make -j$NCPU V=1 || exit 1
make V=1 || echo "Libtool is a miserable pile of shit, linking libcharset.so manually"

env PATH=`pwd`:$PATH \
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
sh -c '$LD $CFLAGS $LDFLAGS -shared libcharset/lib/.libs/*.o -o libcharset/lib/.libs/libcharset.so' || exit 1

env PATH=`pwd`:$PATH \
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
make V=1 || echo "Libtool works worse than cat /dev/urandom | head 10000 > library.so, because this will at least generate a target file, linking libiconv.so manually"

env PATH=`pwd`:$PATH \
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
sh -c '$LD $CFLAGS $LDFLAGS -shared lib/.libs/*.o -o lib/.libs/libiconv.so' || exit 1

env PATH=`pwd`:$PATH \
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
make V=1 || echo "Did you know that libtool contributes to global warming by overheating your CPU?"

cp -f lib/.libs/libiconv.so preload/preloadable_libiconv.so

env PATH=`pwd`:$PATH \
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
make V=1 || exit 1

env PATH=`pwd`:$PATH \
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
Expand All @@ -79,9 +108,9 @@ cd $BUILDDIR/$ARCH

[ -e libicuuc.so ] || {

[ -e ../icu4c-52_1-src.tgz ] || curl http://pkgs.fedoraproject.org/repo/pkgs/icu/icu4c-52_1-src.tgz/9e96ed4c1d99c0d14ac03c140f9f346c/icu4c-52_1-src.tgz -o ../icu4c-52_1-src.tgz || exit 1
rm -rf icu

tar xvf ../icu4c-52_1-src.tgz
tar xvf ../icu4c-59_1-src.tgz

cd icu/source

Expand All @@ -99,12 +128,12 @@ cd $BUILDDIR/$ARCH
sed -i "s@LD_SONAME *=.*@LD_SONAME =@g" config/mh-linux
sed -i "s%ln -s *%cp -f \$(dir \$@)/%g" config/mh-linux

env CFLAGS="-I$NDK/sources/android/support/include -frtti -fexceptions" \
env CFLAGS="-I$NDK/sources/android/support/include -frtti -fexceptions -include $BUILDDIR/ndk-r15-64-bit-fix.h" \
LDFLAGS="-frtti -fexceptions" \
LIBS="-L$BUILDDIR/$ARCH -landroid_support -lgnustl_static -lstdc++" \
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
./configure \
--host=arm-linux-androideabi \
--host=$GCCPREFIX \
--prefix=`pwd`/../../ \
--with-cross-build=`pwd`/cross \
--enable-static --enable-shared \
Expand Down Expand Up @@ -132,6 +161,6 @@ cd $BUILDDIR/$ARCH

} || exit 1

done # for ARCH in armeabi armeabi-v7a
done # for ARCH in ...

exit 0
Loading

0 comments on commit e90c044

Please sign in to comment.