-
-
Notifications
You must be signed in to change notification settings - Fork 21
747 lines (678 loc) · 26.8 KB
/
build-ffmpeg.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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
---
name: Build ffmpeg
on:
pull_request:
branches: [master]
types: [opened, synchronize, reopened]
push:
branches: [master]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
ffmpeg:
name: ffmpeg-${{ matrix.os_type }}-${{ matrix.arch }}
# https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
# https://trac.ffmpeg.org/wiki/CompilationGuide/macOS
# https://trac.ffmpeg.org/wiki/CompilationGuide/MinGW
strategy:
fail-fast: false # false to test all, true to fail entire job if any fail
matrix:
include:
- os_type: linux
os: ubuntu-20.04 # pinned until all platforms moved to 22.04
arch: x86_64
shell: bash
cmake_generator: Unix Makefiles
ffmpeg_extras: >-
--enable-amf
--enable-cuda
--enable-cuda_llvm
--enable-encoder=h264_amf,hevc_amf,av1_amf
--enable-encoder=h264_nvenc,hevc_nvenc,av1_nvenc
--enable-encoder=h264_vaapi,hevc_vaapi,av1_vaapi
--enable-encoder=h264_v4l2m2m
--enable-ffnvcodec
--enable-nvenc
--enable-v4l2_m2m
--enable-vaapi
- os_type: linux
os: ubuntu-20.04 # pinned until all platforms moved to 22.04
arch: aarch64
shell: bash
cmake_generator: Unix Makefiles
host: aarch64-linux-gnu
ffmpeg_extras: >-
--enable-amf
--enable-cuda
--enable-cuda_llvm
--enable-encoder=h264_amf,hevc_amf,av1_amf
--enable-encoder=h264_nvenc,hevc_nvenc,av1_nvenc
--enable-encoder=h264_vaapi,hevc_vaapi,av1_vaapi
--enable-encoder=h264_v4l2m2m
--enable-ffnvcodec
--enable-nvenc
--enable-v4l2_m2m
--enable-vaapi
- os_type: linux
os: ubuntu-20.04 # pinned until all platforms moved to 22.04
arch: powerpc64le
shell: bash
cmake_generator: Unix Makefiles
host: powerpc64le-linux-gnu
ffmpeg_extras: >-
--enable-amf
--enable-cuda
--enable-cuda_llvm
--enable-encoder=h264_amf,hevc_amf,av1_amf
--enable-encoder=h264_nvenc,hevc_nvenc,av1_nvenc
--enable-encoder=h264_vaapi,hevc_vaapi,av1_vaapi
--enable-encoder=h264_v4l2m2m
--enable-ffnvcodec
--enable-nvenc
--enable-v4l2_m2m
--enable-vaapi
- os_type: macos
os: macos-11
arch: x86_64
shell: bash
cmake_generator: Unix Makefiles # should be `Xcode` but that fails
ffmpeg_extras: >-
--enable-encoder=h264_videotoolbox,hevc_videotoolbox
--enable-videotoolbox
- os_type: macos
os: macos-11
arch: aarch64
shell: bash
cmake_generator: Unix Makefiles # should be `Xcode` but that fails
host: arm64-apple-macosx
ffmpeg_extras: >-
--enable-encoder=h264_videotoolbox,hevc_videotoolbox
--enable-videotoolbox
- os_type: windows
os: windows-2022
arch: x86_64
shell: msys2 {0}
cmake_generator: MSYS Makefiles
ffmpeg_extras: >-
--enable-amf
--enable-cuda
--enable-d3d11va
--enable-encoder=h264_amf,hevc_amf,av1_amf
--enable-encoder=h264_mf,hevc_mf
--enable-encoder=h264_nvenc,hevc_nvenc,av1_nvenc
--enable-encoder=h264_qsv,hevc_qsv,av1_qsv
--enable-ffnvcodec
--enable-libvpl
--enable-nvenc
--enable-mediafoundation
runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ matrix.shell }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout destination branch
uses: actions/checkout@v4
with:
ref: ffmpeg-${{ matrix.os_type }}-${{ matrix.arch }}
path: ffmpeg-${{ matrix.os_type }}-${{ matrix.arch }}
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of the personal token
fetch-depth: 0 # otherwise, will fail to push refs to dest repo
- name: Setup Dependencies Unix
if: ${{ matrix.os_type != 'windows' }}
run: |
echo "::group::dependencies prep"
if [[ ${{ matrix.os }} == "ubuntu-18.04" ]]; then
dist="bionic"
elif [[ ${{ matrix.os }} == "ubuntu-20.04" ]]; then
dist="focal"
elif [[ ${{ matrix.os }} == "ubuntu-22.04" ]]; then
dist="jammy"
fi
package_arch="amd64"
if [[ ${{ matrix.arch }} == "aarch64" ]]; then
package_arch="arm64"
elif [[ ${{ matrix.arch }} == "powerpc64le" ]]; then
package_arch="ppc64el"
fi
mirror="http://ports.ubuntu.com/ubuntu-ports"
extra_sources=$(cat <<- VAREOF
deb [arch=$package_arch] $mirror $dist main restricted
deb [arch=$package_arch] $mirror $dist-updates main restricted
deb [arch=$package_arch] $mirror $dist universe
deb [arch=$package_arch] $mirror $dist-updates universe
deb [arch=$package_arch] $mirror $dist multiverse
deb [arch=$package_arch] $mirror $dist-updates multiverse
deb [arch=$package_arch] $mirror $dist-backports main restricted universe multiverse
deb [arch=$package_arch] $mirror $dist-security main restricted
deb [arch=$package_arch] $mirror $dist-security universe
deb [arch=$package_arch] $mirror $dist-security multiverse
VAREOF
)
echo "::endgroup::"
if [[ ${{ matrix.os_type }} == "linux" ]]; then
echo "::group::linux dependencies"
if [[ ${{ matrix.os }} == "ubuntu-20.04" ]]; then
# activate mesa backport PPA to ensure ffmpeg builds with vaSyncBuffer()
# (via libva 2.9.0 or later)
sudo add-apt-repository ppa:kisak/turtle -y
fi
if [[ $package_arch != "amd64" ]]; then
# fix original sources
sudo sed -i -e "s#deb http#deb [arch=amd64] http#g" /etc/apt/sources.list
sudo dpkg --add-architecture $package_arch
echo "$extra_sources" | sudo tee -a /etc/apt/sources.list
echo "----"
sudo cat /etc/apt/sources.list
fi
sudo apt-get update -q && sudo apt-get -y install \
autoconf \
automake \
build-essential \
cmake \
git-core \
libass-dev \
libfreetype6-dev \
libgnutls28-dev \
libmp3lame-dev \
libnuma-dev \
libopus-dev \
libsdl2-dev \
libtool \
libvorbis-dev \
libxcb1-dev \
libxcb-shm0-dev \
libxcb-xfixes0-dev \
meson \
nasm \
ninja-build \
pkg-config \
texinfo \
wget \
yasm \
zlib1g-dev
if [[ ${{ matrix.arch }} == "powerpc64le" ]]; then
sudo apt-get -y install \
libva-dev:$package_arch \
libva2:$package_arch \
libva-drm2:$package_arch \
libdrm2:$package_arch \
libva-glx2:$package_arch \
libgl1:$package_arch \
libglx0:$package_arch \
libglx-mesa0:$package_arch \
libglapi-mesa:$package_arch \
libgl1-mesa-dri:$package_arch \
libdrm-amdgpu1:$package_arch \
libdrm-nouveau2:$package_arch \
libdrm-radeon1:$package_arch \
libva-wayland2:$package_arch \
libva-x11-2:$package_arch
else
sudo apt-get -y install \
libva-dev:$package_arch
fi
if [[ ${{ matrix.arch }} != "x86_64" ]]; then
sudo apt-get -y install \
binutils-${{ matrix.host }} \
g++-${{ matrix.host }} \
gcc-${{ matrix.host }}
fi
echo "::endgroup::"
elif [[ ${{ matrix.os_type }} == "macos" ]]; then
echo "::group::macos dependencies"
brew install \
automake \
fdk-aac \
git \
lame \
libass \
libtool \
libvorbis \
libvpx \
nasm \
opus \
pkg-config \
sdl \
shtool \
texi2html \
theora \
wget \
yasm \
xvid
echo "::endgroup::"
fi
- name: Setup Dependencies Windows
if: ${{ matrix.os_type == 'windows' }}
uses: msys2/setup-msys2@v2
with:
update: true
install: >-
wget
- name: Update Windows dependencies
if: ${{ matrix.os_type == 'windows' }}
shell: msys2 {0}
run: |
# download working binutils
wget https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-binutils-2.40-4-any.pkg.tar.zst
# install dependencies
pacman -U --noconfirm mingw-w64-x86_64-binutils-2.40-4-any.pkg.tar.zst
pacman -Syu --noconfirm --ignore=mingw-w64-x86_64-binutils \
diffutils \
git \
make \
pkg-config \
mingw-w64-x86_64-cmake \
mingw-w64-x86_64-gcc \
mingw-w64-x86_64-onevpl \
mingw-w64-x86_64-nasm
- name: Initialize Submodules
# libx265 has issues when using the recursive method of the first checkout action
# this is after `msys2/setup-msys2@v2` because `msys2` (default) shell is not available until then.
run: |
git submodule update --init --recursive
- name: Create Directories
id: root
run: |
echo "root_path=$PWD" >> $GITHUB_OUTPUT
mkdir -p ./bin ./ffmpeg_build ./ffmpeg_sources
- name: patch
working-directory: ffmpeg_sources/ffmpeg
run: |
git apply -v --ignore-whitespace ../../ffmpeg_patches/ffmpeg/01-amf-colorspace-v3.patch
git apply -v --ignore-whitespace ../../ffmpeg_patches/ffmpeg/02-idr-on-amf.patch
git apply -v --ignore-whitespace ../../ffmpeg_patches/ffmpeg/03-amfenc-disable-buffering.patch
git apply -v --ignore-whitespace ../../ffmpeg_patches/ffmpeg/04-mfenc-lowlatency.patch
git apply -v --ignore-whitespace ../../ffmpeg_patches/ffmpeg/05-amfenc-new-av1-usages.patch
- name: Setup cross compilation
id: cross
if: ${{ matrix.arch != 'x86_64' }}
run: |
TOOLCHAIN_DIR=${{ steps.root.outputs.root_path }}/cmake/toolchain/${{ matrix.arch }}-${{ matrix.os_type }}
echo "CMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_DIR/crosscompile.cmake" >> $GITHUB_OUTPUT
if [[ ${{ matrix.os_type }} == 'linux' ]]; then
echo "CCPREFIX=/usr/bin/${{ matrix.host }}-" >> $GITHUB_OUTPUT
else
CFLAGS="-arch arm64 -target ${{ matrix.host }} -march=armv8-a+crc+crypto -mcpu=generic"
echo "CFLAGS=${CFLAGS}" >> $GITHUB_OUTPUT
echo "CXXFLAGS=-std=c++11 ${CFLAGS}" >> $GITHUB_OUTPUT
echo "LDFLAGS=-arch arm64 -march=armv8-a+crc+crypto -target ${{ matrix.host }} -lc++" >> $GITHUB_OUTPUT
fi
- name: amf
if: ${{ matrix.os_type != 'macos' }}
# https://ffmpeg.org/general.html#AMD-AMF_002fVCE
run: |
mkdir -p ./ffmpeg_build/include/AMF
cp -av "./ffmpeg_sources/AMF/amf/public/include/." "./ffmpeg_build/include/AMF"
- name: av1
working-directory: ffmpeg_sources/SVT-AV1/Build
env:
root_path: ${{ steps.root.outputs.root_path }}
CCPREFIX: ${{ steps.cross.outputs.CCPREFIX }}
run: |
echo "::group::configure extra flags for cross compilation"
extra_configure=""
if [[ ${{ matrix.arch }} != "x86_64" ]]; then
if [[ ${{ matrix.os_type }} == "macos" ]]; then
export CFLAGS="${{ steps.cross.outputs.CFLAGS }}"
export CXXFLAGS="${{ steps.cross.outputs.CXXFLAGS }}"
export LDFLAGS="${{ steps.cross.outputs.LDFLAGS }}"
fi
extra_configure=$(cat <<- VAREOF
-DCMAKE_TOOLCHAIN_FILE=${{ steps.cross.outputs.CMAKE_TOOLCHAIN_FILE }}
VAREOF
)
fi
echo "$extra_configure"
echo "::endgroup::"
echo "::group::configure"
PATH="$root_path/bin:$PATH" cmake -G "${{ matrix.cmake_generator }}" \
$extra_configure \
-DCMAKE_INSTALL_PREFIX="$root_path/ffmpeg_build" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_APPS=OFF \
-DBUILD_DEC=OFF \
-DENABLE_AVX512=ON \
-DBUILD_SHARED_LIBS=OFF \
..
echo "::endgroup::"
echo "::group::make"
PATH="$root_path/bin:$PATH" make -j$(nproc || sysctl -n hw.logicalcpu)
echo "::endgroup::"
echo "::group::make install"
make install
echo "::endgroup::"
- name: libx264
env:
root_path: ${{ steps.root.outputs.root_path }}
CCPREFIX: ${{ steps.cross.outputs.CCPREFIX }}
working-directory: ffmpeg_sources/x264
run: |
echo "::group::configure options"
./configure --help || true # this command has a non zero exit status, but we should continue anyway
echo "::endgroup::"
echo "::group::configure extra flags for cross compilation"
extra_configure=""
if [[ ${{ matrix.os_type }} == "linux" && ${{ matrix.arch }} != "x86_64" ]]; then
extra_configure=$(cat <<- VAREOF
--host=${{ matrix.arch }}-${{ matrix.os_type }}
--cross-prefix=${CCPREFIX}
VAREOF
)
elif [[ ${{ matrix.os_type }} == "macos" && ${{ matrix.arch }} != "x86_64" ]]; then
export CC="clang"
export CFLAGS="${{ steps.cross.outputs.CFLAGS }}"
extra_configure=$(cat <<- VAREOF
--host=${{ matrix.arch }}-darwin
VAREOF
)
fi
echo "$extra_configure"
echo "::endgroup::"
echo "::group::configure"
PATH="$root_path/bin:$PATH" \
PKG_CONFIG_PATH="$root_path/ffmpeg_build/lib/pkgconfig" \
./configure \
$extra_configure \
--prefix="$root_path/ffmpeg_build" \
--bindir="$root_path/bin" \
--disable-cli \
--enable-static
echo "::endgroup::"
echo "::group::make"
PATH="$root_path/bin:$PATH" make -j$(nproc || sysctl -n hw.logicalcpu)
echo "::endgroup::"
echo "::group::make install"
make install
echo "::endgroup::"
- name: libx265
env:
root_path: ${{ steps.root.outputs.root_path }}
CCPREFIX: ${{ steps.cross.outputs.CCPREFIX }}
working-directory: ffmpeg_sources/x265_git
run: |
echo "::group::configure extra flags for cross compilation"
# not currently supported in `aarch64`
extra_configure="-DENABLE_HDR10_PLUS=1"
if [[ ${{ matrix.os_type }} == "linux" && ${{ matrix.arch }} != "x86_64" ]]; then
if [[ ${{ matrix.arch }} == "powerpc64le" ]]; then
extra_configure="-DCMAKE_TOOLCHAIN_FILE=${{ steps.cross.outputs.CMAKE_TOOLCHAIN_FILE }}"
else
extra_configure="-DCMAKE_TOOLCHAIN_FILE=build/${{ matrix.arch }}-${{ matrix.os_type }}/crosscompile.cmake"
fi
elif [[ ${{ matrix.os_type }} == "macos" && ${{ matrix.arch }} != "x86_64" ]]; then
export CFLAGS="${{ steps.cross.outputs.CFLAGS }}"
export CXXFLAGS="${{ steps.cross.outputs.CXXFLAGS }}"
extra_configure=$(cat <<- VAREOF
-DENABLE_ASSEMBLY=0
-DCMAKE_TOOLCHAIN_FILE=${{ steps.cross.outputs.CMAKE_TOOLCHAIN_FILE }}
VAREOF
)
fi
echo "$extra_configure"
echo "::endgroup::"
echo "::group::configure"
PATH="$root_path/bin:$PATH" cmake -G "${{ matrix.cmake_generator }}" \
$extra_configure \
-DCMAKE_INSTALL_PREFIX="$root_path/ffmpeg_build" \
-DENABLE_CLI=OFF \
-DENABLE_SHARED=OFF \
-DSTATIC_LINK_CRT=ON \
./source
echo "::endgroup::"
echo "::group::make"
PATH="$root_path/bin:$PATH" make -j$(nproc || sysctl -n hw.logicalcpu)
echo "::endgroup::"
echo "::group::make install"
make install
echo "::endgroup::"
- name: nvenc
id: nvenc
if: ${{ matrix.os_type != 'macos' }}
env:
root_path: ${{ steps.root.outputs.root_path }}
working-directory: ffmpeg_sources/nv-codec-headers
# https://trac.ffmpeg.org/wiki/HWAccelIntro#NVENC
run: |
echo "::group::patch Makefile"
# allow `PREFIX` to be overridden
sed -i 's/PREFIX =/PREFIX ?=/g' Makefile
echo "::endgroup::"
echo "::group::make"
PREFIX=$root_path/ffmpeg_build make -j$(nproc || sysctl -n hw.logicalcpu)
echo "::endgroup::"
echo "::group::make install"
PREFIX=$root_path/ffmpeg_build make install
echo "::endgroup::"
- name: ffmpeg
env:
root_path: ${{ steps.root.outputs.root_path }}
working-directory: ffmpeg_sources/ffmpeg
run: |
echo "::group::configure options"
./configure --help || true # this command has a non zero exit status, but we should continue anyway
echo "::endgroup::"
echo "::group::configure extra flags for cross compilation"
extra_configure=""
if [[ ${{ matrix.os_type }} == "linux" && ${{ matrix.arch }} != "x86_64" ]]; then
CCPREFIX=${{ steps.cross.outputs.CCPREFIX }}
extra_configure=$(cat <<- VAREOF
--arch=${{ matrix.arch }}
--cross-prefix=${CCPREFIX}
--enable-cross-compile
--target-os=${{ matrix.os_type }}
VAREOF
)
elif [[ ${{ matrix.os_type }} == "macos" && ${{ matrix.arch }} != "x86_64" ]]; then
export CFLAGS="${{ steps.cross.outputs.CFLAGS }}"
export CXXFLAGS="${{ steps.cross.outputs.CXXFLAGS }}"
export LDFLAGS="${{ steps.cross.outputs.LDFLAGS }}"
extra_configure=$(cat <<- VAREOF
--arch=${{ matrix.arch }}
--cc=clang
--cxx=clang++
--target-os=darwin
--enable-cross-compile
--disable-neon
VAREOF
)
fi
echo "$extra_configure"
echo "::endgroup::"
echo "::group::configure"
set +e # do not fail
PATH="$root_path/bin:$PATH" \
PKG_CONFIG_PATH="$root_path/ffmpeg_build/lib/pkgconfig:/usr/lib/${{ matrix.host }}/pkgconfig" \
./configure \
$extra_configure \
--prefix="$root_path/ffmpeg_build" \
--pkg-config-flags="--static" \
--extra-cflags="-I$root_path/ffmpeg_build/include" \
--extra-ldflags="-L$root_path/ffmpeg_build/lib" \
--extra-libs="-lpthread -lm" \
--bindir="$root_path/bin" \
--disable-all \
--disable-autodetect \
--disable-iconv \
--enable-avcodec \
--enable-encoder=libsvtav1 \
--enable-encoder=libx264,libx265 \
--enable-gpl \
--enable-libsvtav1 \
--enable-libx264 \
--enable-libx265 \
--enable-static \
--enable-swscale \
--pkg-config=pkg-config \
${{ matrix.ffmpeg_extras }} \
|| config_error=true
set -e # reset fail on error
echo "::endgroup::"
echo "::group::config error log"
cat ./ffbuild/config.log
if [ $config_error ]
then
exit -1
fi
echo "::endgroup::"
echo "::group::make"
PATH="$root_path/bin:$PATH" make -j$(nproc || sysctl -n hw.logicalcpu)
echo "::endgroup::"
echo "::group::make install"
make install
echo "::endgroup::"
echo "::group::copy license"
cp ./COPYING.GPLv2 $root_path/ffmpeg_build/LICENSE
echo "::endgroup::"
- name: cbs
env:
root_path: ${{ steps.root.outputs.root_path }}
run: |
mkdir -p build
cd build
echo "::group::configure extra flags for cross compilation"
extra_configure=""
if [[ ${{ matrix.arch }} != "x86_64" ]]; then
if [[ ${{ matrix.os_type }} == "macos" ]]; then
export CFLAGS="${{ steps.cross.outputs.CFLAGS }}"
export CXXFLAGS="${{ steps.cross.outputs.CXXFLAGS }}"
export LDFLAGS="${{ steps.cross.outputs.LDFLAGS }}"
fi
extra_configure=$(cat <<- VAREOF
-DCMAKE_TOOLCHAIN_FILE=${{ steps.cross.outputs.CMAKE_TOOLCHAIN_FILE }}
VAREOF
)
fi
echo "$extra_configure"
echo "::endgroup::"
echo "::group::configure"
PATH="$root_path/bin:$PATH" cmake -G "${{ matrix.cmake_generator }}" \
$extra_configure \
-DCMAKE_INSTALL_PREFIX="$root_path/ffmpeg_build" \
-DFFMPEG_CBS=ON \
..
echo "::endgroup::"
echo "::group::make"
PATH="$root_path/bin:$PATH" make -j$(nproc || sysctl -n hw.logicalcpu)
echo "::endgroup::"
echo "::group::make install"
make install
echo "::endgroup::"
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: ffmpeg-${{ matrix.os_type }}-${{ matrix.arch }}
path: |
./ffmpeg_build/
- name: Get current date
id: date
run: |
echo "date=$(date +'%Y-%m-%d')"
echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Prepare dependency branch
run: |
echo "::group::cleanup build"
rm -f -r ./ffmpeg_build/share
rm -f -r ./ffmpeg_build/lib/pkgconfig
echo "::endgroup::"
echo "::group::empty contents"
rm -f -r ./ffmpeg-${{ matrix.os_type }}-${{ matrix.arch }}/*
echo "::endgroup::"
echo "::group::copy build back to dependency branch"
cp -f -r ./ffmpeg_build/. ./ffmpeg-${{ matrix.os_type }}-${{ matrix.arch }}/
echo "::endgroup::"
- name: Commit build
if: >-
github.ref == 'refs/heads/master' &&
(github.event_name == 'push' || github.event_name == 'workflow_dispatch')
uses: actions-js/[email protected]
with:
github_token: ${{ secrets.GH_BOT_TOKEN }}
author_email: ${{ secrets.GH_BOT_EMAIL }}
author_name: ${{ secrets.GH_BOT_NAME }}
directory: ffmpeg-${{ matrix.os_type }}-${{ matrix.arch }}
branch: ffmpeg-${{ matrix.os_type }}-${{ matrix.arch }}
force: false
message: update-${{ steps.date.outputs.date }}
update_sunshine:
if: >-
startsWith(github.repository, 'LizardByte/') &&
github.ref == 'refs/heads/master' && github.event_name == 'push'
runs-on: ubuntu-latest
needs: [ffmpeg]
env:
update_branch: update/ffmpeg-submodules
submodule_dir: third-party
steps:
- name: Checkout Sunshine
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/Sunshine
submodules: recursive
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of the personal token
fetch-depth: 0 # otherwise, will fail to push refs to dest repo
- name: Update submodules
run: |
# list of submodules
SUBMODULES=$(cat <<- VAREOF
ffmpeg-linux-aarch64
ffmpeg-linux-powerpc64le
ffmpeg-linux-x86_64
ffmpeg-macos-aarch64
ffmpeg-macos-x86_64
ffmpeg-windows-x86_64
VAREOF
)
echo "::group::git checkout"
git branch -d ${{ env.update_branch }} || true
git checkout -b ${{ env.update_branch }}
echo "::endgroup::"
echo "::group::update submodules"
for SUBMODULE in ${SUBMODULES}; do
# add submodules if it doesn't exist or update it
git submodule add -b ${SUBMODULE} \
${{ github.event.repository.svn_url }} ${{ env.submodule_dir }}/${SUBMODULE} || \
git submodule update --remote ${{ env.submodule_dir }}/${SUBMODULE}
done
echo "::endgroup::"
- name: git diff
id: git_diff
run: |
git_diff=$(git diff)
if [[ ${git_diff} == "" ]]; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Commit changes
# this if statement is probably useless as it will not push if working tree is clean
if: ${{ steps.git_diff.outputs.changed == 'true' }}
uses: actions-js/[email protected]
with:
repository: ${{ github.repository_owner }}/Sunshine
github_token: ${{ secrets.GH_BOT_TOKEN }}
author_email: ${{ secrets.GH_BOT_EMAIL }}
author_name: ${{ secrets.GH_BOT_NAME }}
directory: .
branch: ${{ env.update_branch }}
force: true
message: Bump ffmpeg
# todo - this action is archived, they recommend using gh cli
- name: Create Pull Request
if: ${{ steps.git_diff.outputs.changed == 'true' }}
uses: repo-sync/pull-request@v2
with:
destination_repository: ${{ github.repository_owner }}/Sunshine
source_branch: ${{ env.update_branch }}
destination_branch: nightly # todo - change to master after default branch is changed in Sunshine
pr_title: "Bump ffmpeg"
pr_body: |
Bump ffmpeg with changes from ${{ github.repository }}
pr_assignee: ${{ secrets.GH_BOT_NAME }}
pr_draft: false
pr_label: "dependencies,submodules"
pr_allow_empty: false
github_token: ${{ secrets.GH_BOT_TOKEN }}