Skip to content

Commit e90c044

Browse files
committed
Added x86_64 and arm64-v8a architectures, updated to build with NDK r15 and clang
1 parent a6a6531 commit e90c044

15 files changed

+604
-526
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ armeabi
22
armeabi-v7a
33
mips
44
x86
5+
arm64-v8a
6+
x86_64

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ libiconv-libicu-android
33

44
Port of libiconv and libicu to Android
55

6-
You will need NDK r10e, curl, autoconf, automake, libtool, and git installed.
6+
You will need NDK r15, curl, autoconf, automake, libtool, and git installed.
77

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

12+
There are no armv5 and mips builds, because there are very few devices using these architectures in the wild.
13+
1214
If you need libintl, you may download it here:
1315
https://github.com/pelya/commandergenius/tree/sdl_android/project/jni/intl

build.sh

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,15 @@ NDK=`which ndk-build`
1111
NDK=`dirname $NDK`
1212
NDK=`readlink -f $NDK`
1313

14-
for ARCH in armeabi armeabi-v7a x86 mips; do
14+
export CLANG=1
15+
16+
for ARCH in armeabi-v7a arm64-v8a x86 x86_64; do
1517

1618
cd $BUILDDIR
19+
20+
GCCPREFIX="`env CLANG= ./setCrossEnvironment-$ARCH.sh sh -c 'basename $CC | sed s/-gcc//'`"
21+
echo "ARCH $ARCH GCCPREFIX $GCCPREFIX"
22+
1723
mkdir -p $ARCH
1824
cd $BUILDDIR/$ARCH
1925

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

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

3037
} || exit 1
3138

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

3643
[ -e libiconv.so ] || {
3744

38-
[ -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
45+
rm -rf libiconv-1.15
3946

40-
tar xvf ../libiconv-1.14.tar.gz
47+
tar xvf ../libiconv-1.15.tar.gz
4148

42-
cd libiconv-1.14
49+
cd libiconv-1.15
4350

4451
cp -f $BUILDDIR/config.sub build-aux/
4552
cp -f $BUILDDIR/config.guess build-aux/
@@ -50,14 +57,36 @@ cd $BUILDDIR/$ARCH
5057
LDFLAGS="-L$BUILDDIR/$ARCH -landroid_support" \
5158
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
5259
./configure \
53-
--host=arm-linux-androideabi \
60+
--host=$GCCPREFIX \
5461
--prefix=`pwd`/.. \
5562
--enable-static --enable-shared \
5663
|| exit 1
5764

5865
env PATH=`pwd`:$PATH \
5966
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
60-
make -j$NCPU V=1 || exit 1
67+
make V=1 || echo "Libtool is a miserable pile of shit, linking libcharset.so manually"
68+
69+
env PATH=`pwd`:$PATH \
70+
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
71+
sh -c '$LD $CFLAGS $LDFLAGS -shared libcharset/lib/.libs/*.o -o libcharset/lib/.libs/libcharset.so' || exit 1
72+
73+
env PATH=`pwd`:$PATH \
74+
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
75+
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"
76+
77+
env PATH=`pwd`:$PATH \
78+
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
79+
sh -c '$LD $CFLAGS $LDFLAGS -shared lib/.libs/*.o -o lib/.libs/libiconv.so' || exit 1
80+
81+
env PATH=`pwd`:$PATH \
82+
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
83+
make V=1 || echo "Did you know that libtool contributes to global warming by overheating your CPU?"
84+
85+
cp -f lib/.libs/libiconv.so preload/preloadable_libiconv.so
86+
87+
env PATH=`pwd`:$PATH \
88+
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
89+
make V=1 || exit 1
6190

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

80109
[ -e libicuuc.so ] || {
81110

82-
[ -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
111+
rm -rf icu
83112

84-
tar xvf ../icu4c-52_1-src.tgz
113+
tar xvf ../icu4c-59_1-src.tgz
85114

86115
cd icu/source
87116

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

102-
env CFLAGS="-I$NDK/sources/android/support/include -frtti -fexceptions" \
131+
env CFLAGS="-I$NDK/sources/android/support/include -frtti -fexceptions -include $BUILDDIR/ndk-r15-64-bit-fix.h" \
103132
LDFLAGS="-frtti -fexceptions" \
104133
LIBS="-L$BUILDDIR/$ARCH -landroid_support -lgnustl_static -lstdc++" \
105134
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
106135
./configure \
107-
--host=arm-linux-androideabi \
136+
--host=$GCCPREFIX \
108137
--prefix=`pwd`/../../ \
109138
--with-cross-build=`pwd`/cross \
110139
--enable-static --enable-shared \
@@ -132,6 +161,6 @@ cd $BUILDDIR/$ARCH
132161

133162
} || exit 1
134163

135-
done # for ARCH in armeabi armeabi-v7a
164+
done # for ARCH in ...
136165

137166
exit 0

0 commit comments

Comments
 (0)