Skip to content

Commit 4d2b05e

Browse files
Merge pull request #11 from secondlife/roxie/m137-universal-mac
Introduce macos universal lib support
2 parents c69e767 + 79267f9 commit 4d2b05e

File tree

10 files changed

+251
-103
lines changed

10 files changed

+251
-103
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
matrix:
2020
name:
2121
- windows_x86_64
22-
runs-on: windows-latest
22+
runs-on: windows-2022
2323
steps:
2424
- uses: actions/checkout@v4
2525
- name: Disk Cleanup
@@ -51,7 +51,7 @@ jobs:
5151
fail-fast: false
5252
matrix:
5353
name:
54-
# - macos_arm64
54+
- macos_arm64
5555
- macos_x86_64
5656
# - ios
5757
runs-on: macos-15
@@ -60,6 +60,10 @@ jobs:
6060
- name: Select Xcode 16.1
6161
run: sudo xcode-select --switch /Applications/Xcode_16.1.app/Contents/Developer
6262
- run: brew install ninja
63+
- uses: actions/setup-python@v5
64+
with:
65+
python-version: '3.12'
66+
- run: pip install setuptools
6367
- run: ./build.${{ matrix.name }}.sh "${{ github.event.inputs.commitHash }}"
6468
- name: Upload Artifact
6569
uses: actions/upload-artifact@v4
@@ -80,11 +84,11 @@ jobs:
8084
# - ubuntu-18.04_armv8
8185
# - ubuntu-20.04_armv8
8286
# - ubuntu-18.04_x86_64
83-
- ubuntu-20.04_x86_64
84-
# - ubuntu-22.04_x86_64
87+
# - ubuntu-20.04_x86_64
88+
- ubuntu-22.04_x86_64
8589
# - android
8690
# - android_prefixed
87-
runs-on: linux-large
91+
runs-on: linux-large
8892
steps:
8993
- uses: actions/checkout@v4
9094
- name: Disk Cleanup

.github/workflows/release.yml

