下载最新版本的openssl
git clone https://github.com/openssl/openssl.git
创建编译脚本文件:
#!/bin/bash
# git checkout OpenSSL_1_1_1-stable
# refer to NOTE.ANDROID
export ANDROID_NDK_ROOT=/home/hui/tools/android-ndk/android-ndk-r20b
export SYS_ROOT=${ANDROID_NDK_ROOT}/platforms/android-28/arch-arm/
export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$PATH
export ARCH_FLAGS="-march=armv8-a -mfloat-abi=softfp -mfpu=vfpv3-d16"
export ARCH_LINK="-march=armv8-a -Wl,--fix-cortex-a8"
export CPPFLAGS=" ${ARCH_FLAGS} -fpic -ffunction-sections -fdata-sections -fvisibility=hidden -funwind-tables \
-fstack-protector -fno-strict-aliasing -finline-limit=64 --sysroot=$SYS_ROOT "
export CXXFLAGS=" ${ARCH_FLAGS} -fpic -ffunction-sections -fdata-sections -fvisibility=hidden -funwind-tables \
-fstack-protector -fno-strict-aliasing -finline-limit=64 -frtti -fexceptions --sysroot=$SYS_ROOT "
export CFLAGS=" ${ARCH_FLAGS} -fpic -ffunction-sections -fdata-sections -fvisibility=hidden -funwind-tables \
-fstack-protector -fno-strict-aliasing"
./Configure android-arm64 -D__ANDROID_API__=28 no-shared -no-tests --prefix=`pwd`/install
make -j`nproc`