由于官方都没有相应的编译脚本,自己也摸索了好久,特意记录下来。
源码目录 TASSL-xx
脚本文件 compile-v7.sh compile-v7s.sh compile-arm64.sh
内容如下:
#!/bin/bash
OUT_DIR=out-v7
rm -rf $OUT_DIR
cd TASSL-v7
make clean
# 设置编译器
export CC="clang -arch armv7"
# 设置工具链路径
export PATH="/Applications/Xcode10.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:$PATH"
# 设置开发环境目录
export CROSS_TOP=/Applications/Xcode10.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
# 设置SDK
export CROSS_SDK=iPhoneOS12.0.sdk
# 设置最小依赖版本
export IPHONEOS_DEPLOYMENT_TARGET=8.0
# 生成makefile
./Configure iphoneos-cross no-shared --prefix=/Users/leagsoft/dengjunxing/TASSL-ALL/$OUT_DIR
# 构建
make
make install
echo "complied v7"
其中的 iPhoneOS12.0.sdk 的 MAC电脑配置。
三种架构合并脚本如下:
#!/bin/bash
### create libssl.a
pathssl1=./out-v7/lib/libssl.a
pathssl2=./out-v7s/lib/libssl.a
pathssl3=./out-arm64/lib/libssl.a
outssl=./combinelib/libssl.a
lipo -create $pathssl1 $pathssl2 -output $outssl
lipo -create $pathssl3 $outssl -output $outssl
pathcrypto1=./out-v7/lib/libcrypto.a
pathcrypto2=./out-v7s/lib/libcrypto.a
pathcrypto3=./out-arm64/lib/libcrypto.a
outcrypto=./combinelib/libcrypto.a
lipo -create $pathcrypto1 $pathcrypto2 -output $outcrypto
lipo -create $pathcrypto3 $outcrypto -output $outcrypto