-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-android.sh
41 lines (36 loc) · 1.29 KB
/
build-android.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
#!/bin/sh
set -ev
VERSION=5.50
DST=stunnel-$VERSION-android
# install Android NDK on Arch Linux:
# aurman -S android-ndk-14b
# install Android NDK on Debian:
# sudo apt install google-android-ndk-installer
# build OpenSSL:
# export ANDROID_NDK=/usr/lib/android-ndk
# export PATH=$ANDROID_NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$PATH
# ./Configure no-shared --prefix=/opt/openssl-android android-arm
# make && sudo make install
# Debian does not deploy /etc/profile.d/android-ndk.sh
test -d "$ANDROID_NDK" || ANDROID_NDK=/usr/lib/android-ndk
ANDROID_SYSROOT=$ANDROID_NDK/platforms/android-23/arch-arm
export CPPFLAGS="--sysroot=$ANDROID_SYSROOT"
export CFLAGS="--sysroot=$ANDROID_SYSROOT"
export PATH="$ANDROID_NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$PATH"
test -f Makefile && make distclean
mkdir -p bin/android
cd bin/android
../../configure --with-ssl=/opt/openssl-android --prefix=/data/local/tmp \
--build=x86_64-pc-linux-gnu --host=arm-linux-androideabi
make clean
make V=1
cd ../..
mkdir $DST
cp bin/android/src/stunnel $DST
# arm-linux-androideabi-strip $DST/stunnel $DST/openssl
# cp /opt/androideabi/sysroot/bin/openssl $DST
# arm-linux-androideabi-strip $DST/openssl
zip -r $DST.zip $DST
rm -rf $DST
# sha256sum $DST.zip
# mv $DST.zip ../dist/