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

# We can't move this package in lockstep with the rest of the vulkan group until
# the conflict with the CAC extension is fixed upstream.
# X-ref: https://gitlab.steamos.cloud/deckard/tasks/-/work_items/995
#source ../vulkan-headers/vulkan_common.pkgbuild

pkgname=vulkan-icd-loader
pkgver="1.4.309.0"
pkgrel="8"
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=(
  "git+https://github.com/KhronosGroup/Vulkan-Loader#tag=vulkan-sdk-${pkgver}"
)
b2sums=('ffb59db878463016775643efd6cc1a03820711bbf2b52fb3755856429c22d9d8eacd29d8bcbef855e306569c5712b1bf992d089416348b1a9d546afaf8529dc0')

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:
