# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
pkgname=z3
pkgver=4.13.0
pkgrel=1
pkgdesc="Theorem prover from Microsoft Research"
url="https://github.com/Z3Prover/z3"
arch="all"
license="MIT"
makedepends="cmake python3 samurai"
subpackages="$pkgname-dev py3-$pkgname:py3:noarch"
source="https://github.com/Z3Prover/z3/archive/z3-$pkgver.tar.gz
	"
builddir="$srcdir/z3-z3-$pkgver"

build() {
	cmake -B build -G Ninja \
		-DZ3_BUILD_PYTHON_BINDINGS=True \
		-DZ3_INSTALL_PYTHON_BINDINGS=True \
		-DPYTHON_EXECUTABLE=/usr/bin/python3 \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=MinSizeRel
	cmake --build build

	# Binary for running the unit tests
	cmake --build build --target test-z3
}

check() {
	./build/test-z3 -a
}

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

py3() {
	pkgdesc="Python bindings for $pkgname"
	depends="python3"

	amove usr/lib/python3*
}

sha512sums="
8503787fe0b18592b5a131bcec2cacfa5f5096d76386a1c4fda7a836e472924b154433306d27600ff0d0758ddb710c965901fbfc2e5605919b624b9d4d1bc4fd  z3-4.13.0.tar.gz
"
