forked from pelya/libiconv-libicu-android
-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·133 lines (93 loc) · 2.94 KB
/
build.sh
File metadata and controls
executable file
·133 lines (93 loc) · 2.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/sh
set -x
export BUILDDIR=`pwd`
NCPU=4
uname -s | grep -i "linux" && NCPU=`cat /proc/cpuinfo | grep -c -i processor`
NDK=`which ndk-build`
NDK=`dirname $NDK`
#NDK=`readlink -f $NDK`
for ARCH in armeabi-v7a; do
cd $BUILDDIR
mkdir -p $ARCH
cd $BUILDDIR/$ARCH
# =========== libandroid_support.a ===========
[ -e libandroid_support.a ] || {
mkdir -p android_support
cd android_support
ln -sf $NDK/sources/android/support jni
ndk-build -j$NCPU APP_ABI=$ARCH LIBCXX_FORCE_REBUILD=true || exit 1
cp -f obj/local/$ARCH/libandroid_support.a ../
} || exit 1
cd $BUILDDIR/$ARCH
# =========== libiconv.so ===========
true || [ -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
tar xvf ../libiconv-1.14.tar.gz
cd libiconv-1.14
cp -f $BUILDDIR/config.sub build-aux/
cp -f $BUILDDIR/config.guess build-aux/
cp -f $BUILDDIR/config.sub libcharset/build-aux/
cp -f $BUILDDIR/config.guess libcharset/build-aux/
env CFLAGS="-I$NDK/sources/android/support/include" \
LDFLAGS="-L$BUILDDIR/$ARCH -landroid_support" \
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
./configure \
--host=arm-linux-androideabi \
--prefix=`pwd`/.. \
--enable-static --enable-shared \
|| exit 1
env PATH=`pwd`:$PATH \
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
make -j$NCPU V=1 || exit 1
env PATH=`pwd`:$PATH \
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
make V=1 install || exit 1
cd ..
for f in libiconv libcharset; do
cp -f lib/$f.so ./
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
sh -c '$STRIP'" $f.so"
done
} || exit 1
cd $BUILDDIR/$ARCH
# =========== libicuXX.so ===========
[ -e libicuuc.so ] || {
[ -e ../icu4c-55_1-src.tgz ] || exit 1
tar xvf ../icu4c-55_1-src.tgz
cd icu/source
#cp -f $BUILDDIR/config.sub .
#cp -f $BUILDDIR/config.guess .
[ -d cross ] || {
mkdir cross
cd cross
../configure || exit 1
make -j$NCPU VERBOSE=1 || exit 1
cd ..
} || exit 1
env CFLAGS="-I$NDK/sources/android/support/include -frtti -fexceptions" \
LDFLAGS="-frtti -fexceptions" \
LIBS="-L$BUILDDIR/$ARCH -landroid_support -lc++_shared -lstdc++" \
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
./configure \
--host=arm-linux-androideabi \
--prefix=`pwd`/../../ \
--with-cross-build=`pwd`/cross \
--enable-static --enable-shared \
|| exit 1
sed -i.tmp 's/.$(SO_TARGET_VERSION_MAJOR)//' icudefs.mk
sed -i.tmp 's/$(PKGDATA_VERSIONING) -e/-e/' data/Makefile
env PATH=`pwd`:$PATH \
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
make -j$NCPU VERBOSE=1 || exit 1
env PATH=`pwd`:$PATH \
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
make V=1 install || exit 1
for f in libicudata libicutest libicui18n libicuio libicule libiculx libicutu libicuuc; do
cp -f -H ../../lib/$f.so ../../
cp -f ../../lib/$f.a ../../
$BUILDDIR/setCrossEnvironment-$ARCH.sh \
sh -c '$STRIP'" ../../$f.so"
done
} || exit 1
done # for ARCH in armeabi armeabi-v7a
exit 0