# vulkan-loader 1.4.350.1 — ICD loader de Vulkan (libvulkan.so.1 + config CMake Vulkan::Loader/Vulkan::Vulkan).
# Blocker de kwin (find_package(Vulkan REQUIRED)). Campaña KDE (ADR 0011). Versión casada con vulkan-headers.
# CMakeLists: find_package(VulkanHeaders CONFIG) + PkgConfig REQUIRED para xcb (WSI_XCB) y x11 (WSI_XLIB).
# WSI_WAYLAND sólo añade un -D (no linkea). WSI_XLIB_XRANDR default ON exige xrandr.pc → libXrandr NO está
# sellado ⇒ lo apago (no es esencial para libvulkan.so). Python3 sólo si LOADER_CODEGEN (default OFF).
name    = "vulkan-loader"
version = "1.4.350.1"
license = "Apache-2.0"

[source]
tarball = "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/vulkan-sdk-1.4.350.1.tar.gz"
sha256  = "602984a71000981e25e4feb419e6cdd70b18ffe2b8004f60f591706027bca468"

[build]
compiler    = "zig-cc"
target      = "x86_64-linux-musl"
link        = "dynamic"
zig_version = "0.13.0"

[build.phases]
configure = '''
ZW="$PWD/.zwrap"; mkdir -p "$ZW"
printf '#!/bin/sh\nexec /opt/zig/zig cc -mcpu=baseline "$@"\n'  > "$ZW/cc"
printf '#!/bin/sh\nexec /opt/zig/zig c++ -mcpu=baseline "$@"\n' > "$ZW/cxx"
chmod +x "$ZW/cc" "$ZW/cxx"
PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/share/pkgconfig \
cmake -B build -G Ninja -Wno-dev \
  -DCMAKE_C_COMPILER="$ZW/cc" -DCMAKE_CXX_COMPILER="$ZW/cxx" \
  -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_PREFIX_PATH=/usr \
  -DBUILD_TESTS=OFF -DUPDATE_DEPS=OFF \
  -DBUILD_WSI_XCB_SUPPORT=ON -DBUILD_WSI_XLIB_SUPPORT=ON \
  -DBUILD_WSI_XLIB_XRANDR_SUPPORT=OFF -DBUILD_WSI_WAYLAND_SUPPORT=ON
'''
compile = "cmake --build build"
install = "DESTDIR=/out cmake --install build"

[deps]
build = ["cmake", "samurai", "python3", "pkgconf", "vulkan-headers", "wayland", "libxcb", "libX11", "xorgproto", "libXau", "libXdmcp", "libXext", "libXrender", "libXfixes", "libXi"]
