123 lines
3.2 KiB
YAML
123 lines
3.2 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: msys2 {0}
|
|
run: |
|
|
set -euo pipefail
|
|
core_dir="$(cygpath -u "$JOC_CORE_DIR")"
|
|
cd mpv
|
|
meson setup build --buildtype=release -Dgpl=false -Dlua=luajit "-Djoc-core-dir=$core_dir"
|
|
ninja -C build
|
|
|
|
- name: Bundle dependencies
|
|
shell: msys2 {0}
|
|
run: |
|
|
set -euo pipefail
|
|
bash fork/tools/bundle_dlls.sh "$PWD/mpv/build"
|
|
cp "$(cygpath -u "$JOC_CORE_DIR")/joc_core.dll" mpv/build/
|
|
cp fork/mpv.conf.example mpv/build/
|
|
|
|
- name: Package
|
|
shell: pwsh
|
|
run: |
|
|
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
|