-
Notifications
You must be signed in to change notification settings - Fork 9
/
android-build.sh
executable file
·187 lines (169 loc) · 5.65 KB
/
android-build.sh
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#!/bin/sh
BUILD_PARALLEL=false
NCPU=8
ARCH_LIST="arm64-v8a x86_64 x86 armeabi-v7a"
#ARCH_LIST="arm64-v8a"
[ -e 12916e229c769da4929f6df7f038ab51cf0cb067.tar.gz ] || wget https://github.com/json-c/json-c/archive/12916e229c769da4929f6df7f038ab51cf0cb067.tar.gz || exit 1
[ -e libsndfile-1.0.25.tar.gz ] || wget http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.25.tar.gz || exit 1
[ -e configure ] || {
env NOCONFIGURE=1 ./bootstrap.sh || exit 1
}
build() {
ARCH=$1
case $ARCH in
arm64-v8a) TOOLCHAIN=aarch64-linux-android;;
x86_64) TOOLCHAIN=x86_64-linux-android;;
armeabi-v7a) TOOLCHAIN=arm-linux-androideabi;;
x86) TOOLCHAIN=i686-linux-android;;
esac
mkdir -p $ARCH
cd $ARCH
[ -e libtool-master/install/lib/libltdl.so ] || {
rm -rf libtool-master
tar xvf ../libtool-master.tar.gz || exit 1
cd libtool-master
mkdir -p install
./bootstrap || exit 1
env CFLAGS=-DLT_DEBUG_LOADERS=1 \
../../setCrossEnvironment-$ARCH.sh ./configure --host=$TOOLCHAIN --prefix=`pwd`/install || exit 1
#env CFLAGS=-DLT_DEBUG_LOADERS=1 \
# ./configure --prefix=`pwd`/install || exit 1
make -j$NCPU V=1
mkdir -p install/lib
#../../setCrossEnvironment-$ARCH.sh sh -c \
# '$AR rcs install/lib/libltdl.a libltdl/.libs/*.o libltdl/loaders/.libs/*.o' || exit 1
../../setCrossEnvironment-$ARCH.sh sh -c \
'$CC $LDFLAGS -shared -o install/lib/libltdl.so libltdl/.libs/*.o libltdl/loaders/.libs/*.o' || exit 1
make install-data || exit 1
cd ..
} || exit 1
[ -e json-c-12916e229c769da4929f6df7f038ab51cf0cb067/install/lib/libjson-c.so ] || {
rm -rf json-c-12916e229c769da4929f6df7f038ab51cf0cb067
tar xvf ../12916e229c769da4929f6df7f038ab51cf0cb067.tar.gz || exit 1
cd json-c-12916e229c769da4929f6df7f038ab51cf0cb067
mkdir -p install
env ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes \
../../setCrossEnvironment-$ARCH.sh ./autogen.sh \
--host=$TOOLCHAIN \
--prefix=`pwd`/install \
--disable-shared \
--enable-static \
--with-gnu-ld \
|| exit 1
make -j$NCPU || exit 1
make install-data || exit 1
mkdir -p install/lib
#../../setCrossEnvironment-$ARCH.sh sh -c \
# '$AR rcs install/lib/libjson-c.a *.o' || exit 1
../../setCrossEnvironment-$ARCH.sh sh -c \
'$CC $LDFLAGS -shared -o install/lib/libjson-c.so *.o' || exit 1
cd ..
} || exit 1
[ -e libsndfile-1.0.25/install/lib/libsndfile.so ] || {
rm -rf libsndfile-1.0.25
tar xvf ../libsndfile-1.0.25.tar.gz || exit 1
cd libsndfile-1.0.25
mkdir -p install
cp -f ../../android-config.sub Cfg/config.sub
cp -f ../../android-config.guess Cfg/config.guess
autoreconf
../../setCrossEnvironment-$ARCH.sh ./configure \
--host=$TOOLCHAIN \
--prefix=`pwd`/install \
--disable-shared \
--disable-external-libs \
--disable-alsa \
--enable-static \
|| exit 1
echo 'int main () {}' > programs/sndfile-play.c
make -j$NCPU V=1 -k
make install-data || exit 1
mkdir -p install/lib
#../../setCrossEnvironment-$ARCH.sh sh -c \
# '$AR rcs install/lib/libsndfile.a src/*.o src/*/*.o' || exit 1
../../setCrossEnvironment-$ARCH.sh sh -c \
'$CC $LDFLAGS -shared -o install/lib/libsndfile.so src/*.o src/*/*.o' || exit 1
cd ..
} || exit 1
mkdir -p install
[ -e Makefile ] || {
env \
CFLAGS=" \
-I`pwd`/libtool-master/install/include \
-I`pwd`/json-c-12916e229c769da4929f6df7f038ab51cf0cb067/install/include/json-c \
-I`pwd`/libsndfile-1.0.25/install/include \
-Werror=implicit-function-declaration" \
LDFLAGS=" \
-L`pwd`/libtool-master/install/lib \
-L`pwd`/json-c-12916e229c769da4929f6df7f038ab51cf0cb067/install/lib \
-L`pwd`/libsndfile-1.0.25/install/lib -pie" \
LIBS="-ljson-c -lsndfile" \
LIBJSON_CFLAGS=-I`pwd`/json-c-12916e229c769da4929f6df7f038ab51cf0cb067/install/include \
LIBJSON_LIBS="-L`pwd`/json-c-12916e229c769da4929f6df7f038ab51cf0cb067/install/lib -ljson-c" \
LIBSNDFILE_CFLAGS=-I`pwd`/libsndfile-1.0.25/install/include \
LIBSNDFILE_LIBS="-L`pwd`/libsndfile-1.0.25/install/lib -lsndfile" \
ALLOW_UNRESOLVED_SYMBOLS=1 \
ac_cv_func_mkfifo=no \
ac_cv_func_getuid=no \
ac_cv_func_getuid=seteuid \
ax_cv_PTHREAD_PRIO_INHERIT=no \
ac_cv_header_langinfo_h=no \
ac_cv_header_glob_h=no \
../setCrossEnvironment-$ARCH.sh \
../configure \
--prefix=`pwd`/install \
--host=$TOOLCHAIN \
--disable-nls \
--disable-rpath \
--disable-neon-opt \
--disable-static \
--enable-shared \
--disable-x11 \
--disable-tests \
--disable-oss-output \
--disable-oss-wrapper \
--disable-coreaudio-output \
--disable-alsa \
--disable-esound \
--disable-solaris \
--disable-glib2 \
--disable-gtk3 \
--disable-gconf \
--disable-glib2 \
--disable-gtk3 \
--disable-gsettings \
--disable-avahi \
--disable-jack \
--disable-asyncns \
--disable-tcpwrap \
--disable-lirc \
--disable-dbus \
--disable-bluez5 \
--disable-udev \
--disable-hal-compat \
--disable-openssl \
--disable-systemd-daemon \
--disable-systemd-login \
--disable-systemd-journal \
--disable-manpages \
--without-caps \
|| exit 1
patch -p0 < ../libtool.patch || { rm Makefile ; exit 1 ; }
sed -i.old "s@`pwd`/install@/proc/self/cwd/usr@g" config.h
} || exit 1
make -j$NCPU V=1
make install-strip || exit 1
cd ..
}
for ARCH in $ARCH_LIST; do
if $BUILD_PARALLEL; then
build $ARCH &
else
build $ARCH
fi
done
wait
for ARCH in $ARCH_LIST; do
[ -e $ARCH/install/bin/pulseaudio ] || exit 1
done
exit 0