-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-macos.sh
executable file
·59 lines (48 loc) · 1.73 KB
/
build-macos.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
#!/bin/bash
# Exit on error and print each command
set -e
set -x
# Build OpenSSL for macOS
OPENSSL_VERSION="3.3.1"
OPENSSL_VERSION_SHORT="3"
NUM_CORES=$(sysctl -n hw.logicalcpu)
wget https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz -C .
mv openssl-$OPENSSL_VERSION openssl_arm64
cp -r openssl_arm64 openssl_x86_64
cd openssl_arm64
./Configure shared --prefix="$(pwd)/release" \
--openssldir="$(pwd)/release" \
darwin64-arm64-cc
make -j$NUM_CORES
# install into the current directory
make install_sw
cd ../
cd openssl_x86_64
./Configure shared --prefix="$(pwd)/release" \
--openssldir="$(pwd)/release" \
darwin64-x86_64-cc
make -j$NUM_CORES
# install into the current directory
make install_sw
cd ../
mkdir -p release/lib
cp -r openssl_arm64/release/include release/include
cp -r openssl_arm64/release/lib/cmake release/lib/cmake
cp -r openssl_arm64/release/lib/pkgconfig release/lib/pkgconfig
# shared libraries
lipo -create openssl_arm64/release/lib/libcrypto.$OPENSSL_VERSION_SHORT.dylib \
openssl_x86_64/release/lib/libcrypto.$OPENSSL_VERSION_SHORT.dylib \
-output release/lib/libcrypto.$OPENSSL_VERSION_SHORT.dylib
lipo -create openssl_arm64/release/lib/libssl.$OPENSSL_VERSION_SHORT.dylib \
openssl_x86_64/release/lib/libssl.$OPENSSL_VERSION_SHORT.dylib \
-output release/lib/libssl.$OPENSSL_VERSION_SHORT.dylib
# static libraries
lipo -create openssl_arm64/release/lib/libcrypto.a \
openssl_x86_64/release/lib/libcrypto.a \
-output release/lib/libcrypto.a
lipo -create openssl_arm64/release/lib/libssl.a \
openssl_x86_64/release/lib/libssl.a \
-output release/lib/libssl.a
# create a tarball
tar -czvf openssl-$OPENSSL_VERSION-macos.tar.gz release