-
Notifications
You must be signed in to change notification settings - Fork 91
/
build-ios-fat.sh
executable file
·101 lines (81 loc) · 4.34 KB
/
build-ios-fat.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
set -e
if [ -z ${FIPS} ]; then
FIPS=false
fi
git submodule update --init --recursive
mkdir build_device
cd build_device
cmake -DCMAKE_TOOLCHAIN_FILE=$(pwd)/../Toolchain-iOS.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_BITCODE=NO \
-DIOS_PLATFORM=OS64 \
-DFIPS=${FIPS} \
-DIOS_DEPLOYMENT_TARGET=13.0 \
-DDEPS_ONLY=true \
-DCMAKE_INSTALL_PREFIX=../output_device ../
make
make install
cd ..
# Does not support fips
mkdir build_sim
cd build_sim
cmake -DCMAKE_TOOLCHAIN_FILE=$(pwd)/../Toolchain-iOS.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_BITCODE=NO \
-DIOS_PLATFORM=SIMULATOR64 \
-DIOS_DEPLOYMENT_TARGET=13.0 \
-DDEPS_ONLY=true \
-DCMAKE_INSTALL_PREFIX=../output_sim ../
make
make install
cd ..
# Does not support FIPS
mkdir build_arm_sim
cd build_arm_sim
cmake -DCMAKE_TOOLCHAIN_FILE=$(pwd)/../Toolchain-iOS.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_BITCODE=NO \
-DIOS_PLATFORM=SIMULATORARM64 \
-DIOS_DEPLOYMENT_TARGET=13.0 \
-DDEPS_ONLY=true \
-DCMAKE_INSTALL_PREFIX=../output_arm_sim ../
make
make install
cd ..
mkdir -p output_fat/lib
mkdir -p output_fat/include
mkdir -p output_sim_fat
cp -R output_device/include output_fat
rm -rf output_fat/include/wickrcrypto
mkdir output_device/lib/libcrypto.framework
mkdir output_sim/lib/libcrypto.framework
mkdir output_arm_sim/lib/libcrypto.framework
cp third-party/openssl/aws-lc/CryptoInfo.plist output_device/lib/libcrypto.framework/Info.plist
cp third-party/openssl/aws-lc/CryptoInfo.plist output_sim/lib/libcrypto.framework/Info.plist
cp third-party/openssl/aws-lc/CryptoInfo.plist output_arm_sim/lib/libcrypto.framework/Info.plist
mkdir output_device/lib/libssl.framework
mkdir output_sim/lib/libssl.framework
mkdir output_arm_sim/lib/libssl.framework
cp third-party/openssl/aws-lc/SslInfo.plist output_device/lib/libssl.framework/Info.plist
cp third-party/openssl/aws-lc/SslInfo.plist output_sim/lib/libssl.framework/Info.plist
cp third-party/openssl/aws-lc/SslInfo.plist output_arm_sim/lib/libssl.framework/Info.plist
lipo -create output_device/lib/libcrypto.dylib -output output_device/lib/libcrypto.framework/libcrypto
lipo -create output_sim/lib/libcrypto.dylib output_arm_sim/lib/libcrypto.dylib -output output_sim/lib/libcrypto.framework/libcrypto
lipo -create output_device/lib/libssl.dylib -output output_device/lib/libssl.framework/libssl
lipo -create output_sim/lib/libssl.dylib output_arm_sim/lib/libssl.dylib -output output_sim/lib/libssl.framework/libssl
install_name_tool -id @rpath/libcrypto.framework/libcrypto output_device/lib/libcrypto.framework/libcrypto
codesign --force -s - output_device/lib/libcrypto.framework/libcrypto
install_name_tool -id @rpath/libcrypto.framework/libcrypto output_sim/lib/libcrypto.framework/libcrypto
install_name_tool -id @rpath/libssl.framework/libssl output_device/lib/libssl.framework/libssl
codesign --force -s - output_device/lib/libssl.framework/libssl
install_name_tool -id @rpath/libssl.framework/libssl output_sim/lib/libssl.framework/libssl
install_name_tool -change @rpath/libcrypto.dylib @rpath/libcrypto.framework/libcrypto output_device/lib/libssl.framework/libssl
install_name_tool -change @rpath/libcrypto.dylib @rpath/libcrypto.framework/libcrypto output_sim/lib/libssl.framework/libssl
xcodebuild -create-xcframework -framework output_device/lib/libcrypto.framework -framework output_sim/lib/libcrypto.framework -output output_fat/lib/libcrypto.xcframework
xcodebuild -create-xcframework -framework output_device/lib/libssl.framework -framework output_sim/lib/libssl.framework -output output_fat/lib/libssl.xcframework
lipo -create output_sim/lib/libprotobuf-c.a output_arm_sim/lib/libprotobuf-c.a -output output_sim_fat/libprotobuf-c.a
lipo -create output_sim/lib/libscrypt.a output_arm_sim/lib/libscrypt.a -output output_sim_fat/libscrypt.a
lipo -create output_sim/lib/libbcrypt.a output_arm_sim/lib/libbcrypt.a -output output_sim_fat/libbcrypt.a
xcodebuild -create-xcframework -library output_device/lib/libprotobuf-c.a -library output_sim_fat/libprotobuf-c.a -output output_fat/lib/libprotobuf-c.xcframework
xcodebuild -create-xcframework -library output_device/lib/libscrypt.a -library output_sim_fat/libscrypt.a -output output_fat/lib/libscrypt.xcframework
xcodebuild -create-xcframework -library output_device/lib/libbcrypt.a -library output_sim_fat/libbcrypt.a -output output_fat/lib/libbcrypt.xcframework