Skip to content

Commit

Permalink
chore: Update build script to build and release OpenSSL for macOS wit…
Browse files Browse the repository at this point in the history
…h version 3
  • Loading branch information
royshil committed Jul 15, 2024
1 parent 1a99ae0 commit 8997953
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
uses: "actions/upload-artifact@v4"
with:
name: "openssl-macos-${{ matrix.config }}"
path: "release/*.tar.gz"
path: "*.tar.gz"

Release:
runs-on: "ubuntu-22.04"
Expand Down
45 changes: 37 additions & 8 deletions build-macos.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/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)
Expand All @@ -10,19 +16,42 @@ mv openssl-$OPENSSL_VERSION openssl_arm64
cp -r openssl_arm64 openssl_x86_64

cd openssl_arm64
./Configure shared darwin64-arm64-cc
./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 darwin64-x86_64-cc
./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 release

# 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

cp -r openssl_arm64/release/include release/include

lipo -create openssl_arm64/libcrypto.$OPENSSL_VERSION_SHORT.dylib \
openssl_x86_64/libcrypto.$OPENSSL_VERSION_SHORT.dylib \
-output libcrypto.$OPENSSL_VERSION_SHORT.dylib
lipo -create openssl_arm64/libssl.$OPENSSL_VERSION_SHORT.dylib \
openssl_x86_64/libssl.$OPENSSL_VERSION_SHORT.dylib \
-output libssl.$OPENSSL_VERSION_SHORT.dylib
# create a tarball
tar -czvf openssl-$OPENSSL_VERSION-macos.tar.gz release

0 comments on commit 8997953

Please sign in to comment.