-
Notifications
You must be signed in to change notification settings - Fork 109
314 lines (303 loc) · 10.8 KB
/
build_gpl.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
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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
name: Build GPL
on:
push:
schedule:
- cron: '0 12 * * 0'
env:
# if: (github.event_name == 'schedule')
# GITHUB_ENV: https://docs.github.com/en/actions/learn-github-actions/environment-variables#about-environment-variables
FF_VERSION: ${{ vars.FF_VER }} # TODO: latest release if triggered by schedule
LLVM_VER: ${{ vars.LLVM_VER }}
LLVM_VER_DEFAULT: 18
NINJA_STATUS: '[%f/%t %e %r]'
SF_PW_MAPPED: ${{ secrets.SF_PW }}
SF_USER_MAPPED: ${{ secrets.SF_USER }}
jobs:
Apple:
# See: https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#configuring-a-build-matrix
runs-on: macos-latest
env:
TARGET_OS: ${{ matrix.target }}
CONFIG_SUFFIX: -gpl-${{ matrix.config }}
strategy:
fail-fast: false
matrix:
config: [lite]
target: [macOS,iOS]
exclude:
- config: default
target: iOSSimulator
- config: default
target: macCatalyst
steps:
- uses: actions/checkout@v4
- name: Setup Xcode
run: sudo xcode-select -s /Applications/Xcode_15.4.app
- name: Create Build Environment
shell: bash
env:
DEVTOOLS_CACHE_HIT: ${{ steps.devtools-cache.outputs.cache-hit }}
EXTERNAL_DEP_CACHE_HIT: ${{ steps.external-dep-cache.outputs.cache-hit }}
run: |
./tools/ci-before-build.sh
wget https://sourceforge.net/projects/avbuild/files/dep/dep_gpl.7z/download -O dep_gpl.7z
7z x -y dep_gpl.7z -otools
- name: Configure and Build macOS
if: ${{ matrix.target == 'macOS' }}
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
run: |
export FFSRC=$PWD/ffmpeg-${FF_VERSION}
./avbuild.sh ${TARGET_OS}
- name: Configure and Build iOS arm64
if: ${{ matrix.target == 'iOS' }}
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
run: |
export FFSRC=$PWD/ffmpeg-${FF_VERSION}
./avbuild.sh ${TARGET_OS} arm64
find sdk-* -name "*.dylib" -delete
- name: Make SDK
shell: bash
run: |
cp -avf tools/dep_gpl/${{ env.TARGET_OS }}/lib/* sdk-*/lib/
./tools/ci-after-build.sh
- name: Archieve SDK
uses: actions/upload-artifact@v4
with:
name: ffmpeg-${{ env.FF_VERSION }}-${{ env.TARGET_OS }}-${{ matrix.config }}
path: ffmpeg-*.tar.xz
VS2022:
runs-on: windows-2022
env:
TARGET_OS: ${{ matrix.target }}
CONFIG_SUFFIX: -gpl-${{ matrix.config }}
strategy:
fail-fast: false
matrix:
config: [lite]
target: [windows-desktop]
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Create Build Environment
shell: cmd
run: |
set FF_BRANCH=%FF_VERSION%
if not [%FF_BRANCH%]==[master] set FF_BRANCH=release/%FF_VERSION%
git clone -b %FF_BRANCH% --depth 1 --no-tags https://git.ffmpeg.org/ffmpeg.git ffmpeg-%FF_VERSION%
if not [%CONFIG_SUFFIX%]==[-default] copy /y config%CONFIG_SUFFIX%.sh config.sh
- uses: msys2/setup-msys2@v2
with:
release: false # disable installation cache, so exe path in avbuild.sh is correct
msystem: MSYS
update: true
install: >-
make
diffutils
patch
pkg-config
nasm
yasm
- name: Install dev packages
shell: msys2 {0}
run: |
wget https://sourceforge.net/projects/avbuild/files/dep/dep.7z/download -O dep.7z
wget https://sourceforge.net/projects/avbuild/files/dep/dep_gpl.7z/download -O dep_gpl.7z
sed -i '/X264_API_IMPORTS/d' "ffmpeg-${FF_VERSION}/libavcodec/libx264.c" # we link against static libx264
- name: Configure and Build
shell: cmd
run: |
7z x -y dep.7z -otools
7z x -y dep_gpl.7z -otools
set PKG_CONFIG_PATH_MFX=%CD%\tools\dep\VS2022\lib\pkgconfig
set MSYS2_DIR=C:\msys64
set HOME=%CD%
set FFSRC=%CD%\ffmpeg-%FF_VERSION%
set BUILD_NOW=true
tools\vcbuild.bat VS2022 %TARGET_OS%10 x64
- name: Make SDK
shell: cmd
run: |
set SDK_NAME=ffmpeg-%FF_VERSION%-%TARGET_OS%-vs2022%CONFIG_SUFFIX%
move sdk* %SDK_NAME%
xcopy /s /f /y tools\dep_gpl\${{ env.TARGET_OS }}\lib\* %SDK_NAME%\lib\
7z a -ssc -m0=lzma2 -mx=9 -ms=on -mf=off %SDK_NAME%.7z %SDK_NAME%
- name: Archieve SDK
uses: actions/upload-artifact@v4
with:
name: ffmpeg-${{ env.FF_VERSION }}-${{ env.TARGET_OS }}-VS2022${{ matrix.config }}
path: ffmpeg-*.7z
Windows_clang:
runs-on: ubuntu-latest
env:
TARGET_OS: ${{ matrix.target }}
COMPILER: clang
VCDIR: '/tmp/msvcrt-dev'
WINDOWSSDKDIR: '/tmp/winsdk'
PKG_CONFIG_PATH_MFX: '/tmp/dep/ClangCL/lib/pkgconfig'
AMF_DIR: "/tmp/dep/include"
CONFIG_SUFFIX: -gpl-${{ matrix.config }}
strategy:
fail-fast: false
matrix:
config: [lite]
target: [windows-desktop]
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: 'Restore sysroot cache'
id: sysroot-cache
uses: actions/cache@v4
with:
path: |
/tmp/winsdk
/tmp/msvcrt-dev
key: sysroot-${{ env.TARGET_OS }}${{ vars.WINSDKVER }}-vc${{ vars.VCVER }}
- name: Create Build Environment
shell: bash
env:
DEVTOOLS_CACHE_HIT: ${{ steps.devtools-cache.outputs.cache-hit }}
SYSROOT_CACHE_HIT: ${{ steps.sysroot-cache.outputs.cache-hit }}
EXTERNAL_DEP_CACHE_HIT: ${{ steps.external-dep-cache.outputs.cache-hit }}
run: |
sudo apt remove -y libc++1-14 libc++abi1-14 libunwind-14 python3-lldb-14 # conflict with latest llvm
./tools/ci-before-build.sh
wget https://sourceforge.net/projects/avbuild/files/dep/dep_gpl.7z/download -O dep_gpl.7z
7z x -y dep_gpl.7z -otools
sed -i '/X264_API_IMPORTS/d' "ffmpeg-${FF_VERSION}/libavcodec/libx264.c" # we link against static libx264
- name: Configure and Build
shell: bash
run: |
export FFSRC=$PWD/ffmpeg-${FF_VERSION}
export WindowsSdkDir=${WINDOWSSDKDIR}
export WindowsSDKVersion=$(cat ${WINDOWSSDKDIR}/.version)
USE_TOOLCHAIN=clang-${LLVM_VER:-$LLVM_VER_DEFAULT} ./avbuild.sh $TARGET_OS "x64 arm64"
- name: Make SDK
shell: bash
run: |
cp -avf tools/dep_gpl/${{ env.TARGET_OS }}/lib/* sdk-*/lib/x64
cp -avf tools/dep_gpl/${{ env.TARGET_OS }}/arm64/lib/* sdk-*/lib/arm64
./tools/ci-after-build.sh
- name: Archieve SDK
uses: actions/upload-artifact@v4
with:
name: ffmpeg-${{ env.FF_VERSION }}-${{ env.TARGET_OS }}-${{ matrix.config }}
path: ffmpeg-*.tar.xz
Linux_clang:
runs-on: ubuntu-latest
env:
TARGET_OS: linux
COMPILER: clang
PKG_CONFIG_PATH_MFX: "/tmp/dep/linux64-gcc/lib/pkgconfig"
AMF_DIR: "/tmp/dep/include"
CONFIG_SUFFIX: -gpl-${{ matrix.config }}
strategy:
fail-fast: false
matrix:
config: [lite]
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: 'Restore sysroot cache'
id: sysroot-cache
uses: actions/cache@v4
with:
path: /tmp/sysroot
key: sysroot-${{ env.TARGET_OS }}-${{ vars.LINUX_SYSROOT_ID }}
- name: Create Build Environment
shell: bash
env:
DEVTOOLS_CACHE_HIT: ${{ steps.devtools-cache.outputs.cache-hit }}
SYSROOT_CACHE_HIT: ${{ steps.sysroot-cache.outputs.cache-hit }}
EXTERNAL_DEP_CACHE_HIT: ${{ steps.external-dep-cache.outputs.cache-hit }}
run: |
sudo apt remove -y libc++1-14 libc++abi1-14 libunwind-14 python3-lldb-14 # conflict with latest llvm
./tools/ci-before-build.sh
wget https://sourceforge.net/projects/avbuild/files/dep/dep_gpl.7z/download -O dep_gpl.7z
7z x -y dep_gpl.7z -otools
- name: Configure and Build
shell: bash
run: |
export FFSRC=$PWD/ffmpeg-${FF_VERSION}
export SYSROOT=/tmp/sysroot
USE_TOOLCHAIN=clang-${LLVM_VER:-$LLVM_VER_DEFAULT} ./avbuild.sh linux "amd64 arm64"
- name: Make SDK
shell: bash
run: |
cp -avf tools/dep_gpl/${{ env.TARGET_OS }}_amd64/lib/* sdk-*/lib/amd64
cp -avf tools/dep_gpl/${{ env.TARGET_OS }}_arm64/lib/* sdk-*/lib/arm64
./tools/ci-after-build.sh
- name: Archieve SDK
uses: actions/upload-artifact@v4
with:
name: ffmpeg-${{ env.FF_VERSION }}-${{ env.TARGET_OS }}-${{ matrix.config }}
path: ffmpeg-*.tar.xz
Android:
runs-on: macos-latest
env:
TARGET_OS: android
CONFIG_SUFFIX: -gpl-${{ matrix.config }}
strategy:
fail-fast: false
matrix:
config: [lite]
steps:
- uses: actions/checkout@v4
- name: 'Restore sysroot cache'
id: sysroot-cache
uses: actions/cache@v4
with:
path: /tmp/sysroot
key: sysroot-${{ env.TARGET_OS }}-${{ vars.LINUX_SYSROOT_ID }}
- name: Create Build Environment
shell: bash
env:
DEVTOOLS_CACHE_HIT: ${{ steps.devtools-cache.outputs.cache-hit }}
SYSROOT_CACHE_HIT: ${{ steps.sysroot-cache.outputs.cache-hit }}
EXTERNAL_DEP_CACHE_HIT: ${{ steps.external-dep-cache.outputs.cache-hit }}
run: |
./tools/ci-before-build.sh
wget https://sourceforge.net/projects/avbuild/files/dep/dep_gpl.7z/download -O dep_gpl.7z
7z x -y dep_gpl.7z -otools
- name: Configure and Build
shell: bash
run: |
export ANDROID_NDK=$ANDROID_NDK_LATEST_HOME
export FFSRC=$PWD/ffmpeg-${FF_VERSION}
./avbuild.sh ${TARGET_OS} arm64
- name: Make SDK
shell: bash
run: |
cp -avf tools/dep_gpl/${{ env.TARGET_OS }}_arm64/lib/* sdk-*/lib/
./tools/ci-after-build.sh
- name: Archieve SDK
uses: actions/upload-artifact@v4
with:
name: ffmpeg-${{ env.FF_VERSION }}-${{ env.TARGET_OS }}-${{ matrix.config }}
path: ffmpeg-*.tar.xz
Upload:
runs-on: ubuntu-latest
needs: [VS2022]
steps:
- name: Download vs2022 desktop lite
uses: actions/download-artifact@v4
with:
name: ffmpeg-${{ env.FF_VERSION }}-windows-desktop-VS2022lite
- name: Upload to SourceForge
if: (github.event_name != 'pull_request')
shell: bash
run: |
sudo apt update
sudo apt install -y sshpass
FFV=${{ env.FF_VERSION }}
for f in `ls ffmpeg-*.7z`; do
OS=${f%%-vs*}
OS=${OS##*${FFV}-}
sshpass -p $SF_PW_MAPPED scp -o StrictHostKeyChecking=no $f $SF_USER_MAPPED,[email protected]:/home/frs/project/a/av/avbuild/$OS
done