# Maintainer: Marian Buschsieweke <marian.buschsieweke@posteo.net>
pkgname=cgal
pkgver=5.6
pkgrel=1
pkgdesc="Efficient and reliable geometric algorithms as C++ library"
url="https://www.cgal.org/"
# lib is header-only since 5.0
arch="noarch"
license="GPL-3.0-or-later custom" # Dual licensed under GPL-3.0+ and commercial
subpackages="$pkgname-dev $pkgname-doc"
makedepends="mpfr-dev gmp-dev mesa-dev glu-dev boost-dev cmake zlib-dev ninja"
source="$pkgname-$pkgver.tar.xz::https://github.com/CGAL/cgal/releases/download/v$pkgver/CGAL-$pkgver.tar.xz"
builddir="$srcdir/CGAL-$pkgver"
# Citing from https://github.com/CGAL/cgal/wiki/Testing#test-suite-directory
# > The test/ directory is not part of external releases.
options="!check"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	install -t "$pkgdir"/usr/share/licenses/$pkgname -Dm644 LICENSE*
}

dev() {
	default_dev
	amove usr/bin/cgal_create_CMakeLists
	amove usr/bin/cgal_create_cmake_script
	amove usr/bin/cgal_make_macosx_app
}

sha512sums="
1d91ad870b63bce36e060c0de7fa2e7ab98f9d9f6cf7c94d91a6677db237f50c28f8fc49f24bef943b2adcb5a4a8acf01dd94092a97024c33413763348131ea4  cgal-5.6.tar.xz
"
