170 lines
11 KiB
YAML
170 lines
11 KiB
YAML
name: 'Build FFmpeg'
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
env:
|
|
type: string
|
|
required: true
|
|
default: 'windows-2022'
|
|
description: 'Environment'
|
|
|
|
source:
|
|
type: choice
|
|
required: true
|
|
default: 'ffmpeg'
|
|
description: Source
|
|
options:
|
|
- ffmpeg
|
|
- cartwheel
|
|
|
|
type:
|
|
type: choice
|
|
required: true
|
|
default: 'static'
|
|
description: Type
|
|
options:
|
|
- static
|
|
- shared
|
|
|
|
config:
|
|
type: choice
|
|
required: true
|
|
default: 'debug'
|
|
description: 'Configuration'
|
|
options:
|
|
- debug
|
|
- release
|
|
|
|
ffmpegRef:
|
|
type: string
|
|
required: true
|
|
default: 'release/5.0'
|
|
description: 'FFmpeg refId'
|
|
|
|
nvencRef:
|
|
type: string
|
|
required: true
|
|
default: 'sdk/9.1'
|
|
description: 'NVENC refId'
|
|
|
|
amfRef:
|
|
type: string
|
|
required: true
|
|
default: 'master'
|
|
description: 'AMF refId'
|
|
|
|
env:
|
|
vsPath: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\
|
|
#switches: "--enable-libvpl --enable-libsvtav1 --enable-libsnappy --enable-libmp3lame --enable-libzimg --enable-libopus --enable-libvorbis --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvpx "
|
|
switches: "--enable-libvpl"
|
|
NASM_EXECUTABLE: nasm
|
|
cFlags: ${{ inputs.config == 'release' && '-MD' || '-MDd' }}
|
|
variant: ${{ inputs.type == 'static' && ' --pkg-config-flags="--static" --disable-shared --enable-static' || ' --disable-static --enable-shared' }}
|
|
|
|
jobs:
|
|
libvpl:
|
|
runs-on: ${{ inputs.env }}
|
|
steps:
|
|
- name: Set up GIT
|
|
run: |
|
|
git config --global core.autocrlf false
|
|
git config --global core.eol lf
|
|
- name: Checkout oneVPL
|
|
uses: actions/checkout@v3.0.0
|
|
with:
|
|
repository: oneapi-src/oneVPL
|
|
ref: master
|
|
path: onevpl
|
|
- name: Check cache
|
|
id: libvpl-cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: dist
|
|
key: libvpl-${{ inputs.env }}-${{ inputs.config }}-${{ hashFiles('onevpl') }}
|
|
- name: Set up MSYS2
|
|
if: steps.libvpl-cache.outputs.cache-hit != 'true'
|
|
uses: msys2/setup-msys2@v2
|
|
with:
|
|
install: base-devel binutils autotools automake
|
|
path-type: inherit
|
|
- name: Build oneVPL
|
|
if: steps.libvpl-cache.outputs.cache-hit != 'true'
|
|
shell: cmd
|
|
run: |
|
|
call "${{ env.vsPath }}VC\Auxiliary\Build\vcvars64.bat"
|
|
md temp build dist
|
|
cd temp
|
|
cmake.exe -G "Visual Studio 17 2022" ..\onevpl -T host=x64 -A x64 -DBUILD_TOOLS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=..\build -DCMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD=ON
|
|
MSBuild.exe -t:VPL,INSTALL -p:Configuration=${{ inputs.config }} -m vpl.sln
|
|
cd ..\build
|
|
IF EXIST "lib\vpld.lib" move "lib\vpld.lib" "lib\vpl.lib"
|
|
D:\a\_temp\setup-msys2\msys2.cmd -c 'rm -rf bin/cmake ; tar czf ../dist/libvpl.tgz *'
|
|
- name: Publish artifact
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: libvpl
|
|
path: dist/libvpl.tgz
|
|
|
|
ffmpeg:
|
|
runs-on: windows-2022
|
|
#needs: [libopus,libvpl,libsvtav1,libsnappy,libmp3lame,libzimg,liboggvorbis,libx264,libx265,libfdkaac,libvpx]
|
|
steps:
|
|
- name: Set up MSYS2
|
|
uses: msys2/setup-msys2@v2
|
|
with:
|
|
install: base-devel binutils mingw-w64-x86_64-cmake nasm
|
|
path-type: inherit
|
|
- name: Set up GIT
|
|
run: |
|
|
git config --global core.autocrlf false
|
|
git config --global core.eol lf
|
|
git config --global user.email "daniel.stankewitz@gmail.com"
|
|
git config --global user.name "Daniel Stankewitz"
|
|
- name: Checkout patches
|
|
uses: actions/checkout@v3.0.0
|
|
- name: Checkout FFmpeg
|
|
if: ${{ inputs.source == 'ffmpeg' }}
|
|
uses: actions/checkout@v3.0.0
|
|
with:
|
|
repository: FFmpeg/FFmpeg.git
|
|
ref: ${{ inputs.ffmpegRef }}
|
|
path: ffmpeg
|
|
- name: Checkout NvEnc
|
|
uses: actions/checkout@v3.0.0
|
|
with:
|
|
repository: FFmpeg/nv-codec-headers
|
|
ref: ${{ inputs.nvencRef }}
|
|
path: nvenc
|
|
- name: Checkout AMF
|
|
uses: actions/checkout@v3.0.0
|
|
with:
|
|
repository: GPUOpen-LibrariesAndSDKs/AMF
|
|
ref: ${{ inputs.amfRef }}
|
|
path: amf
|
|
- name: Set up artifacts
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
path: build_artifacts
|
|
- name: Build FFmpeg
|
|
if: ${{ inputs.source == 'ffmpeg' }}
|
|
shell: cmd
|
|
run: |
|
|
call "${{ env.vsPath }}VC\Auxiliary\Build\vcvars64.bat"
|
|
md build dist
|
|
D:\a\_temp\setup-msys2\msys2.cmd -c 'cd ffmpeg ; git apply --ignore-whitespace --verbose ../0003-dynamic-loading-of-shared-fdk-aac-library-5.0.patch ; sed -i "s/#define X264_API_IMPORTS 1/\/\/#define X264_API_IMPORTS 1/g" libavcodec/libx264.c ; cd ../build ; for file in `ls ../build_artifacts/**/*.tgz`; do tar -xzf $file; done ; rm -f bin/*.dll ; cd ../nvenc ; make PREFIX=../build install ; cp -a ../amf/amf/public/include ../build/include/AMF ; cd ../ffmpeg ; PKG_CONFIG_PATH=../build/lib/pkgconfig ./configure --toolchain=msvc --extra-cflags="${{ env.cFlags }} -I../build/include" --extra-ldflags="-LIBPATH:../build/lib" --prefix=../build --pkg-config-flags="--static" --disable-doc --disable-shared --enable-static --enable-runtime-cpudetect --disable-devices --disable-demuxers --disable-decoders --disable-network --enable-w32threads --enable-gpl ${{ env.switches }} ; make ; make install ; cd ../build/lib ; for file in *.a; do mv "$file" "`basename "$file" .a`.lib" ; done ; rm -rf fdk-aac.lib cmake pkgconfig *.la ../share ; cd .. ; tar czf ../dist/ffmpeg-win64-${{ inputs.type }}-${{ inputs.config }}.tar.gz *'
|
|
- name: Build FFmpeg from Cartwheel
|
|
if: ${{ inputs.source == 'cartwheel' }}
|
|
shell: cmd
|
|
run: |
|
|
call "${{ env.vsPath }}VC\Auxiliary\Build\vcvars64.bat"
|
|
md build dist
|
|
rem D:\a\_temp\setup-msys2\msys2.cmd -c 'git config --global user.email "daniel.stankewitz@gmail.com" ; git config --global user.name "Daniel Stankewitz" ; git clone https://github.com/intel-media-ci/cartwheel-ffmpeg --recursive cartwheel ; cd cartwheel ; git checkout b3f9843cffd4118e35bb000779444ca2f4196342 ; git submodule update --init --recursive ; cd ffmpeg ; git am ../patches/*.patch ; git apply --ignore-whitespace --verbose ../../0003-dynamic-loading-of-shared-fdk-aac-library-5.0.patch ; sed -i "s/#define X264_API_IMPORTS 1/\/\/#define X264_API_IMPORTS 1/g" libavcodec/libx264.c ; cd ../../build ; for file in `ls ../build_artifacts/**/*.tgz`; do tar -xzf $file; done ; rm -f bin/*.dll ; cd ../nvenc ; make PREFIX=../build install ; cp -a ../amf/amf/public/include ../build/include/AMF ; cd ../cartwheel/ffmpeg ; PKG_CONFIG_PATH=../../build/lib/pkgconfig ./configure --toolchain=msvc --extra-cflags="${{ env.cFlags }} -I../../build/include" --extra-ldflags="-LIBPATH:../../build/lib" --prefix=../../build --pkg-config-flags="--static" --extra-libs=Ole32.lib --extra-libs=Advapi32.lib --disable-doc --disable-shared --enable-static --enable-runtime-cpudetect --disable-devices --disable-demuxers --disable-decoders --disable-network --enable-w32threads --enable-gpl ${{ env.switches }} ; make ; make install ; cd ../../build/lib ; for file in *.a; do mv "$file" "`basename "$file" .a`.lib" ; done ; rm -rf fdk-aac.lib cmake pkgconfig *.la ../share ; cd .. ; tar czf ../dist/ffmpeg-win64-static-${{ inputs.config }}.tar.gz *'
|
|
rem D:\a\_temp\setup-msys2\msys2.cmd -c 'git config --global user.email "daniel.stankewitz@gmail.com" ; git config --global user.name "Daniel Stankewitz" ; git clone https://github.com/intel-media-ci/cartwheel-ffmpeg --recursive cartwheel ; cd cartwheel ; git checkout 2757a1d43ca83a3762b24a7ddd74b3291873f89c ; cd patches ; git apply --ignore-whitespace ../../hotfix.patch ; cd .. ; git submodule update --init --recursive ; cd ffmpeg ; git am ../patches/*.patch ; git apply --ignore-whitespace --verbose ../../0001-dynamic-loading-of-shared-fdk-aac-library-cw-5.0.patch ; sed -i "s/#define X264_API_IMPORTS 1/\/\/#define X264_API_IMPORTS 1/g" libavcodec/libx264.c ; cd ../../build ; for file in `ls ../build_artifacts/**/*.tgz`; do tar -xzf $file; done ; rm -f bin/*.dll ; cd ../nvenc ; make PREFIX=../build install ; cp -a ../amf/amf/public/include ../build/include/AMF ; cd ../cartwheel/ffmpeg ; PKG_CONFIG_PATH=../../build/lib/pkgconfig ./configure --toolchain=msvc --extra-cflags="${{ env.cFlags }} -I../../build/include" --extra-ldflags="-LIBPATH:../../build/lib" --prefix=../../build --pkg-config-flags="--static" --extra-libs=Ole32.lib --extra-libs=Advapi32.lib --disable-doc --disable-shared --enable-static --enable-runtime-cpudetect --enable-w32threads --enable-gpl ${{ env.switches }} ; make ; make install ; cd ../../build/lib ; for file in *.a; do mv "$file" "`basename "$file" .a`.lib" ; done ; rm -rf fdk-aac.lib cmake pkgconfig *.la ../share ; cd .. ; tar czf ../dist/ffmpeg-win64-static-${{ inputs.config }}.tar.gz *'
|
|
D:\a\_temp\setup-msys2\msys2.cmd -c 'git config --global user.email "daniel.stankewitz@gmail.com" ; git config --global user.name "Daniel Stankewitz" ; git clone https://github.com/intel-media-ci/cartwheel-ffmpeg --recursive cartwheel ; cd cartwheel ; cd patches ; git apply --ignore-whitespace ../../hotfix.patch ; cd .. ; git submodule update --init --recursive ; cd ffmpeg ; git am ../patches/*.patch ; git apply --ignore-whitespace --verbose ../../0001-dynamic-loading-of-shared-fdk-aac-library-cw-5.0.patch ; sed -i "s/#define X264_API_IMPORTS 1/\/\/#define X264_API_IMPORTS 1/g" libavcodec/libx264.c ; cd ../../build ; for file in `ls ../build_artifacts/**/*.tgz`; do tar -xzf $file; done ; rm -f bin/*.dll ; cd ../nvenc ; make PREFIX=../build install ; cp -a ../amf/amf/public/include ../build/include/AMF ; cd ../cartwheel/ffmpeg ; PKG_CONFIG_PATH=../../build/lib/pkgconfig ./configure --toolchain=msvc --extra-cflags="${{ env.cFlags }} -I../../build/include" --extra-ldflags="-LIBPATH:../../build/lib" --prefix=../../build --extra-libs=Ole32.lib --extra-libs=Advapi32.lib --disable-doc ${{ env.variant }} --enable-runtime-cpudetect --enable-w32threads --enable-gpl ${{ env.switches }} ; make ; make install ; cd ../../build/lib ; for file in *.a; do mv "$file" "`basename "$file" .a`.lib" ; done ; rm -rf fdk-aac.lib cmake pkgconfig *.la ../share ; cd .. ; tar czf ../dist/ffmpeg-win64-${{ inputs.type }}-${{ inputs.config }}.tar.gz *'
|
|
- name: Publish FFmpeg artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ inputs.config }} package build
|
|
path: dist/ffmpeg-win64-${{ inputs.type }}-${{ inputs.config }}.tar.gz
|