forked from sqlcipher/android-database-sqlcipher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-openssl-libraries.sh
executable file
·104 lines (82 loc) · 2.93 KB
/
build-openssl-libraries.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
#! /usr/bin/env sh
(cd external/openssl;
if [ ! ${ANDROID_NDK_ROOT} ]; then
echo "ANDROID_NDK_ROOT environment variable not set, set and rerun"
exit 1
fi
HOST_INFO=`uname -a`
case ${HOST_INFO} in
Darwin*)
TOOLCHAIN_SYSTEM=darwin-x86_64
;;
Linux*)
if [[ "${HOST_INFO}" == *i686* ]]
then
TOOLCHAIN_SYSTEM=linux-x86
else
TOOLCHAIN_SYSTEM=linux-x86_64
fi
;;
*)
echo "Toolchain unknown for host system"
exit 1
;;
esac
rm ../android-libs/armeabi/libcrypto.a \
../android-libs/x86/libcrypto.a
git clean -dfx && git checkout -f
./Configure dist
ANDROID_PLATFORM_VERSION=android-19
ANDROID_TOOLCHAIN_DIR=/tmp/sqlcipher-android-toolchain
OPENSSL_CONFIGURE_OPTIONS="-no-krb5 no-idea no-camellia
no-seed no-bf no-cast no-rc2 no-rc4 no-rc5 no-md2
no-md4 no-ripemd no-rsa no-ecdh no-sock no-ssl2 no-ssl3
no-dsa no-dh no-ec no-ecdsa no-tls1 no-pbe no-pkcs
no-tlsext no-pem no-rfc3779 no-whirlpool no-ui no-srp
no-ssltrace no-tlsext no-mdc2 no-ecdh no-engine
no-tls2 no-srtp -fPIC"
# arm build
${ANDROID_NDK_ROOT}/build/tools/make-standalone-toolchain.sh \
--platform=${ANDROID_PLATFORM_VERSION} \
--install-dir=${ANDROID_TOOLCHAIN_DIR} \
--system=${TOOLCHAIN_SYSTEM} \
--arch=arm
export PATH=${ANDROID_TOOLCHAIN_DIR}/bin:$PATH
RANLIB=arm-linux-androideabi-ranlib \
AR=arm-linux-androideabi-ar \
CC=arm-linux-androideabi-gcc \
./Configure android ${OPENSSL_CONFIGURE_OPTIONS}
make clean
make build_crypto
mv libcrypto.a ../android-libs/armeabi/
rm -rf ${ANDROID_TOOLCHAIN_DIR}
#armv7 build
${ANDROID_NDK_ROOT}/build/tools/make-standalone-toolchain.sh \
--platform=${ANDROID_PLATFORM_VERSION} \
--install-dir=${ANDROID_TOOLCHAIN_DIR} \
--system=${TOOLCHAIN_SYSTEM} \
--arch=arm
export PATH=${ANDROID_TOOLCHAIN_DIR}/bin:$PATH
RANLIB=arm-linux-androideabi-ranlib \
AR=arm-linux-androideabi-ar \
CC=arm-linux-androideabi-gcc \
./Configure android-armv7 ${OPENSSL_CONFIGURE_OPTIONS}
make clean
make build_crypto
mv libcrypto.a ../android-libs/armeabi-v7a/
rm -rf ${ANDROID_TOOLCHAIN_DIR}
# x86 build
${ANDROID_NDK_ROOT}/build/tools/make-standalone-toolchain.sh \
--platform=${ANDROID_PLATFORM_VERSION} \
--install-dir=${ANDROID_TOOLCHAIN_DIR} \
--system=${TOOLCHAIN_SYSTEM} \
--arch=x86
export PATH=${ANDROID_TOOLCHAIN_DIR}/bin:$PATH
RANLIB=i686-linux-android-ranlib \
AR=i686-linux-android-ar \
CC=i686-linux-android-gcc \
./Configure android-x86 ${OPENSSL_CONFIGURE_OPTIONS}
make clean
make build_crypto
mv libcrypto.a ../android-libs/x86/
)