# Contributor: Grigory Kirillov <txgk@bk.ru>
# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=plfit
pkgver=1.0.0
pkgrel=0
pkgdesc="Tool for fitting power-law distributions to empirical data"
url="https://github.com/ntamas/plfit"
arch="all"
license="GPL-2.0-only"
makedepends="cmake samurai"
subpackages="$pkgname-static $pkgname-libs $pkgname-dev"
source="https://github.com/ntamas/plfit/archive/$pkgver/plfit-$pkgver.tar.gz"

build() {
	cmake -B builddir -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=Release \
		-DBUILD_SHARED_LIBS=ON
	cmake -B builddir-static -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=Release
	cmake --build builddir
	cmake --build builddir-static
}

check() {
	ctest --output-on-failure --test-dir builddir
}

package() {
	# Install static build first because we want the utilities to be linked dynamically.
	DESTDIR="$pkgdir" cmake --install builddir-static
	DESTDIR="$pkgdir" cmake --install builddir
}

sha512sums="
c85cf60c942095447e827d856996d4cc64dc12c20adf2209886050950419e253651653f148105ffc3506e7133193dcc8951814fb808aeefe3d28dd4631fe7ba0  plfit-1.0.0.tar.gz
"
