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

pkgname=static-compat-vulkan-headers
_pkgname=Vulkan-Headers
pkgver=1.4.328.1
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=('3055d45fe4d276a771b148a24149275ee67cb844ec1a2853cc07bc5bb8cd847b3c1563c87929dcd5cee55c797f2e529dd50c57d2d31d04b05cb4de05d774a63b'
        'f40a6ca5aa9d80b598b0d04ae9171062152ede95d663189ae2617bf86a23a6885cc8bcf2923e3b75fa1eb8f9c8403eb79a6d9b33019a10261abc6707b76f0c29')

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"
}
