pkgname=spirv-headers
pkgver=1.4.328.0
pkgdesc="SPIR-V header files and registry"
homepage="https://www.khronos.org/spirv/"
arch=(any)
license=(MIT)
makedepends=(
  cmake
  ninja
)
sources=("${pkgname}-${pkgver}.tar.gz")
urls=("https://github.com/KhronosGroup/SPIRV-Headers/archive/vulkan-sdk-${pkgver}.tar.gz")
md5sums=("342ebebcea5dae02f7e6638fe753f249")

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
  )

  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

  install -Dm644 README.md "${pkgdir}"/usr/share/doc/${pkgname}-${pkgver}/README.md
  install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
}


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