准备工作
下载release版本的openssl,下载地址,这里下载目前最新的版本,openssl-OpenSSL_1_1_1g.tar.gz
编译环境选择macOS High Sierra 10.13.6
NDK版本21.0.6113669
配置参考NOTES.ANDROID文件
我的电脑已经安装perl工具
配置和编译
这里创建了一个脚本
支持的平台有:./Configure LIST
android-arm android-arm64 android-armeabi android64 android64-aarch64
wiki建议移动端的选项有:shared no-ssl2 no-ssl3 no-comp no-hw no-engine
#!/bin/sh
OPENSSL_FOLDER=$PWD
func_cmp(){
cd $OPENSSL_FOLDER
make clean
rm -rf ${OPENSSL_FOLDER}/output-$ARCH
mkdir -p ${OPENSSL_FOLDER}/output-$ARCH
export ANDROID_NDK_HOME=/Users/chengzhen/Library/Android/sdk/ndk/21.0.6113669
export ANDROID_NDK_ROOT=/Users/chengzhen/Library/Android/sdk/ndk/21.0.6113669
PATH=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/darwin-x86_64/bin:$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin:$ANDROID_NDK_ROOT/toolchains/aarch64-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin:$PATH
./Configure android-$ARCH_NAME -D__ANDROID_API__=21 --prefix=${OPENSSL_FOLDER}/output-$ARCH
make && make install
}
for ARCH in android-armeabi android64-aarch64
do
echo $ARCH
if [ "$ARCH" = "android-armeabi" ]; then
ARCH_NAME=android-armeabi
# TOOL_CHAIN=arm-linux-androideabi-4.9
fi
if [ "$ARCH" = "android64-aarch64" ]; then
ARCH_NAME=android-arm64
# TOOL_CHAIN=aarch64-linux-android-4.9
fi
func_cmp
done
网友评论