pkgname=glslang
pkgver=1.4.328.0
pkgdesc="OpenGL and OpenGL ES shader front end and validator"
homepage="https://github.com/KhronosGroup/glslang"
arch=('x86_64')
license=('BSD-3-Clause')
depends=('gcc-libs' 'spirv-tools')
makedepends=('cmake' 'ninja' 'spirv-headers' 'python')
sources=("${pkgname}-${pkgver}.tar.gz")
urls=("${homepage}/archive/vulkan-sdk-${pkgver}.tar.gz")
md5sums=("844c0aaaacbfae2a5bd3c71f498ed7c2")

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

src_build() {
  cmake \
    -B build \
    -GNinja \
    -DCMAKE_INSTALL_PREFIX='/usr' \
    -DCMAKE_BUILD_TYPE=Release \
    -DALLOW_EXTERNAL_SPIRV_TOOLS='ON' \
    -DBUILD_SHARED_LIBS='ON' \
    -DGLSLANG_TESTS='ON' \
    -DENABLE_PCH=OFF
  cmake --build build
}

src_check() {
  ninja -C build test
}

src_install() {
  DESTDIR="${pkgdir}" cmake --install build
  install -Dm644 LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

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