# Contributor: Holger Jaekel <holger.jaekel@gmx.de>
maintainer="Holger Jaekel <holger.jaekel@gmx.de>"
pkgname=sfcgal
pkgver=2.0.0
pkgrel=0
pkgdesc="Library for ISO 19107:2013 and OGC SFA 1.2 for 3D operations"
url="https://sfcgal.gitlab.io/SFCGAL/index.html"
arch="all"
license="LGPL-2.0-or-later"
makedepends="
	boost-dev
	cgal-dev
	cmake
	gmp-dev
	mpfr-dev
	samurai
	"
subpackages="$pkgname-dev"
source="https://gitlab.com/sfcgal/SFCGAL/-/archive/v$pkgver/SFCGAL-v$pkgver.tar.bz2"
builddir="$srcdir/SFCGAL-v$pkgver"

[ "$CARCH" = s390x ] && options="$options !check" # hangs on the CI

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DSFCGAL_BUILD_TESTS="$(want_check && echo ON || echo OFF)" \
		-DSFCGAL_WITH_OSG=OFF \
		-DCMAKE_SKIP_INSTALL_RPATH=ON
	cmake --build build
}

check() {
	ctest --test-dir build -E "garden-test"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	# installs tests
	rm -rf "$pkgdir"/usr/bin/*test*
}

sha512sums="
68a0ea2288de9ee88b956a92853251f977e1d89bd30ebb879c319d93311dfca5333ce4178a162d3c08ef976b2496221902456b74f66ea161950a52a6e3e5237b  SFCGAL-v2.0.0.tar.bz2
"