Lines changed: 61 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- windows_x86_64
1717
# - windows_arm64
1818
# - windows_x86
19-
runs-on: windows-latest
19+
runs-on: windows-2022
2020
outputs:
2121
output-artifact-id: ${{ steps.artifact-upload-step.outputs.artifact-id }}
2222
steps:
@@ -49,7 +49,7 @@ jobs:
4949
uses: actions/upload-artifact@v4
5050
id: artifact-upload-step
5151
with:
52-
name: webrtc.${{ matrix.name }}.tar.bz2
52+
name: webrtc.${{ matrix.name }}
5353
path: build\_package\${{ matrix.name }}\webrtc.tar.bz2
5454
build-macos:
5555
defaults:
@@ -59,7 +59,7 @@ jobs:
5959
fail-fast: false
6060
matrix:
6161
name:
62-
# - macos_arm64
62+
- macos_arm64
6363
- macos_x86_64
6464
# - ios
6565
runs-on: macos-15
@@ -70,19 +70,23 @@ jobs:
7070
- name: Select Xcode 16.1
7171
run: sudo xcode-select --switch /Applications/Xcode_16.1.app/Contents/Developer
7272
- run: brew install ninja
73+
- uses: actions/setup-python@v5
74+
with:
75+
python-version: '3.12'
76+
- run: pip install setuptools
7377
- name: Determine Release Tag
7478
env:
7579
RELEASE: ${{ github.ref_name }}
7680
id: release_tag
7781
run: |
7882
echo "tag=${RELEASE%%.*}" >> "$GITHUB_OUTPUT"
7983
echo "3P_WEBRTC_BUILD_RELEASE_VERSION=${RELEASE}" >> "VERSION"
80-
- run: ./build.${{ matrix.name }}.sh "${{ steps.release_tag.outputs.tag }}_release"
84+
- run: ./build.${{ matrix.name }}.sh "${{ steps.release_tag.outputs.tag }}_release"
8185
- name: Upload Artifact
8286
uses: actions/upload-artifact@v4
8387
id: artifact-upload-step
8488
with:
85-
name: webrtc.${{ matrix.name }}.tar.bz2
89+
name: webrtc.${{ matrix.name }}
8690
path: build/_package/${{ matrix.name }}/webrtc.tar.bz2
8791
build-linux:
8892
defaults:
@@ -128,33 +132,78 @@ jobs:
128132
uses: actions/upload-artifact@v4
129133
id: artifact-upload-step
130134
with:
131-
name: webrtc.${{ matrix.name }}.tar.bz2
135+
name: webrtc.${{ matrix.name }}
132136
path: build/_package/${{ matrix.name }}/webrtc.tar.bz2
133137
package-macos:
134138
needs:
135139
- build-macos
136140
runs-on: macos-15
137141
steps:
138-
- uses: secondlife/action-autobuild@v3
142+
# Checkout first to avoid damaging artifact download below
143+
- name: Checkout
144+
uses: actions/checkout@v4
145+
with:
146+
# Work around the fact that in the context of a pull request github.sha
147+
# references a dynamic merge commit rather than the branch head
148+
# https://frontside.com/blog/2020-05-26-github-actions-pull_request/#how-does-pull_request-affect-actionscheckout
149+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
150+
fetch-depth: 0
151+
submodules: recursive
152+
- name: Download webrtc artifacts
153+
uses: actions/download-artifact@v4
139154
with:
155+
path: _packages
156+
- uses: secondlife/action-autobuild@v5
157+
with:
158+
checkout: false
140159
token: ${{ github.token }}
141160
build-args: ../build-cmd.sh ${{ needs.build-macos.outputs.output-artifact-id }}
142161
package-windows:
143162
needs:
144-
- build-windows
145-
runs-on: windows-latest
163+
- build-windows
164+
runs-on: windows-2022
146165
steps:
147-
- uses: secondlife/action-autobuild@v3
166+
# Checkout first to avoid damaging artifact download below
167+
- name: Checkout
168+
uses: actions/checkout@v4
169+
with:
170+
# Work around the fact that in the context of a pull request github.sha
171+
# references a dynamic merge commit rather than the branch head
172+
# https://frontside.com/blog/2020-05-26-github-actions-pull_request/#how-does-pull_request-affect-actionscheckout
173+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
174+
fetch-depth: 0
175+
submodules: recursive
176+
- name: Download webrtc artifacts
177+
uses: actions/download-artifact@v4
148178
with:
179+
path: _packages
180+
- uses: secondlife/action-autobuild@v5
181+
with:
182+
checkout: false
149183
token: ${{ github.token }}
150184
build-args: ../build-cmd.sh ${{ needs.build-windows.outputs.output-artifact-id }}
151185
package-linux:
152186
needs:
153187
- build-linux
154-
runs-on: ubuntu-latest
188+
runs-on: ubuntu-latest
155189
steps:
156-
- uses: secondlife/action-autobuild@v3
190+
# Checkout first to avoid damaging artifact download below
191+
- name: Checkout
192+
uses: actions/checkout@v4
193+
with:
194+
# Work around the fact that in the context of a pull request github.sha
195+
# references a dynamic merge commit rather than the branch head
196+
# https://frontside.com/blog/2020-05-26-github-actions-pull_request/#how-does-pull_request-affect-actionscheckout
197+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
198+
fetch-depth: 0
199+
submodules: recursive
200+
- name: Download webrtc artifacts
201+
uses: actions/download-artifact@v4
202+
with:
203+
path: _packages
204+
- uses: secondlife/action-autobuild@v5
157205
with:
206+
checkout: false
158207
token: ${{ github.token }}
159208
build-args: ../build-cmd.sh ${{ needs.build-linux.outputs.output-artifact-id }}
160209
release:

build-cmd.sh

Lines changed: 49 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22

33
cd "$(dirname "$0")"
4-
artifact_id="$1"
4+
#artifact_id="$1"
55

66
# turn on verbose debugging output for logs.
77
exec 4>&1; export BASH_XTRACEFD=4; set -x
@@ -17,66 +17,75 @@ set -u
1717
# this command to stop it doing that...
1818
[[ "$OSTYPE" == "cygwin" ]] && set -o igncr
1919

