pkgname=vulkan-loader
pkgver=1.4.328.0
_basever="${pkgver%.*}"
pkgdesc="Vulkan Installable Client Driver (ICD) Loader"
homepage="https://www.vulkan.org/"
arch=(x86_64)
license=(Apache-2.0)
depends=(glibc)
makedepends=(
  cmake
  ninja
  vulkan-headers
  wayland
)
sources=("Vulkan-Loader-${_basever}.tar.gz")
urls=("https://github.com/KhronosGroup/Vulkan-Loader/archive/v${_basever}/${sources[0]}")
md5sums=("bd24b3a4ac62e3c25281da497afdf278")

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
}

src_build() {
  local cmake_options=(
    -D CMAKE_C_FLAGS="${CFLAGS} -DNDEBUG"
    -D CMAKE_CXX_FLAGS="${CXXFLAGS} -DNDEBUG"
    -D CMAKE_BUILD_TYPE=Release
    -D CMAKE_INSTALL_PREFIX=/usr
    -D CMAKE_INSTALL_SYSCONFDIR=/etc
    -D CMAKE_SKIP_INSTALL_RPATH=ON
    -D BUILD_WSI_WAYLAND_SUPPORT=ON
    -D BUILD_WSI_XCB_SUPPORT=OFF
    -D BUILD_WSI_XLIB_SUPPORT=OFF
  )
  cmake -B build -G Ninja "${cmake_options[@]}"
  cmake --build build
}

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

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

# vim:ft=sh syn=sh et sw=2:
