@@ -21,6 +21,7 @@ concurrency:
21
21
cancel-in-progress : true
22
22
23
23
env :
24
+ FREEBSD_CLANG_VERSION : 19
24
25
LINUX_GCC_VERSION : 12
25
26
MACOSX_DEPLOYMENT_TARGET : 13.0
26
27
@@ -78,16 +79,30 @@ jobs:
78
79
shell : msys2 {0}
79
80
msystem : clangarm64
80
81
toolchain : clang-aarch64
82
+ - name : FreeBSD-amd64
83
+ os : ubuntu-latest
84
+ arch : x86_64
85
+ bsd_release : ' 14.3'
86
+ generator : " Unix Makefiles"
87
+ shell : freebsd {0}
88
+ - name : FreeBSD-aarch64
89
+ os : ubuntu-latest # ubuntu-24.04-arm is slower with the FreeBSD VM
90
+ arch : aarch64
91
+ bsd_release : ' 14.3'
92
+ generator : " Unix Makefiles"
93
+ shell : freebsd {0}
81
94
defaults :
82
95
run :
83
96
shell : ${{ matrix.shell }}
84
97
steps :
85
98
- name : Checkout
86
99
uses : actions/checkout@v4
100
+ with :
101
+ submodules : recursive
87
102
88
103
- name : Prepare Dependencies Linux
89
104
id : cross_compile
90
- if : runner.os == 'Linux'
105
+ if : runner.os == 'Linux' && !startsWith(matrix.shell, 'freebsd')
91
106
run : |
92
107
echo "::group::distro detection"
93
108
# detect dist name like bionic, focal, etc
@@ -254,7 +269,7 @@ jobs:
254
269
echo "::endgroup::"
255
270
256
271
- name : Setup Dependencies Linux
257
- if : runner.os == 'Linux'
272
+ if : runner.os == 'Linux' && !startsWith(matrix.shell, 'freebsd')
258
273
run : |
259
274
echo "::group::apt update"
260
275
sudo apt-get update
@@ -363,22 +378,59 @@ jobs:
363
378
echo "MSYS2_ROOT=${{ runner.temp }}/msys64" >> $GITHUB_ENV
364
379
cat "${{ runner.temp }}/setup-msys2/msys2.CMD"
365
380
366
- - name : Initialize Submodules
367
- # libx265 has issues when using the recursive method of the first checkout action
368
- # this is after `msys2/setup-msys2@v2` because `msys2` (default) shell is not available until then.
369
- run : |
370
- git submodule update --init --recursive
381
+ - name : Setup FreeBSD
382
+ if : startsWith(matrix.shell, 'freebsd')
383
+
384
+ with :
385
+ arch : ${{ matrix.arch }}
386
+ prepare : |
387
+ pkg install -y \
388
+ devel/autoconf \
389
+ devel/automake \
390
+ devel/cmake \
391
+ devel/git \
392
+ devel/gmake \
393
+ devel/llvm${{ env.FREEBSD_CLANG_VERSION }} \
394
+ devel/nasm \
395
+ devel/ninja \
396
+ devel/pkgconf \
397
+ multimedia/libass \
398
+ multimedia/libv4l \
399
+ multimedia/libva \
400
+ multimedia/v4l_compat \
401
+ print/freetype2 \
402
+ security/gnutls \
403
+ shells/bash \
404
+ x11/libx11 \
405
+ x11/libxcb \
406
+ x11/libXfixes
407
+
408
+ # create symlink for shebang bash compatibility
409
+ ln -s /usr/local/bin/bash /bin/bash
410
+ release : ${{ matrix.bsd_release }}
411
+ sync : nfs
371
412
372
413
- name : Setup ENV
373
414
id : root
374
415
run : |
416
+ set -e
417
+ cd $GITHUB_WORKSPACE
375
418
echo "ROOT_PATH=$PWD" >> $GITHUB_ENV
376
419
420
+ MAKE_CMD="make"
421
+ if [ "${{ startsWith(matrix.shell, 'freebsd') }}" = true ]; then
422
+ # use gmake on FreeBSD instead of make
423
+ MAKE_CMD="gmake"
424
+ fi
425
+ echo "MAKE_CMD=${MAKE_CMD}" >> $GITHUB_ENV
426
+
377
427
- name : Setup cross compilation
378
428
id : cross
379
429
if : matrix.target != ''
380
430
run : |
381
- TOOLCHAIN=${ROOT_PATH}/cmake/toolchains/${{ matrix.target }}.cmake
431
+ set -e
432
+ cd $GITHUB_WORKSPACE
433
+ TOOLCHAIN=${{ env.ROOT_PATH }}/cmake/toolchains/${{ matrix.target }}.cmake
382
434
383
435
# fail if file does not exist
384
436
if [ ! -f $TOOLCHAIN ]; then
@@ -394,33 +446,76 @@ jobs:
394
446
- name : Get Processor Count
395
447
id : processor_count
396
448
run : |
397
- if [[ ${{ runner.os }} == 'macOS' ]]; then
398
- echo "PROCESSOR_COUNT=$(sysctl -n hw.ncpu)" >> $GITHUB_OUTPUT
449
+ set -e
450
+ cd $GITHUB_WORKSPACE
451
+ if [ "${{ runner.os }}" = 'macOS' ]; then
452
+ PROCESSOR_COUNT=$(sysctl -n hw.ncpu)
399
453
else
400
- echo " PROCESSOR_COUNT=$(nproc)" >> $GITHUB_OUTPUT
454
+ PROCESSOR_COUNT=$(nproc)
401
455
fi
456
+ echo "PROCESSOR_COUNT=${PROCESSOR_COUNT}" >> $GITHUB_OUTPUT
457
+ echo "PROCESSOR_COUNT: $PROCESSOR_COUNT"
458
+
459
+ - name : Get x265 git history
460
+ run : |
461
+ set -e
462
+
463
+ # x265.pc will not be installed if their cmake cannot detect the latest tag
464
+ # SVT-AV1 cannot determine version if the git history is not available
465
+
466
+ for repo in "x265_git" "SVT-AV1"; do
467
+ cd $GITHUB_WORKSPACE/third-party/FFmpeg/$repo
468
+ git config --global --add safe.directory $(pwd)
469
+ git fetch --tags --force origin
470
+ done
402
471
403
472
- name : Configure
404
473
run : |
474
+ set -e
475
+ cd $GITHUB_WORKSPACE
476
+
477
+ if [ "${{ startsWith(matrix.shell, 'freebsd') }}" = true ]; then
478
+ export CC=$(which clang${{ env.FREEBSD_CLANG_VERSION }})
479
+ export CXX=$(which clang++${{ env.FREEBSD_CLANG_VERSION }})
480
+
481
+ # make sure they exist
482
+ if [ ! -f "$CC" ]; then
483
+ echo "Compiler not found: $CC"
484
+ exit 1
485
+ fi
486
+ if [ ! -f "$CXX" ]; then
487
+ echo "Compiler not found: $CXX"
488
+ exit 1
489
+ fi
490
+ fi
491
+
405
492
mkdir -p ./build/dist
406
493
cmake \
407
494
-B build \
408
495
-S . \
409
496
-G "${{ matrix.generator }}" \
410
- -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} \
411
- -DCMAKE_INSTALL_PREFIX="${ROOT_PATH}/build/dist"
497
+ -DCMAKE_TOOLCHAIN_FILE=${{ env.CMAKE_TOOLCHAIN_FILE }} \
498
+ -DCMAKE_INSTALL_PREFIX="${{ env.ROOT_PATH }}/build/dist" \
499
+ -DPARALLEL_BUILDS=${{ steps.processor_count.outputs.PROCESSOR_COUNT || 1 }}
412
500
413
501
- name : Build
414
502
run : |
415
- make -C build -j${{ steps.processor_count.outputs.PROCESSOR_COUNT }}
503
+ set -e
504
+ cd $GITHUB_WORKSPACE
505
+ ${{ env.MAKE_CMD }} -C build --jobs=${{ steps.processor_count.outputs.PROCESSOR_COUNT || 1 }}
416
506
417
507
- name : Install
418
508
run : |
419
- make -C build install
509
+ set -e
510
+ cd $GITHUB_WORKSPACE
511
+ ${{ env.MAKE_CMD }} -C build install
420
512
421
513
- name : Debug logs
422
514
if : always()
423
515
run : |
516
+ set -e
517
+ cd $GITHUB_WORKSPACE
518
+
424
519
echo "::group::x264 config.log"
425
520
cat ./third-party/FFmpeg/x264/config.log || true
426
521
echo "::endgroup::"
@@ -432,20 +527,27 @@ jobs:
432
527
- name : Debug build directory
433
528
if : always()
434
529
run : |
530
+ set -e
531
+ cd $GITHUB_WORKSPACE
435
532
ls -R ./build
436
533
437
534
- name : Debug build/dist directory
438
535
if : always()
439
536
run : |
537
+ set -e
538
+ cd $GITHUB_WORKSPACE
440
539
ls -R ./build/dist
441
540
442
541
- name : Cleanup
443
542
run : |
543
+ set -e
544
+ cd $GITHUB_WORKSPACE
444
545
rm -f -r ./build/dist/share
445
546
446
547
- name : Upload Artifacts
447
548
uses : actions/upload-artifact@v4
448
549
with :
550
+ if-no-files-found : error
449
551
name : ${{ matrix.name }}
450
552
path : ./build/dist
451
553
0 commit comments