From 3a521592865e15325ab4f83d823a285457a3d11a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Ekstr=C3=B6m?= <jeebjp@gmail.com>
Date: Mon, 6 Jun 2022 21:43:35 +0300
Subject: [PATCH] ci/mingw64: add git libplacebo for gpu-next

This way mingw-w64 becomes the first CI workflow to build gpu-next.

Unfortunately, currently neither wscript or meson has gpu-next or
libplacebo-next as an option that one can require.
---
 ci/build-mingw64.sh | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/ci/build-mingw64.sh b/ci/build-mingw64.sh
index d8382f5edd..456c38b8c2 100755
--- a/ci/build-mingw64.sh
+++ b/ci/build-mingw64.sh
@@ -113,6 +113,17 @@ if [ ! -e "$prefix_dir/lib/libspirv-cross-c-shared.dll.a" ]; then
     popd
 fi
 
+## libplacebo
+if [ ! -e "$prefix_dir/lib/libplacebo.dll.a" ]; then
+    [ -d libplacebo ] || $gitclone https://code.videolan.org/videolan/libplacebo.git
+    builddir libplacebo
+    meson .. \
+        --cross-file "${prefix_dir}/crossfile"
+    ninja
+    DESTDIR="$prefix_dir" ninja install
+    popd
+fi
+
 ## freetype2
 if [ ! -e "$prefix_dir/lib/libfreetype.dll.a" ]; then
     ver=2.11.0
@@ -177,7 +188,7 @@ if [ $1 = "meson" ]; then
 
     CFLAGS="-I'$prefix_dir/include'" LDFLAGS="-L'$prefix_dir/lib'" \
     meson .. --cross-file "${prefix_dir}/crossfile" --libdir lib \
-        -Dlibmpv=true -Dlua=luajit -D{shaderc,spirv-cross,d3d11}=enabled
+        -Dlibmpv=true -Dlua=luajit -D{shaderc,spirv-cross,d3d11,libplacebo}=enabled
 
     meson compile
 fi
@@ -186,7 +197,7 @@ if [ $1 = "waf" ]; then
     PKG_CONFIG=pkg-config CFLAGS="-I'$prefix_dir/include'" LDFLAGS="-L'$prefix_dir/lib'" \
     python3 ./waf configure \
         --enable-libmpv-shared --lua=luajit \
-        --enable-{shaderc,spirv-cross,d3d11}
+        --enable-{shaderc,spirv-cross,d3d11,libplacebo}
 
     python3 ./waf build --verbose
 fi