forked from mikereidis/headunit
-
Notifications
You must be signed in to change notification settings - Fork 16
/
openssl-build.sh
executable file
·44 lines (35 loc) · 1.06 KB
/
openssl-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
#!/bin/bash
set -e
set -x
# Set directory
SCRIPTPATH=`pwd`
export ANDROID_NDK_HOME=$ANDROID_NDK_ROOT
OPENSSL_DIR=/Users/algavris/Downloads/openssl-1.1.1c
# Find the toolchain for your build machine
toolchains_path=$(python toolchains_path.py --ndk ${ANDROID_NDK_ROOT})
# Configure the OpenSSL environment, refer to NOTES.ANDROID in OPENSSL_DIR
# Set compiler clang, instead of gcc by default
CC=clang
# Add toolchains bin directory to PATH
PATH=$toolchains_path/bin:$PATH
# Set the Android API levels
ANDROID_API=14
# Set the target architecture
# Can be android-arm, android-arm64, android-x86, android-x86 etc
SSLARCH=android-arm
JNI_LIBS=armeabi-v7a
# Create the make file
cd ${OPENSSL_DIR}
./Configure ${SSLARCH} -D__ANDROID_API__=$ANDROID_API
# Build
make
# Copy the outputs
OUTPUT_INCLUDE=$SCRIPTPATH/app/src/main/jni/headers
OUTPUT_LIB=$SCRIPTPATH/app/src/main/jniLibs/$JNI_LIBS
mkdir -p $OUTPUT_INCLUDE
mkdir -p $OUTPUT_LIB
cp -RL include/openssl $OUTPUT_INCLUDE
cp libcrypto.so $OUTPUT_LIB
cp libcrypto.a $OUTPUT_LIB
cp libssl.so $OUTPUT_LIB
cp libssl.a $OUTPUT_LIB