Skip to content

Commit 090426b

Browse files
committed
Build scripts, which build everything.
1 parent 643769f commit 090426b

File tree

6 files changed

+3604
-0
lines changed

6 files changed

+3604
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,14 @@ libiconv-libicu-android
22
=======================
33

44
Port of libiconv and libicu to Android
5+
6+
You will need NDK r9b, curl, autoconf, automake, libtool, and git installed.
7+
8+
There are no sources and no patches - everything is done with magical build scripts,
9+
just run build.sh and enjoy.
10+
Don't forget to strip them, because they are huge with debug info included.
11+
12+
Only armeabi and armeabi-v7a architectures are supported at the moment.
13+
14+
If yuou need libintl, you may download it here:
15+
https://github.com/pelya/commandergenius/tree/sdl_android/project/jni/intl

build.sh

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
#!/bin/sh
2+
3+
set -x
4+
5+
export BUILDDIR=`pwd`
6+
7+
NCPU=4
8+
uname -s | grep -i "linux" && NCPU=`cat /proc/cpuinfo | grep -c -i processor`
9+
10+
NDK=`which ndk-build`
11+
NDK=`dirname $NDK`
12+
NDK=`readlink -f $NDK`
13+
14+
for ARCH in armeabi armeabi-v7a; do
15+
16+
cd $BUILDDIR
17+
mkdir -p $ARCH
18+
cd $BUILDDIR/$ARCH
19+
20+
# =========== libandroid_support.a ===========
21+
22+
[ -e libandroid_support.a ] || {
23+
mkdir -p android_support
24+
cd android_support
25+
ln -sf $NDK/sources/android/support jni
26+
27+
ndk-build -j$NCPU APP_ABI=$ARCH || exit 1
28+
ln -sf android_support/obj/local/$ARCH/libandroid_support.a ../
29+
30+
} || exit 1
31+
32+
cd $BUILDDIR/$ARCH
33+
34+
# =========== libiconv.so ===========
35+
36+
[ -e libiconv.so ] || {
37+
38+
[ -d libiconv-1.14 ] || curl http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz | tar xvz || exit 1
39+
40+
cd libiconv-1.14
41+
42+
cp -f $BUILDDIR/config.sub build-aux/
43+
cp -f $BUILDDIR/config.guess build-aux/
44+
cp -f $BUILDDIR/config.sub libcharset/build-aux/
45+
cp -f $BUILDDIR/config.guess libcharset/build-aux/
46+
47+
env CFLAGS="-I$NDK/sources/android/support/include" \
48+
LDFLAGS="-L$BUILDDIR/$ARCH -landroid_support" \
49+
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
50+
./configure \
51+
--host=arm-linux-androideabi \
52+
--prefix=`pwd`/.. \
53+
--enable-static --enable-shared \
54+
|| exit 1
55+
56+
env PATH=`pwd`:$PATH \
57+
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
58+
make -j$NCPU V=1 || exit 1
59+
60+
env PATH=`pwd`:$PATH \
61+
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
62+
make V=1 install || exit 1
63+
64+
ln -sf lib/libiconv.so ../
65+
ln -sf lib/libcharset.so ../
66+
67+
} || exit 1
68+
69+
cd $BUILDDIR/$ARCH
70+
71+
# =========== libicu.so ===========
72+
73+
[ -e libicudata.so ] || {
74+
75+
[ -d icu ] || curl http://download.icu-project.org/files/icu4c/52.1/icu4c-52_1-src.tgz | tar xvz || exit 1
76+
77+
cd icu/source
78+
79+
cp -f $BUILDDIR/config.sub .
80+
cp -f $BUILDDIR/config.guess .
81+
82+
[ -d cross ] || {
83+
mkdir cross
84+
cd cross
85+
../configure || exit 1
86+
make -j$NCPU VERBOSE=1 || exit 1
87+
cd ..
88+
} || exit 1
89+
90+
env CFLAGS="-I$NDK/sources/android/support/include -frtti -fexceptions" \
91+
LDFLAGS="-frtti -fexceptions" \
92+
LIBS="-L$BUILDDIR/$ARCH -landroid_support -lgnustl_static -lstdc++" \
93+
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
94+
./configure \
95+
--host=arm-linux-androideabi \
96+
--prefix=`pwd`/../.. \
97+
--with-cross-build=`pwd`/cross \
98+
--enable-static --enable-shared \
99+
|| exit 1
100+
101+
env PATH=`pwd`:$PATH \
102+
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
103+
make -j$NCPU VERBOSE=1 || exit 1
104+
105+
env PATH=`pwd`:$PATH \
106+
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
107+
make V=1 install || exit 1
108+
109+
for f in libicudata libicui18n libicuio libicule libiculx libicutest libicutu libicuuc; do
110+
ln -sf lib/$f.so ../../
111+
ln -sf lib/$f.a ../../
112+
done
113+
114+
} || exit 1
115+
116+
done # for ARCH in armeabi armeabi-v7a
117+
118+
exit 0

0 commit comments

Comments
 (0)