# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer:
pkgname=rapidcheck
_commit=ff6af6fc683159deb51c543b065eba14dfcf329b
pkgver=0_git20231214
pkgrel=0
pkgdesc="QuickCheck-like property-based testing for C++"
url="https://github.com/emil-e/rapidcheck"
arch="all"
license="BSD-2-Clause"
makedepends="cmake samurai"
subpackages="$pkgname-dev"
options="!check"
# Explicit depends_dev since we have no librapidcheck.so symlink in -dev().
depends_dev="$pkgname=$pkgver-r$pkgrel"
source="$pkgname-$pkgver-$_commit.tar.gz::https://github.com/emil-e/rapidcheck/archive/$_commit.tar.gz"
builddir="$srcdir/$pkgname-$_commit"

# TODO: Upstream doesn't tag releases and doesn't provide an SONAME
# or a stable ABI for their shared library. Presently, we just ship
# an unversioned shared library in -dev. Rapidcheck is just a testing
# library so it's probably not too bad but it's also not ideal either.
#
# Could do static linking, but Nix seems to link its test dynamically :(
#
# Related: https://github.com/emil-e/rapidcheck/issues/255

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=ON \
		-DCMAKE_BUILD_TYPE=None \
		-DRC_ENABLE_GTEST=ON
	cmake --build build
}

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

sha512sums="
79f1e869a3c55f62d3609cc4b3a56977f720c3eacf5e1792aa3a9bd5ab90aa077371bc0902d6c31503885f9ebcc633ed242ae6995866cb46fd12afdf425500e3  rapidcheck-0_git20231214-ff6af6fc683159deb51c543b065eba14dfcf329b.tar.gz
"
