# Contributor: Leon Marz <main@lmarz.org>
# Maintainer: Leon Marz <main@lmarz.org>
pkgname=ispc
pkgver=1.26.0
pkgrel=0
pkgdesc="Intel SPMD Program Compiler"
url="https://ispc.github.io/"
arch="x86_64 aarch64" # ispc only supports these arches
license="BSD-3-Clause"
_llvmver=19
makedepends="cmake
	bison
	clang$_llvmver-dev
	flex
	llvm$_llvmver-dev
	llvm$_llvmver-test-utils
	m4
	python3
	samurai
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/ispc/ispc/archive/v$pkgver.tar.gz"
options="!check" # ctest does not find a testsuite

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_C_COMPILER="/usr/lib/llvm$_llvmver/bin/clang" \
		-DCMAKE_CXX_COMPILER="/usr/lib/llvm$_llvmver/bin/clang++" \
		-DLLVM_CONFIG_EXECUTABLE="/usr/lib/llvm$_llvmver/bin/llvm-config" \
		-DISPC_INCLUDE_EXAMPLES=OFF \
		-DISPC_INCLUDE_RT=OFF \
		-DISPC_SLIM_BINARY=ON

	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
8a042a8a57aa2e22236f9a7f6e1e35e63d552442370a075d636ba10f7e1ca33317e3547533ed26ff21fa79ebd2f7b91f932da916008a29f5d3213955dc961548  ispc-1.26.0.tar.gz
"
