pkgname=vulkan-headers
pkgver=1.4.328.0
_basever="${pkgver%.*}"
pkgdesc="Vulkan header files and API registry"
homepage="https://www.vulkan.org/"
arch=(any)
license=("Apache-2.0 OR MIT")
depends=()
makedepends=(
  cmake
  ninja
  python
)
sources=("Vulkan-Headers-${_basever}.tar.gz")
urls=("https://github.com/KhronosGroup/Vulkan-Headers/archive/v${_basever}/${sources[0]}")
md5sums=("17bc769b0cef7d9acbc0ed1710d0311f")

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

src_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
    -D VULKAN_HEADERS_ENABLE_MODULE=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

  python -m compileall -d /usr "$pkgdir/usr"
  python -O -m compileall -d /usr "$pkgdir/usr"

  install -Dm644 LICENSES/MIT.txt \
    -t "$pkgdir/usr/share/licenses/$pkgname"
}

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