forked from robertying/openssl-curl-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-openssl.sh
executable file
·78 lines (58 loc) · 2.01 KB
/
build-openssl.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
#!/bin/bash
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/$HOST_TAG
# openssl refers to the host specific toolchain as "ANDROID_NDK_HOME"
export ANDROID_NDK_HOME=$TOOLCHAIN
PATH=$TOOLCHAIN/bin:$PATH
mkdir -p build/openssl
cd openssl
# arm64
export TARGET_HOST=aarch64-linux-android
export ANDROID_ARCH=arm64-v8a
# openssl does not handle api suffix well
ln -sfn $TOOLCHAIN/bin/$TARGET_HOST$MIN_SDK_VERSION-clang $TOOLCHAIN/bin/$TARGET_HOST-clang
./Configure android-arm64 no-shared \
-D__ANDROID_API__=$MIN_SDK_VERSION \
--prefix=$PWD/build/$ANDROID_ARCH
make -j5
make install_sw
make clean
mkdir -p ../build/openssl/$ANDROID_ARCH
cp -R $PWD/build/$ANDROID_ARCH ../build/openssl/
# arm
export TARGET_HOST=arm-linux-androideabi
export ANDROID_ARCH=armeabi-v7a
# for 32-bit ARM, the compiler is prefixed with armv7a-linux-androideabi, but the binutils tools are prefixed with arm-linux-androideabi
ln -sfn $TOOLCHAIN/bin/armv7a-linux-androideabi$MIN_SDK_VERSION-clang $TOOLCHAIN/bin/$TARGET_HOST-clang
./Configure android-arm no-shared \
-D__ANDROID_API__=$MIN_SDK_VERSION \
--prefix=$PWD/build/$ANDROID_ARCH
make -j5
make install_sw
make clean
mkdir -p ../build/openssl/$ANDROID_ARCH
cp -R $PWD/build/$ANDROID_ARCH ../build/openssl/
# x86
export TARGET_HOST=i686-linux-android
export ANDROID_ARCH=x86
ln -sfn $TOOLCHAIN/bin/$TARGET_HOST$MIN_SDK_VERSION-clang $TOOLCHAIN/bin/$TARGET_HOST-clang
./Configure android-x86 no-shared \
-D__ANDROID_API__=$MIN_SDK_VERSION \
--prefix=$PWD/build/$ANDROID_ARCH
make -j5
make install_sw
make clean
mkdir -p ../build/openssl/$ANDROID_ARCH
cp -R $PWD/build/$ANDROID_ARCH ../build/openssl/
# x64
export TARGET_HOST=x86_64-linux-android
export ANDROID_ARCH=x86_64
ln -sfn $TOOLCHAIN/bin/$TARGET_HOST$MIN_SDK_VERSION-clang $TOOLCHAIN/bin/$TARGET_HOST-clang
./Configure android-x86_64 no-shared \
-D__ANDROID_API__=$MIN_SDK_VERSION \
--prefix=$PWD/build/$ANDROID_ARCH
make -j5
make install_sw
make clean
mkdir -p ../build/openssl/$ANDROID_ARCH
cp -R $PWD/build/$ANDROID_ARCH ../build/openssl/
cd ..