From e75a17474381757c782313650069e06a188375b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Fri, 26 Dec 2025 19:28:17 +0100 Subject: [PATCH] ci/win32: add subrandr Wrap subrandr build process into meson custom target. Meson's custom target allow only file output (without path component), so additionall copy step is added to get the library. Dummy stamp file is used to connect custom target to dependency, the file is actually not created, so target will be called each time, but it's fine, because cargo will resolve it's own dependencies this way and build if needed. This is glued only for static lib, this is what we need for our CI script. --- .github/workflows/build.yml | 5 ++-- ci/build-win32.ps1 | 52 +++++++++++++++++++++++++++++++++++-- 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1e79c5f075..bbeab165f2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -142,9 +142,8 @@ jobs: CXX: "ccache clang++" CC_LD: "lld-link" CXX_LD: "lld-link" - WINDRES: "llvm-rc" RUST_LD: "lld-link" - RUSTC: "rustc --target ${{ matrix.target }}" + WINDRES: "llvm-rc" CCACHE_BASEDIR: ${{ github.workspace }} CCACHE_DIR: "${{ github.workspace }}\\.ccache" CCACHE_MAXSIZE: 500M @@ -172,6 +171,8 @@ jobs: run: | python -m pip install meson==1.9.2 choco install ccache nasm + # For cargo -C + rustup default nightly ./ci/install-cmake.ps1 -arch ${{ matrix.arch }} - name: Update Meson WrapDB diff --git a/ci/build-win32.ps1 b/ci/build-win32.ps1 index 533a847ca7..7e107ffee5 100644 --- a/ci/build-win32.ps1 +++ b/ci/build-win32.ps1 @@ -167,6 +167,52 @@ aom_dep = aom_proj.dependency('aom') meson.override_dependency('aom', aom_dep) "@ +if (-not (Test-Path "$subprojects/subrandr")) { + git clone https://github.com/afishhh/subrandr --depth 1 $subprojects/subrandr + Set-Content -Path "$subprojects/subrandr/meson.build" -Value @" +project('subrandr', 'c', version: '1.0.1') +cargo = find_program('cargo', required: true) +cc = meson.get_compiler('c') +subrandr_build = custom_target( + 'subrandr-build', + output: 'subrandr.stamp', + command: [ + cargo, + '-Z', 'unstable-options', + '-C', '@CURRENT_SOURCE_DIR@', + 'xtask', 'install', + '--prefix=' + meson.current_build_dir(), + '--static-library', 'true', + '--shared-library', 'false' + ], + console: true +) +subrandr_lib = custom_target( + 'subrandr-copy', + input: subrandr_build, + output: 'subrandr.lib', + command: ['cp', meson.current_build_dir() / 'lib' / 'subrandr.lib', '@OUTPUT@'] +) +harfbuzz = dependency('harfbuzz', default_options: ['freetype=enabled']) +dep = declare_dependency( + sources: subrandr_build, + link_with: subrandr_lib, + dependencies: [ + harfbuzz, + # those deps are hardcoded, because parsing rustc native-static-libs, would + # be lots of code for little benefit, those libs won't really change. + cc.find_library('dbghelp', required: true), + cc.find_library('kernel32', required: true), + cc.find_library('ntdll', required: true), + cc.find_library('userenv', required: true), + cc.find_library('ws2_32', required: true) + ], + compile_args: ['-I' + meson.current_build_dir() / 'include'], +) +meson.override_dependency('subrandr', dep) +"@ +} + $projects = @( @{ Path = "$subprojects/ffmpeg.wrap" @@ -241,7 +287,7 @@ meson setup build ` --wrap-mode=forcefallback ` -Ddefault_library=static ` -Dc_args="-I$amfExtractPath" ` - -Dlibmpv=true ` + -Dlibmpv=false ` -Dtests=true ` -Dgpl=true ` -Dffmpeg:gpl=enabled ` @@ -252,6 +298,7 @@ meson setup build ` -Dffmpeg:libdav1d=enabled ` -Dffmpeg:libjxl=enabled ` -Dffmpeg:libaom=enabled ` + -Dharfbuzz:freetype=enabled ` -Dlcms2:fastfloat=true ` -Dlcms2:jpeg=disabled ` -Dlcms2:tiff=disabled ` @@ -270,6 +317,7 @@ meson setup build ` -Dluajit:amalgam=true ` -Damf=enabled ` -Dd3d11=enabled ` + -Dsubrandr=enabled ` -Dvulkan=enabled ` -Djavascript=enabled ` -Dwin32-smtc=enabled ` @@ -279,7 +327,7 @@ meson setup build ` -Drubberband=disabled ` -Dwayland=disabled ` -Dx11=disabled -ninja -C build mpv.exe mpv.com libmpv.a +ninja -C build mpv.exe mpv.com cp ./build/subprojects/vulkan-loader/vulkan.dll ./build/vulkan-1.dll cp ./etc/mpv-*.bat ./build ./build/mpv.com -v --no-config