20-
top="$(pwd)"
21-
stage="${top}"/stage
22-
2320
case "$AUTOBUILD_PLATFORM" in
24-
windows64)
21+
windows*)
2522
autobuild="$(cygpath -u "$AUTOBUILD")"
2623
build_type="windows_x86_64"
2724
;;
28-
darwin64)
29-
build_type="macos_x86_64"
25+
darwin*)
3026
autobuild="$AUTOBUILD"
3127
;;
3228
linux*)
33-
build_type="linux_x86_64"
29+
build_type="ubuntu-22.04_x86_64"
3430
autobuild="$AUTOBUILD"
3531
;;
3632
*)
3733
echo "This project is not currently supported for $AUTOBUILD_PLATFORM" 1>&2 ; exit 1
38-
34+
3935
;;
4036
esac
4137

38+
top="$(pwd)"
39+
stage="${top}"/stage
40+
4241
source_environment_tempfile="$stage/source_environment.sh"
4342
"$autobuild" source_environment > "$source_environment_tempfile"
4443
. "$source_environment_tempfile"
4544

4645
pushd "$stage"
4746

48-
# download the artifact
49-
curl -o webrtc.tar.bz2.zip -L -H "Accept: application/vnd.github+json" \
50-
-H "X-GitHub-Api-Version: 2022-11-28" \
51-
-H "Authorization: Bearer $AUTOBUILD_GITHUB_TOKEN" \
52-
https://api.github.com/repos/secondlife/3p-webrtc-build/actions/artifacts/"$artifact_id"/zip
53-
54-
# delete it so autobuild upload doesn't assume it's a bad autobuild artifact
55-
# TODO: Find a better way to do this that doesn't involve a 3rd party action
56-
#curl -X DELETE -H "Accept: application/vnd.github+json" \
57-
# -H "X-GitHub-Api-Version: 2022-11-28" \
58-
# -H "Authorization: Bearer $AUTOBUILD_GITHUB_TOKEN" \
59-
# https://api.github.com/repos/secondlife/3p-webrtc-build/actions/artifacts/"$artifact_id"
60-
61-
unzip webrtc.tar.bz2.zip
62-
tar xjf webrtc.tar.bz2 --strip-components=1
63-
rm webrtc.tar.bz2.zip
64-
rm webrtc.tar.bz2
65-
66-
# Munge the WebRTC Build package contents into something compatible
67-
# with the layout we use for other autobuild pacakges
68-
mv include webrtc
69-
mkdir include
70-
mv webrtc include
71-
mv lib release
72-
mkdir lib
73-
mv release lib
74-
mkdir LICENSES
75-
mv NOTICE LICENSES/webrtc-license.txt
76-
7747
case "$AUTOBUILD_PLATFORM" in
78-
darwin64)
79-
mv Frameworks/WebRTC.xcframework/macos-x86_64/WebRTC.framework lib/release
48+
darwin*)
49+
mkdir "x86_64"
50+
pushd "x86_64"
51+
tar -xjf "$top"/_packages/webrtc.macos_x86_64/webrtc.tar.bz2 --strip-components=1
52+
popd
53+
54+
mkdir "arm64"
55+
pushd "arm64"
56+
tar -xjf "$top"/_packages/webrtc.macos_arm64/webrtc.tar.bz2 --strip-components=1
57+
popd
58+
59+
# Munge the WebRTC Build package contents into something compatible
60+
# with the layout we use for other autobuild pacakges
61+
62+
# Create universal library
63+
mkdir -p lib/release
64+
lipo -create -output "$stage/lib/release/libwebrtc.a" "$stage/x86_64/lib/libwebrtc.a" "$stage/arm64/lib/libwebrtc.a"
65+
66+
mkdir -p include/webrtc
67+
mv x86_64/include/* include/webrtc
68+
69+
mkdir LICENSES
70+
mv x86_64/NOTICE LICENSES/webrtc-license.txt
71+
;;
72+
*)
73+
tar -xjf "$top"/_packages/webrtc."$build_type"/webrtc.tar.bz2 --strip-components=1
74+
75+
# Munge the WebRTC Build package contents into something compatible
76+
# with the layout we use for other autobuild pacakges
77+
mv include webrtc
78+
mkdir include
79+
mv webrtc include
80+
mv lib release
81+
mkdir lib
82+
mv release lib
83+
mkdir LICENSES
84+
mv NOTICE LICENSES/webrtc-license.txt
85+
;;
86+
*)
87+
echo "This project is not currently supported for $AUTOBUILD_PLATFORM" 1>&2 ; exit 1
88+
8089
;;
8190
esac
8291

0 commit comments

Comments
 (0)