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

pkgname=spirv-tools
pkgver=1.4.328.0
pkgrel=1
epoch=1
pkgdesc="API and commands for processing SPIR-V modules"
url="https://www.khronos.org/spirv/"
arch=(x86_64 aarch64)
license=(Apache-2.0)
depends=(
  gcc-libs
  glibc
  sh
)
makedepends=(
  cmake
  git
  ninja
  python
  spirv-headers
)
groups=(vulkan-devel)
source=("git+https://github.com/KhronosGroup/SPIRV-Tools#tag=vulkan-sdk-$pkgver")
b2sums=('af7a6cc07a03ef235977ffe42bb752ee44b81cc2229a3726ae10e9c86a3c5725d88240e3e3a3a40b26cfd96485eb44999642eccd1f4393bcc442779defa7666f')

build() {
  local cmake_options=(
    -D BUILD_SHARED_LIBS=ON
    -D CMAKE_BUILD_TYPE=Release
    -D CMAKE_INSTALL_PREFIX=/usr
    -D CMAKE_INSTALL_SYSCONFDIR=/etc
    -D CMAKE_SKIP_INSTALL_RPATH=ON
    -D SPIRV-Headers_SOURCE_DIR=/usr
    -D SPIRV_TOOLS_BUILD_STATIC=OFF
    -D SPIRV_WERROR=OFF
  )

  cmake -S SPIRV-Tools -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:
