Build the Windows fork in UCRT64, where LuaJIT is still published

This commit is contained in:
TheM14 committed 2026-10-28 00:31:28 +08:00
1 parent 7d013fef46
commit 95c4626abd
3 files changed
+25 -15

No files matched your search

+10 -7
View File
@@ -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
+7 -5
View File
@@ -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
+8 -3
View File
@@ -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 <mpv build dir>}"
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