# Template file for 'SPIRV-LLVM-Translator22'
pkgname=SPIRV-LLVM-Translator22
version=22.1.2
revision=1
_llvm_ver=${version%%.*}
build_style=cmake
configure_args="
 -DBUILD_SHARED_LIBS=ON
 -DCMAKE_PREFIX_PATH=${XBPS_CROSS_BASE}/usr/lib/llvm/${_llvm_ver}
 -DCMAKE_SKIP_RPATH=ON
 -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=/usr
 -DLLVM_LINK_LLVM_DYLIB=ON
 -DLLVM_SPIRV_INCLUDE_TESTS=OFF
"
hostmakedepends="clang${_llvm_ver} llvm${_llvm_ver} pkg-config"
makedepends="llvm${_llvm_ver}-devel SPIRV-Headers SPIRV-Tools-devel"
short_desc="API and commands for processing SPIR-V modules - LLVM ${_llvm_ver}"
maintainer="Duncaen <duncaen@voidlinux.org>"
license="NCSA"
homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
distfiles="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/refs/tags/v${version}.tar.gz"
checksum=b37196b1a1a60282a24cf937ab7d6807d7d54dc718f2a37a78e211be26df57ac

alternatives="llvm-spirv:llvm-spirv:/usr/bin/llvm-spirv-${_llvm_ver}"

post_install() {
	mv ${DESTDIR}/usr/bin/llvm-spirv ${DESTDIR}/usr/bin/llvm-spirv-${_llvm_ver}
	vlicense LICENSE.TXT
}

SPIRV-LLVM-Translator22-devel_package() {
	depends="SPIRV-LLVM-Translator${_llvm_ver}-${version}_${revision}"
	conflicts="SPIRV-LLVM-Translator-devel>=0 SPIRV-LLVM-Translator21-devel>=0
		SPIRV-LLVM-Translator19-devel>=0"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/pkgconfig
		vmove "usr/lib/*.so"
	}
}
