This commit is contained in:
nvrl committed 2026-08-03 10:03:23 +02:00
1 parent 4c842402a6
commit 6b0d5040f6
5 files changed
+95 -98

No files matched your search

-51
View File
@@ -1,51 +0,0 @@
name: libmpv (Windows)
description: >
Provide libmpv's Windows development files. `libmpv2-sys` emits
`cargo:rustc-link-lib=mpv`, and mpv's Windows *player* build ships neither
mpv.lib nor libmpv-2.dll — they come from the separate mpv-dev archive. Sets
LIB for the linker, PATH so binaries find the DLL at run time, and
MPV_DEV_DIR for `scripts/build.ps1`.
outputs:
dir:
description: Directory holding libmpv-2.dll and mpv.lib.
value: ${{ steps.mpv.outputs.dir }}
runs:
using: composite
steps:
# lib.exe, for turning mpv.def into an import library.
- uses: ilammy/msvc-dev-cmd@v1
- id: mpv
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$feed = [xml](Invoke-WebRequest -UseBasicParsing `
'https://sourceforge.net/projects/mpv-player-windows/rss?path=/libmpv').Content
# The "v3" variants are x86-64-v3 builds; take the baseline one.
$item = $feed.rss.channel.item |
Where-Object { $_.link -match 'mpv-dev-x86_64-2[^/]*\.7z/download$' } |
Select-Object -First 1
if (-not $item) { throw 'no mpv-dev build in the SourceForge feed' }
$archive = Join-Path $env:RUNNER_TEMP 'mpv-dev.7z'
$dir = Join-Path $env:RUNNER_TEMP 'mpv-dev'
Invoke-WebRequest -UseBasicParsing $item.link -OutFile $archive
7z x $archive "-o$dir" -y | Out-Null
$dll = Get-ChildItem -Path $dir -Filter 'libmpv-2.dll' -Recurse |
Select-Object -First 1
if (-not $dll) { throw "libmpv-2.dll not found under $dir" }
$libDir = $dll.Directory.FullName
# /NAME matters: without it the import library references mpv.dll, and
# the file that actually ships is libmpv-2.dll.
lib.exe /def:"$libDir\mpv.def" /name:libmpv-2.dll `
/out:"$libDir\mpv.lib" /machine:x64 | Out-Null
if ($LASTEXITCODE -ne 0) { throw 'lib.exe failed to build mpv.lib' }
"dir=$libDir" | Out-File $env:GITHUB_OUTPUT -Append -Encoding utf8
"MPV_DEV_DIR=$libDir" | Out-File $env:GITHUB_ENV -Append -Encoding utf8
"LIB=$libDir;$env:LIB" | Out-File $env:GITHUB_ENV -Append -Encoding utf8
$libDir | Out-File $env:GITHUB_PATH -Append -Encoding utf8
+39 -15
View File
@@ -10,11 +10,8 @@ env:
jobs:
gate:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, windows-latest]
runs-on: ${{ matrix.os }}
name: Gate (Linux)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
@@ -26,22 +23,49 @@ jobs:
- uses: Swatinem/rust-cache@v2
# libmpv for pstr-player. On Windows the DLL and import library are
# bundled from the mpv-dev build rather than installed system-wide.
- name: Install libmpv (Linux)
if: runner.os == 'Linux'
# libmpv for pstr-player.
- name: Install libmpv
run: |
sudo apt-get update
sudo apt-get install -y libmpv-dev
# Without this the test binaries do not link: there is no mpv.lib on the
# runner. See .github/actions/libmpv-windows.
- name: Install libmpv (Windows)
if: runner.os == 'Windows'
uses: ./.github/actions/libmpv-windows
- run: cargo fmt --all -- --check
- run: cargo clippy --workspace --all-targets -- -D warnings
- run: cargo test --workspace --locked
# The Windows artifacts are cross-compiled from Linux with mingw-w64 — see
# scripts/build-windows.sh — so this checks the target that actually ships.
# It is a compile check, not a test run: nothing here executes a Windows
# binary. libmpv is not linked at build time by anything but `-l mpv`, which
# is why the import library out of the mpv-dev archive is all it needs.
windows-cross:
name: Gate (Windows cross)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.96"
components: clippy
targets: x86_64-pc-windows-gnu
- uses: Swatinem/rust-cache@v2
- name: Install the cross toolchain
run: |
sudo apt-get update
sudo apt-get install -y mingw-w64 p7zip-full
- name: Fetch libmpv's Windows development files
env:
GITHUB_TOKEN: ${{ github.token }}
run: scripts/build-windows.sh --fetch-mpv mpv
- name: clippy (x86_64-pc-windows-gnu)
run: |
RUSTFLAGS="-L native=$PWD/dist/mpv-dev" \
cargo clippy --workspace --all-targets \
--target x86_64-pc-windows-gnu -- -D warnings
+15 -8
View File
@@ -96,28 +96,35 @@ jobs:
dist/*.rpm
if-no-files-found: error
# Cross-compiled from Linux with mingw-w64, and the .msi built by wixl rather
# than WiX — scripts/build-windows.sh, which is how these artifacts have been
# produced by hand. A windows runner would need MSVC's mpv.lib, and current
# mpv-dev archives ship only the mingw import library.
windows:
name: Windows artifacts
needs: verify
runs-on: windows-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.96"
targets: x86_64-pc-windows-gnu
- uses: Swatinem/rust-cache@v2
# Sets MPV_DEV_DIR, which is what build.ps1 reads when -MpvDev is absent.
- name: Install libmpv
uses: ./.github/actions/libmpv-windows
# mingw-w64 for the cross compile, msitools for wixl, p7zip for the
# mpv-dev archive.
- name: Install the cross toolchain
run: |
sudo apt-get update
sudo apt-get install -y mingw-w64 msitools zip p7zip-full
# build.ps1 installs the WiX toolset itself if `wix` is missing, and the
# runner has the .NET SDK it needs for that.
- name: Build the portable .zip and the .msi
shell: pwsh
run: scripts\build.ps1 -Artifacts zip,msi
env:
GITHUB_TOKEN: ${{ github.token }}
run: scripts/build-windows.sh --fetch-mpv
- uses: actions/upload-artifact@v4
with: