Build 7.1.2-0 #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| env: | |
| MSYS2_PATH_TYPE: inherit | |
| SDK_VER: 10.0.22621.0 | |
| REF_NAME: ${{ inputs.ref_name||github.ref_name }} | |
| name: Build | |
| run-name: Build ${{inputs.ref_name||github.ref_name}} | |
| on: | |
| push: | |
| tags: | |
| - '*' | |
| # branches: | |
| # - main | |
| # - master | |
| # pull_request: | |
| # branches: | |
| # - main | |
| # - master | |
| workflow_call: | |
| inputs: | |
| ref_name: | |
| description: 'Tag' | |
| required: false | |
| type: string | |
| workflow_dispatch: | |
| inputs: | |
| ref_name: | |
| description: 'Tag or Branch' | |
| required: false | |
| type: string | |
| default: 'main' | |
| jobs: | |
| prepare: | |
| uses: ./.github/workflows/cache.yml | |
| with: | |
| ref_name: ${{inputs.ref_name||github.ref_name}} | |
| build: | |
| needs: prepare | |
| strategy: | |
| matrix: | |
| arch: [amd64, arm64] | |
| fail-fast: false | |
| runs-on: windows-2022 | |
| env: | |
| name: ffmpeg-${{ inputs.ref_name||github.ref_name }}-gpl-${{matrix.arch}}-static | |
| target: ${{contains(matrix.arch,'arm')&&format('amd64_{0}',matrix.arch)||matrix.arch}} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{env.REF_NAME}} | |
| # submodules: recursive | |
| - name: Setup Env | |
| shell: bash | |
| id: setup | |
| run: | | |
| echo "installationPath=$(vswhere -all -legacy -property installationPath)">>$GITHUB_OUTPUT | |
| # KEY=$(git ls-tree -r ${{env.REF_NAME}}|grep ^160000|sort -d|md5sum|cut -d' ' -f1) | |
| # echo "cache-key=$KEY" >>$GITHUB_OUTPUT | |
| - name: Restore cached submodules | |
| id: cache-submodules-restore | |
| uses: actions/cache@v4 | |
| with: | |
| path: .git/modules | |
| # key: ${{ runner.os }}-${{steps.setup.outputs.cache-key}}-submodules | |
| key: ${{ needs.prepare.outputs.cache-key }} | |
| - name: Pull submodules | |
| shell: bash | |
| run: | | |
| git submodule update --init --recursive --depth 1 | |
| - uses: msys2/setup-msys2@v2 | |
| with: | |
| install: >- | |
| diffutils | |
| make | |
| zip | |
| pkgconf | |
| yasm | |
| nasm | |
| libtool | |
| bison | |
| automake | |
| autoconf | |
| quilt | |
| clang | |
| - name: Setup Python for Meson | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install Meson and Ninja | |
| shell: cmd | |
| run: | | |
| pip install meson ninja | |
| - name: Install CUDA Toolkit | |
| if: matrix.arch == 'amd64' | |
| uses: N-Storm/cuda-toolkit@master | |
| id: cuda-toolkit | |
| with: | |
| cuda: '12.6.3' | |
| sub-packages: '["nvcc", "cudart", "npp_dev"]' | |
| - name: Test CUDA Installation | |
| if: matrix.arch == 'amd64' | |
| shell: cmd | |
| run: | | |
| CALL "${{steps.setup.outputs.installationPath}}\VC\Auxiliary\Build\vcvarsall.bat" ${{env.target}} ${{env.SDK_VER}} | |
| echo CUDA Installation Check: | |
| echo ======================== | |
| echo CUDA_PATH: %CUDA_PATH% | |
| nvcc --version | findstr "release" | |
| echo. | |
| echo Directory Structure: | |
| echo =================== | |
| echo CUDA root subdirectories: | |
| dir "%CUDA_PATH%" /b /ad | |
| echo. | |
| echo Checking for lib directory: | |
| if exist "%CUDA_PATH%\lib" ( | |
| echo lib directory found, contents: | |
| dir "%CUDA_PATH%\lib" /b /ad | |
| ) | |
| echo. | |
| echo Searching for .lib files: | |
| dir "%CUDA_PATH%" /s /b 2>nul | findstr /i "\.lib$" | head -10 | |
| echo. | |
| echo Searching for NPP headers: | |
| dir "%CUDA_PATH%" /s /b 2>nul | findstr /i "npp.*\.h$" | head -10 | |
| echo. | |
| echo NPP Libraries Check: | |
| if exist "%CUDA_PATH%\lib\x64\nppc.lib" ( | |
| echo nppc.lib: FOUND | |
| ) else ( | |
| echo nppc.lib: NOT FOUND | |
| ) | |
| if exist "%CUDA_PATH%\include\npp.h" ( | |
| echo npp.h: FOUND | |
| ) else ( | |
| echo npp.h: NOT FOUND | |
| ) | |
| echo. | |
| echo CUDA Compilation Test: | |
| echo __global__ void test() {} > test.cu | |
| nvcc -c test.cu -o test.obj | |
| if exist test.obj ( | |
| echo CUDA compilation test: PASSED | |
| del test.obj test.cu | |
| ) else ( | |
| echo CUDA compilation test: FAILED | |
| exit 1 | |
| ) | |
| - name: Remove MSYS2 link | |
| shell: msys2 {0} | |
| run: | | |
| rm $(which link) | |
| rm -rf /usr/local | |
| - name: Build Meson dependencies | |
| if: ${{ success() }} | |
| shell: cmd | |
| run: | | |
| CALL "${{steps.setup.outputs.installationPath}}\VC\Auxiliary\Build\vcvarsall.bat" ${{env.target}} ${{env.SDK_VER}} | |
| REM Add MSYS2 tools (nasm, yasm) to PATH | |
| set PATH=D:\a\_temp\msys64\usr\bin;%PATH% | |
| REM Build dav1d (AV1 decoder) | |
| if exist dav1d ( | |
| echo Building dav1d... | |
| cd dav1d | |
| REM Create cross-file for ARM64 builds | |
| if "${{matrix.arch}}" == "arm64" ( | |
| echo [binaries] > cross.txt | |
| echo c = 'cl' >> cross.txt | |
| echo ar = 'lib' >> cross.txt | |
| echo [host_machine] >> cross.txt | |
| echo system = 'windows' >> cross.txt | |
| echo cpu_family = 'aarch64' >> cross.txt | |
| echo cpu = 'aarch64' >> cross.txt | |
| echo endian = 'little' >> cross.txt | |
| REM Disable assembly for ARM64 cross-compilation | |
| meson setup build --cross-file cross.txt --prefix=D:\a\_temp\msys64\usr\local --buildtype=release --default-library=static -Denable_tools=false -Denable_tests=false -Denable_asm=false -Db_vscrt=mt | |
| ) else ( | |
| meson setup build --prefix=D:\a\_temp\msys64\usr\local --buildtype=release --default-library=static -Denable_tools=false -Denable_tests=false -Db_vscrt=mt | |
| ) | |
| if %errorlevel% neq 0 exit /b %errorlevel% | |
| meson compile -C build | |
| if %errorlevel% neq 0 exit /b %errorlevel% | |
| meson install -C build | |
| if %errorlevel% neq 0 exit /b %errorlevel% | |
| REM Meson installs as libdav1d.a, but FFmpeg expects dav1d.lib | |
| REM Copy the library with both naming conventions | |
| if exist D:\a\_temp\msys64\usr\local\lib\libdav1d.a ( | |
| echo Copying libdav1d.a to dav1d.lib for FFmpeg | |
| copy D:\a\_temp\msys64\usr\local\lib\libdav1d.a D:\a\_temp\msys64\usr\local\lib\dav1d.lib | |
| copy D:\a\_temp\msys64\usr\local\lib\libdav1d.a D:\a\_temp\msys64\usr\local\lib\libdav1d.lib | |
| ) | |
| cd .. | |
| REM Set environment variable for successful build | |
| echo DEP_DAV1D=1 >> %GITHUB_ENV% | |
| ) | |
| - name: Build zimg with MSVC | |
| if: ${{ success() }} | |
| shell: cmd | |
| run: | | |
| CALL "${{steps.setup.outputs.installationPath}}\VC\Auxiliary\Build\vcvarsall.bat" ${{env.target}} ${{env.SDK_VER}} | |
| REM Build zimg using MSBuild | |
| if exist zimg ( | |
| echo Building zimg... | |
| cd zimg\_msvc | |
| REM Determine platform for MSBuild | |
| if "${{matrix.arch}}" == "arm64" ( | |
| set PLATFORM=ARM64 | |
| ) else ( | |
| set PLATFORM=x64 | |
| ) | |
| MSBuild zimg.sln -p:Configuration=Release -p:Platform=%PLATFORM% -p:RuntimeLibrary=MT | |
| if %errorlevel% neq 0 exit /b %errorlevel% | |
| REM Install headers - API header needs to be accessible directly | |
| if not exist D:\a\_temp\msys64\usr\local\include\zimg mkdir D:\a\_temp\msys64\usr\local\include\zimg | |
| copy ..\src\zimg\api\zimg.h D:\a\_temp\msys64\usr\local\include\zimg\ | |
| REM Find and install the library | |
| if not exist D:\a\_temp\msys64\usr\local\lib mkdir D:\a\_temp\msys64\usr\local\lib | |
| for /R %PLATFORM%\Release %%f in (*.lib) do ( | |
| echo Found library: %%f | |
| copy "%%f" D:\a\_temp\msys64\usr\local\lib\zimg.lib | |
| copy "%%f" D:\a\_temp\msys64\usr\local\lib\libzimg.lib | |
| ) | |
| REM Create pkg-config file with correct include path | |
| if not exist D:\a\_temp\msys64\usr\local\lib\pkgconfig mkdir D:\a\_temp\msys64\usr\local\lib\pkgconfig | |
| ( | |
| echo prefix=/usr/local | |
| echo exec_prefix=${prefix} | |
| echo libdir=${exec_prefix}/lib | |
| echo includedir=${prefix}/include | |
| echo. | |
| echo Name: zimg | |
| echo Description: Scaling, colorspace conversion, and dithering library | |
| echo Version: 3.0 | |
| echo Libs: -L${libdir} -lzimg | |
| echo Cflags: -I${includedir}/zimg | |
| ) > D:\a\_temp\msys64\usr\local\lib\pkgconfig\zimg.pc | |
| cd ..\.. | |
| REM Set environment variable for successful build | |
| echo DEP_ZIMG=1 >> %GITHUB_ENV% | |
| ) | |
| - name: Build LAME with MSVC | |
| if: ${{ success() }} | |
| shell: cmd | |
| run: | | |
| CALL "${{steps.setup.outputs.installationPath}}\VC\Auxiliary\Build\vcvarsall.bat" ${{env.target}} ${{env.SDK_VER}} | |
| REM Build LAME MP3 encoder | |
| if exist lame ( | |
| echo Building LAME... | |
| cd lame | |
| REM Copy configMS.h to config.h | |
| copy configMS.h config.h | |
| REM Set architecture-specific options and machine type | |
| if "${{matrix.arch}}" == "arm64" ( | |
| REM Patch Makefile.MSVC to use correct machine type for ARM64 | |
| powershell -Command "(Get-Content Makefile.MSVC) -replace 'MACHINE = /machine:I386', 'MACHINE = /machine:ARM64' | Set-Content Makefile.MSVC" | |
| ) else ( | |
| REM Patch Makefile.MSVC to use correct machine type for x64 | |
| powershell -Command "(Get-Content Makefile.MSVC) -replace 'MACHINE = /machine:I386', 'MACHINE = /machine:X64' | Set-Content Makefile.MSVC" | |
| ) | |
| REM Also remove obsolete compiler flags that cause warnings | |
| powershell -Command "(Get-Content Makefile.MSVC) -replace '/QIfdiv /QI0f /YX', '' | Set-Content Makefile.MSVC" | |
| REM Build static library only (no frontend) using documented approach | |
| REM comp=msvc ensures we use Microsoft compiler | |
| REM asm=no disables assembly optimizations (safer for cross-compilation) | |
| REM CFG=RH uses Robert's optimizations (default) | |
| nmake -f Makefile.MSVC comp=msvc asm=no libmp3lame-static.lib | |
| if %errorlevel% neq 0 exit /b %errorlevel% | |
| REM Install headers and library | |
| if not exist D:\a\_temp\msys64\usr\local\include\lame mkdir D:\a\_temp\msys64\usr\local\include\lame | |
| copy include\lame.h D:\a\_temp\msys64\usr\local\include\lame\ | |
| if not exist D:\a\_temp\msys64\usr\local\lib mkdir D:\a\_temp\msys64\usr\local\lib | |
| REM Copy library with both naming conventions for maximum compatibility | |
| copy output\libmp3lame-static.lib D:\a\_temp\msys64\usr\local\lib\libmp3lame.lib | |
| copy output\libmp3lame-static.lib D:\a\_temp\msys64\usr\local\lib\mp3lame.lib | |
| copy output\libmp3lame-static.lib D:\a\_temp\msys64\usr\local\lib\lame.lib | |
| REM Create pkg-config file - use absolute path for MSVC compatibility | |
| if not exist D:\a\_temp\msys64\usr\local\lib\pkgconfig mkdir D:\a\_temp\msys64\usr\local\lib\pkgconfig | |
| ( | |
| echo prefix=/usr/local | |
| echo exec_prefix=${prefix} | |
| echo libdir=${exec_prefix}/lib | |
| echo includedir=${prefix}/include | |
| echo. | |
| echo Name: libmp3lame | |
| echo Description: LAME MP3 encoding library | |
| echo Version: 3.100 | |
| echo Libs: -LD:/a/_temp/msys64/usr/local/lib -lmp3lame | |
| echo Cflags: -I${includedir}/lame | |
| ) > D:\a\_temp\msys64\usr\local\lib\pkgconfig\libmp3lame.pc | |
| cd .. | |
| REM Set environment variable for successful build | |
| echo DEP_LAME=1 >> %GITHUB_ENV% | |
| ) | |
| - name: Build | |
| shell: cmd | |
| run: | | |
| CALL "${{steps.setup.outputs.installationPath}}\VC\Auxiliary\Build\vcvarsall.bat" ${{env.target}} ${{env.SDK_VER}} | |
| msys2 -c "export CUDA_PATH=\"$CUDA_PATH\" DEP_DAV1D=\"$DEP_DAV1D\" DEP_ZIMG=\"$DEP_ZIMG\" DEP_LAME=\"$DEP_LAME\"; ./build.sh ${{matrix.arch}}" | |
| - name: Debug log | |
| if: ${{ failure() }} | |
| shell: bash | |
| run: | | |
| echo [Debug] | |
| cat FFmpeg/ffbuild/config.log | |
| cat FFmpeg/ffbuild/config.mak | |
| cat FFmpeg/config.h | |
| - name: Pack | |
| shell: msys2 {0} | |
| run: | | |
| CWD=$(pwd) | |
| cd /usr/local | |
| zip -9 ${CWD}/${{env.name}}.zip -r . | |
| cd ${CWD} | |
| sha1sum ${{env.name}}.zip >${{env.name}}.sha1 | |
| ./build-changelog.sh > changelog || echo "No changelog script found" > changelog | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{env.name}} | |
| path: | | |
| ${{env.name}}.zip | |
| ${{env.name}}.sha1 | |
| changelog | |
| retention-days: 30 | |
| - name: Release | |
| if: ${{startsWith(github.ref, 'refs/tags/')}} | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{env.REF_NAME}} | |
| body_path: changelog | |
| prerelease: ${{contains(env.REF_NAME,'dev')}} | |
| files: | | |
| ${{env.name}}.zip | |
| ${{env.name}}.sha1 |