diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 37b7731..34e7604 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,15 +24,18 @@ jobs: - uses: msys2/setup-msys2@v2 with: - msystem: MINGW64 + # LuaJIT is only published for the UCRT64, CLANG64 and CLANGARM64 + # environments; the MINGW64 one no longer carries it, and mpv needs + # LuaJIT or Lua 5.1/5.2 for its scripts. + msystem: UCRT64 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 + mingw-w64-ucrt-x86_64-gcc + mingw-w64-ucrt-x86_64-meson + mingw-w64-ucrt-x86_64-ninja + mingw-w64-ucrt-x86_64-pkgconf + mingw-w64-ucrt-x86_64-ffmpeg + mingw-w64-ucrt-x86_64-luajit - name: Clone mpv shell: pwsh diff --git a/fork/README.md b/fork/README.md index 851a027..844fcd2 100644 --- a/fork/README.md +++ b/fork/README.md @@ -91,12 +91,14 @@ Android(`libmpv.so`)的可行性调研见 [docs/android.md](docs/android.md) ## 构建(Windows / MSYS2) -需要 msys2 的 mingw64 环境(本机验证版本:gcc 16.2.0、ffmpeg 9.0.2、meson 1.12.1、ninja 1.13.2): +需要 msys2 的 **UCRT64** 环境(本机验证版本:gcc 16.2.0、ffmpeg 9.0.2、meson 1.12.1、ninja 1.13.2)。 +LuaJIT 只发布在 ucrt64 / clang64,MINGW64 环境里已经没有这个包了,而 mpv 的脚本需要 LuaJIT 或 +Lua 5.1/5.2: ```bash -pacman -S --needed 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 +pacman -S --needed mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-meson \ + mingw-w64-ucrt-x86_64-ninja mingw-w64-ucrt-x86_64-pkgconf mingw-w64-ucrt-x86_64-ffmpeg \ + mingw-w64-ucrt-x86_64-luajit ``` 把本目录的 `files/` 覆盖到 mpv 源码树,然后: @@ -104,7 +106,7 @@ pacman -S --needed mingw-w64-x86_64-gcc mingw-w64-x86_64-meson \ ```bash cd mpv-src git apply /path/to/patches/mpv-ad-joc.patch -export PATH=/mingw64/bin:$PATH +export PATH="${MINGW_PREFIX:-/ucrt64}/bin:$PATH" meson setup build --buildtype=release -Dgpl=false -Dlua=luajit \ -Djoc-core-dir=/c/path/to/joc_core_import_lib_dir ninja -C build diff --git a/fork/tools/bundle_dlls.sh b/fork/tools/bundle_dlls.sh index caa47f8..cc96708 100644 --- a/fork/tools/bundle_dlls.sh +++ b/fork/tools/bundle_dlls.sh @@ -2,13 +2,18 @@ # Copy the MinGW runtime DLL closure of mpv.exe next to it, so the build runs # without the MSYS2 environment on PATH. # +# The MSYS2 environment is taken from MINGW_PREFIX, which the shell sets to +# /ucrt64, /mingw64 or /clang64 depending on how it was started, so the script +# works whichever of them built mpv. +# # Usage: bundle_dlls.sh /path/to/mpv/build set -e -export PATH=/mingw64/bin:/usr/bin:$PATH +prefix="${MINGW_PREFIX:-/mingw64}" +export PATH="$prefix/bin:/usr/bin:$PATH" cd "${1:?usage: bundle_dlls.sh }" collect() { - ldd "$1" 2>/dev/null | awk '{print $3}' | grep '^/mingw64/' || true + ldd "$1" 2>/dev/null | awk '{print $3}' | grep "^$prefix/" || true } declare -A seen @@ -26,6 +31,6 @@ done echo "DLLs to copy: ${#seen[@]}" for name in "${!seen[@]}"; do - cp -f "/mingw64/bin/$name" . + cp -f "$prefix/bin/$name" . done ls -1 *.dll | wc -l