# Contributor: Laurent Carlier <lordheavym@gmail.com>

pkgname=static-compat-vulkan-headers
_pkgname=Vulkan-Headers
pkgver=1.4.313.0
pkgrel=1
epoch=2
pkgdesc="Vulkan header files"
arch=(any)
url="https://www.vulkan.org/"
license=("Apache-2.0 OR MIT")
makedepends=(static-compat-cmake git ninja)
provides=("static-compat-vulkan-hpp=${pkgver}")
source=(
  "git+https://github.com/KhronosGroup/Vulkan-Headers#tag=vulkan-sdk-$pkgver"
  0001-Remove-Werror.patch
)
b2sums=('5e1cb2ba4a68fb4224ce5badb9b7d2d5da28ae2f7b440b502cc8433c82537458fc12c398539606981180e2937afdfca7e5179d082ece14bb597c08b3b7358f81'
        '5d7201f11850cdf8242057034e90c60ad7518c14fdcb091dc63ca6be6b10567c229f96b3dcdb3ecf57856f7b72bceb4048e4a6e5e1faf6bb98262324f408dbb8')

prepare() {
  cd Vulkan-Headers

  # GCC 15 fix
  git apply -3 ../0001-Remove-Werror.patch
}

build() {
  source static-compat-environment
  static-compat-cmake -S Vulkan-Headers -B build -G Ninja
  cmake --build build
}

check() {
  ctest --test-dir build --output-on-failure --stop-on-failure
}

package() {
  source static-compat-environment
  DESTDIR="$pkgdir" cmake --install build
  install -Dm644 Vulkan-Headers/LICENSES/MIT.txt \
    -t "$pkgdir/usr/share/licenses/$pkgname"
}
