# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Maintainer: Laurent Carlier <lordheavym@gmail.com>

source ../vulkan-headers/vulkan_common.pkgbuild

pkgname=vulkan-icd-loader
pkgver="${_pkgver}"
pkgrel="${_pkgrel}"
pkgdesc="Vulkan Installable Client Driver (ICD) Loader"
url="https://www.vulkan.org/"
arch=(x86_64)
license=(Apache-2.0)
depends=(glibc)
makedepends=(
  cmake
  git
  libx11
  libxrandr
  ninja
  python-lxml
  vulkan-headers
  wayland
  'python>=3.13'
  'python<3.15'
)
optdepends=(
  # vulkan-driver: vulkan-intel/vulkan-radeon/nvidia-utils/....
  'vulkan-driver: packaged vulkan driver'
)
provides=(libvulkan.so)
groups=(vulkan-devel)
source=(
  "${_vulkan_loader_url}"
)
b2sums=('259bb9fae3c7f84a2d3439dd5b4a3ca8a777ab2ac867f91cea4647326d7fdd3425437ff98e9622cc98091e8cd9534fb7b30fb4459d3e7cf2b3488104a1b5e3d1')

build() {
  local cmake_options=(
    -D CMAKE_BUILD_TYPE=Release
    -D CMAKE_INSTALL_PREFIX=/usr
    -D CMAKE_INSTALL_SYSCONFDIR=/etc
    -D CMAKE_SKIP_INSTALL_RPATH=ON
  )

  cmake -S Vulkan-Loader -B build -G Ninja "${cmake_options[@]}"
  cmake --build build
}

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

package() {
  DESTDIR="$pkgdir" cmake --install build
}

# vim:set sw=2 sts=-1 et:
