Files
mpv-joc/.github/workflows/build.yml
T

144 lines
4.0 KiB
YAML

name: build
on:
workflow_dispatch:
inputs:
mpv_ref:
description: "mpv branch, tag or commit"
type: string
required: false
default: "master"
push:
branches:
- main
tags:
- "v*"
jobs:
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-meson
mingw-w64-x86_64-ninja
mingw-w64-x86_64-pkgconf
mingw-w64-x86_64-ffmpeg
mingw-w64-x86_64-luajit
- name: Clone mpv
shell: pwsh
env:
MPV_REF: ${{ inputs.mpv_ref }}
run: |
$ref = $env:MPV_REF
if ([string]::IsNullOrWhiteSpace($ref)) {
$ref = "master"
}
git init mpv
git -C mpv remote add origin https://github.com/mpv-player/mpv.git
git -C mpv fetch --depth 1 origin $ref
if ($LASTEXITCODE -ne 0) {
throw "Failed to fetch mpv ref: $ref"
}
git -C mpv checkout --detach FETCH_HEAD
if ($LASTEXITCODE -ne 0) {
throw "Failed to checkout mpv ref: $ref"
}
git -C mpv log -1 --format='%h %cd %s' --date=short
- name: Apply ad_joc
shell: pwsh
run: |
Copy-Item fork/files/audio/decode/* mpv/audio/decode/ -Force
python fork/tools/apply_edits.py mpv
if ($LASTEXITCODE -ne 0) {
throw "Failed to apply ad_joc patches"
}
- name: Build joc_core
shell: pwsh
run: |
git clone --depth 1 https://github.com/TheM14/JustOneCacophony.git joc
if ($LASTEXITCODE -ne 0) {
throw "Failed to clone JustOneCacophony"
}
cmake -S joc -B joc/build -A x64
if ($LASTEXITCODE -ne 0) {
throw "joc_core configuration failed"
}
cmake --build joc/build --config Release
if ($LASTEXITCODE -ne 0) {
throw "joc_core build failed"
}
$lib = Get-ChildItem joc/build -Recurse -Filter joc_core.lib |
Select-Object -First 1
if (-not $lib) {
throw "joc_core.lib not found"
}
"JOC_CORE_DIR=$($lib.DirectoryName)" |
Out-File -Append $env:GITHUB_ENV
- name: Build mpv
shell: pwsh
run: |
$bash = "C:\msys64\usr\bin\bash.exe"
$dirWin = (Resolve-Path mpv).Path
$dir = (& $bash -lc "cygpath -u '$dirWin'").Trim()
$core = (& $bash -lc "cygpath -u '$env:JOC_CORE_DIR'").Trim()
$lines = @(
'set -e',
'export PATH=/mingw64/bin:/usr/bin:$PATH',
'export MSYSTEM=MINGW64',
"cd '$dir'",
"meson setup build --buildtype=release -Dgpl=false -Dlua=luajit -Djoc-core-dir='$core'",
'ninja -C build'
)
($lines -join "`n") |
& $bash -lc 'cat > /tmp/build-mpv.sh && bash /tmp/build-mpv.sh'
if ($LASTEXITCODE -ne 0) {
throw "mpv build failed"
}
- name: Bundle
shell: pwsh
run: |
$bash = "C:\msys64\usr\bin\bash.exe"
$dirWin = (Resolve-Path mpv).Path
$dir = (& $bash -lc "cygpath -u '$dirWin'").Trim()
$workspace = (& $bash -lc "cygpath -u '$env:GITHUB_WORKSPACE'").Trim()
& $bash -lc "bash '$workspace/fork/tools/bundle_dlls.sh' '$dir/build'"
if ($LASTEXITCODE -ne 0) {
throw "DLL bundling failed"
}
Copy-Item (Join-Path $env:JOC_CORE_DIR "joc_core.dll") mpv/build -Force
Copy-Item fork/mpv.conf.example mpv/build -Force
Compress-Archive -Path mpv/build/* -DestinationPath mpv-ad-joc.zip
- uses: actions/upload-artifact@v4
with:
name: mpv-ad-joc-windows
path: mpv-ad-joc.zip