forked from subins2000/android-openssl-cmake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-openssl.sh
executable file
·65 lines (51 loc) · 1.62 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
#!/bin/bash
set -u
set -e
export BUILD_ARCHS=${BUILD_ARCHS:-arm_32 arm_64}
export OPENSSL_BRANCH=OpenSSL_1_1_1-stable
export OPENSSL_ANDROID_API_32=16
export OPENSSL_ANDROID_API_64=21
NDK=${1:-$NDK}
export ANDROID_NDK_HOME=$NDK
export BASE=$(realpath ${BASE:-$(pwd)})
export PREFIX=$BASE/prefix
if [ -d $PREFIX ]; then
echo "Target folder exists. Remove $PREFIX to rebuild"
exit 1
fi
mkdir -p $PREFIX
cd $BASE
if [ ! -d openssl ]; then
git clone --depth 1 git://git.openssl.org/openssl.git --branch $OPENSSL_BRANCH
fi
cd openssl
echo "Building OpenSSL in $(realpath $PWD), deploying to $PREFIX"
export PATH=$NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin:$PATH
if [[ "$BUILD_ARCHS" = *"arm_32"* ]]; then
./Configure shared android-arm -D__ANDROID_API__=$OPENSSL_ANDROID_API_32 --prefix=$PREFIX/armeabi-v7a
make clean
make depend
make -j$(nproc) build_libs
make -j$(nproc) install_sw
fi
if [[ "$BUILD_ARCHS" = *"arm_64"* ]]; then
./Configure shared android-arm64 -D__ANDROID_API__=$OPENSSL_ANDROID_API_64 --prefix=$PREFIX/arm64-v8a
make clean
make depend
make -j$(nproc) build_libs
make -j$(nproc) install_sw
fi
if [[ "$BUILD_ARCHS" = *"x86_32"* ]]; then
./Configure shared android-x86 -D__ANDROID_API__=$OPENSSL_ANDROID_API_32 --prefix=$PREFIX/x86
make clean
make depend
make -j$(nproc) build_libs
make -j$(nproc) install_sw
fi
if [[ "$BUILD_ARCHS" = *"x86_64"* ]]; then
./Configure shared android-x86_64 -D__ANDROID_API__=$OPENSSL_ANDROID_API_64 --prefix=$PREFIX/x86_64
make clean
make depend
make -j$(nproc) build_libs
make -j$(nproc) install_sw
fi