-
Notifications
You must be signed in to change notification settings - Fork 28
96 lines (93 loc) · 3.1 KB
/
build-macos-openssl.yml
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
name: macOS OpenSSL
on:
schedule:
# Run once a week on Fridays
- cron: "0 0 * * FRI"
pull_request:
paths:
- '.github/workflows/build-macos-openssl.yml'
# Contains the OpenSSL version we'll build
- 'cryptography-linux/openssl-version.sh'
push:
branches:
- main
paths:
- '.github/workflows/build-macos-openssl.yml'
# Contains the OpenSSL version we'll build
- 'cryptography-linux/openssl-version.sh'
jobs:
build:
runs-on: macos-13
strategy:
matrix:
ARCH:
- NAME: x86_64
ARTIFACT_NAME: x86-64
CFLAGS: "-mmacosx-version-min=10.12 -march=core2"
OPENSSLDIR: "/usr/local/etc/openssl@3"
- NAME: arm64
ARTIFACT_NAME: arm64
CFLAGS: "-mmacosx-version-min=11.0"
OPENSSLDIR: "/opt/homebrew/etc/openssl@3"
name: "Build OpenSSL for macOS (${{ matrix.ARCH.NAME }})"
steps:
- uses: actions/[email protected]
with:
persist-credentials: false
- name: Download OpenSSL
run: |
source ./cryptography-linux/openssl-version.sh
curl -Lo openssl.tar.gz https://github.com/openssl/openssl/releases/download/$OPENSSL_VERSION/$OPENSSL_VERSION.tar.gz
shasum -a 256 -c <<< "$OPENSSL_SHA256 *openssl.tar.gz"
- name: Extract OpenSSL
run: |
tar zxf openssl.tar.gz
- name: Build OpenSSL
run: |
set -x
source ./cryptography-linux/openssl-version.sh
mkdir artifact
BASEDIR=$(pwd)
cd openssl*
# Use the brew openssldir so pyopenssl users with homebrew installed
# will have roots for TLS. This is obviously not great but we live in
# an imperfect world.
perl ./Configure \
--prefix="${BASEDIR}/artifact" \
--openssldir=${{ matrix.ARCH.OPENSSLDIR }} \
darwin64-${{ matrix.ARCH.NAME }}-cc \
$OPENSSL_BUILD_FLAGS
make -j$(sysctl -n hw.logicalcpu)
make install_sw
env:
CFLAGS: ${{ matrix.ARCH.CFLAGS }}
- uses: actions/[email protected]
with:
name: "openssl-macos-${{ matrix.ARCH.ARTIFACT_NAME }}"
path: artifact/
universal2:
runs-on: macos-13
name: "Build OpenSSL for macOS universal2"
needs: [ build ]
steps:
- uses: actions/[email protected]
with:
name: openssl-macos-x86-64
path: x86-64
- uses: actions/[email protected]
with:
name: openssl-macos-arm64
path: arm64
- name: Create universal2 OpenSSL
run: |
mkdir artifact
cd artifact
mkdir bin lib
cp -r ../x86-64/include .
cp -r ../x86-64/lib/pkgconfig lib/
lipo -create -output lib/libssl.a ../x86-64/lib/libssl.a ../arm64/lib/libssl.a
lipo -create -output lib/libcrypto.a ../x86-64/lib/libcrypto.a ../arm64/lib/libcrypto.a
- uses: actions/[email protected]
with:
name: "openssl-macos-universal2"
path: artifact/