-
Notifications
You must be signed in to change notification settings - Fork 6
250 lines (213 loc) · 8.95 KB
/
Copy pathneobuild.yml
File metadata and controls
250 lines (213 loc) · 8.95 KB
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
name: Neo Build
on:
workflow_dispatch:
push:
jobs:
# ── Check which native libraries need building ──
check-natives:
runs-on: ubuntu-latest
outputs:
needs_build: ${{ steps.check.outputs.needs_build }}
missing: ${{ steps.check.outputs.missing }}
steps:
- uses: actions/checkout@v4
- name: Check for pre-built natives
id: check
run: |
MISSING=""
for spec in \
"windows-x86_64:webrtc.dll" \
"windows-aarch64:webrtc.dll" \
"linux-x86_64:webrtc.so" \
"linux-aarch64:webrtc.so" \
"macos-x86_64:webrtc.dylib" \
"macos-aarch64:webrtc.dylib"; do
platform="${spec%%:*}"
lib="${spec##*:}"
path="src/main/resources/natives/$platform/$lib"
if [ ! -f "$path" ]; then
echo "MISSING: $path"
MISSING="$MISSING $platform"
else
echo "OK: $path"
fi
done
if [ -z "$MISSING" ]; then
echo "All native libraries present, skipping build."
echo "needs_build=false" >> $GITHUB_OUTPUT
else
echo "Missing:$MISSING"
echo "needs_build=true" >> $GITHUB_OUTPUT
fi
echo "missing=$MISSING" >> $GITHUB_OUTPUT
# ── Phase 1: Compile native WebRTC libraries (only if needed) ──
build-native:
needs: check-natives
if: needs.check-natives.outputs.needs_build == 'true'
strategy:
fail-fast: false
matrix:
include:
- { platform: windows-x86_64, runner: windows-2022, target_os: win, target_cpu: x64, lib_in: webrtc_ffm.dll, lib_out: webrtc.dll }
- { platform: windows-aarch64, runner: windows-2022, target_os: win, target_cpu: arm64, lib_in: webrtc_ffm.dll, lib_out: webrtc.dll }
- { platform: linux-x86_64, runner: ubuntu-22.04, target_os: linux, target_cpu: x64, lib_in: libwebrtc_ffm.so, lib_out: webrtc.so }
- { platform: linux-aarch64, runner: ubuntu-22.04, target_os: linux, target_cpu: arm64, lib_in: libwebrtc_ffm.so, lib_out: webrtc.so }
- { platform: macos-x86_64, runner: macos-26, target_os: mac, target_cpu: x64, lib_in: libwebrtc_ffm.dylib, lib_out: webrtc.dylib }
- { platform: macos-aarch64, runner: macos-26, target_os: mac, target_cpu: arm64, lib_in: libwebrtc_ffm.dylib, lib_out: webrtc.dylib }
runs-on: ${{ matrix.runner }}
steps:
# Skip this platform if its library already exists in the repo
- name: Check if build needed for this platform
id: skip
shell: bash
run: |
echo "missing_list=${{ needs.check-natives.outputs.missing }}"
if echo "${{ needs.check-natives.outputs.missing }}" | grep -q "${{ matrix.platform }}"; then
echo "skip=false" >> $GITHUB_OUTPUT
else
echo "Library for ${{ matrix.platform }} already exists, skipping."
echo "skip=true" >> $GITHUB_OUTPUT
fi
- uses: actions/checkout@v4
if: steps.skip.outputs.skip != 'true'
- uses: actions/setup-python@v5
if: steps.skip.outputs.skip != 'true'
with:
python-version: '3.11'
# ── depot_tools ──
- name: Install depot_tools (Windows)
if: steps.skip.outputs.skip != 'true' && runner.os == 'Windows'
shell: powershell
run: |
Invoke-WebRequest -Uri "https://storage.googleapis.com/chrome-infra/depot_tools.zip" -OutFile depot_tools.zip
Expand-Archive depot_tools.zip -DestinationPath _depot_tools
echo "$pwd\_depot_tools" >> $env:GITHUB_PATH
echo "DEPOT_TOOLS_WIN_TOOLCHAIN=0" >> $env:GITHUB_ENV
- name: Install depot_tools (Unix)
if: steps.skip.outputs.skip != 'true' && runner.os != 'Windows'
run: |
git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git _depot_tools
echo "$PWD/_depot_tools" >> $GITHUB_PATH
# ── Fetch WebRTC source ──
- name: Fetch WebRTC (Windows)
if: steps.skip.outputs.skip != 'true' && runner.os == 'Windows'
shell: cmd
run: |
mkdir _build
cd _build
call gclient config --name=src https://webrtc.googlesource.com/src.git
echo target_os = ['${{ matrix.target_os }}'] >> .gclient
call gclient sync --no-history --nohooks
- name: Fetch WebRTC (Unix)
if: steps.skip.outputs.skip != 'true' && runner.os != 'Windows'
run: |
mkdir _build
cd _build
gclient config --name=src https://webrtc.googlesource.com/src.git
echo "target_os = ['${{ matrix.target_os }}']" >> .gclient
gclient sync --no-history
# ── Prepare source tree ──
- name: Patch LASTCHANGE
if: steps.skip.outputs.skip != 'true'
run: python webrtc/patch_lastchange.py
- name: Inject wrapper into source tree
if: steps.skip.outputs.skip != 'true'
run: python webrtc/inject_wrapper.py
# ── Platform-specific fixups ──
- name: Install ARM64 sysroot (Linux cross-compile)
if: steps.skip.outputs.skip != 'true' && matrix.platform == 'linux-aarch64'
run: |
cd _build/src
python build/linux/sysroot_scripts/install-sysroot.py --arch=arm64
- name: Select Xcode 26 (macOS)
if: steps.skip.outputs.skip != 'true' && runner.os == 'macOS'
run: |
sudo xcode-select --switch /Applications/Xcode_26.0.app/Contents/Developer
echo "Selected: $(xcode-select -p)"
echo "SDK path: $(xcrun --show-sdk-path)"
# ── Write GN args & Compile ──
- name: Write GN args
if: steps.skip.outputs.skip != 'true'
run: python webrtc/write_gn_args.py ${{ matrix.target_os }} ${{ matrix.target_cpu }}
- name: Compile (Windows)
if: steps.skip.outputs.skip != 'true' && runner.os == 'Windows'
shell: cmd
run: |
cd _build\src
call gn gen out/Release
call ninja -C out/Release webrtc_ffm
- name: Compile (Unix)
if: steps.skip.outputs.skip != 'true' && runner.os != 'Windows'
run: |
cd _build/src
gn gen out/Release
ninja -C out/Release webrtc_ffm
# ── Upload native library ──
- name: Rename output
if: steps.skip.outputs.skip != 'true'
shell: bash
run: cp "_build/src/out/Release/${{ matrix.lib_in }}" "${{ matrix.lib_out }}"
- uses: actions/upload-artifact@v4
if: steps.skip.outputs.skip != 'true'
with:
name: native-${{ matrix.platform }}
path: ${{ matrix.lib_out }}
# ── Phase 2: Assemble all natives into a single JAR ──
build-jar:
needs: [check-natives, build-native]
if: always() && !failure() && !cancelled()
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: USS-Shenzhou/t88
path: t88
- uses: actions/setup-java@v4
with:
java-version: '25'
distribution: 'temurin'
- uses: gradle/actions/setup-gradle@v5
- name: Publish t88 to Maven Local
working-directory: ./t88
run: chmod +x gradlew && ./gradlew publishToMavenLocal
# Download freshly built natives (if any were built)
- name: Download built native libraries
if: needs.check-natives.outputs.needs_build == 'true'
uses: actions/download-artifact@v4
with:
pattern: native-*
path: _natives
# Overlay freshly built natives on top of repo's pre-existing ones
- name: Organize native libraries
run: |
for spec in \
"windows-x86_64:webrtc.dll" \
"windows-aarch64:webrtc.dll" \
"linux-x86_64:webrtc.so" \
"linux-aarch64:webrtc.so" \
"macos-x86_64:webrtc.dylib" \
"macos-aarch64:webrtc.dylib"; do
platform="${spec%%:*}"
lib="${spec##*:}"
dest="src/main/resources/natives/$platform"
mkdir -p "$dest"
# Prefer freshly built over repo version
if [ -f "_natives/native-$platform/$lib" ]; then
cp "_natives/native-$platform/$lib" "$dest/$lib"
echo "Using freshly built: $platform/$lib"
elif [ -f "$dest/$lib" ]; then
echo "Using pre-existing: $platform/$lib"
else
echo "WARNING: Missing $platform/$lib!"
fi
done
echo "=== Final native libraries ==="
find src/main/resources/natives -type f -exec ls -lh {} \;
- name: Build with Gradle
run: chmod +x gradlew && ./gradlew build
- name: Upload JAR
uses: actions/upload-artifact@v4
with:
name: channel
path: build/libs/*.jar