# Maintainer:
pkgname=rapidfuzz
pkgver=2.2.3
pkgrel=0
pkgdesc="Rapid fuzzy string matching in C++ using the Levenshtein Distance"
url="https://github.com/maxbachmann/rapidfuzz-cpp"
arch="all"
license="MIT"
makedepends="
	cmake
	samurai
	"
checkdepends="catch2-3"
source="$pkgname-$pkgver.tar.gz::https://github.com/maxbachmann/rapidfuzz-cpp/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/rapidfuzz-cpp-$pkgver"

case "$CARCH" in
x86)
	# float rounding
	options="!check"
	;;
esac

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DRAPIDFUZZ_BUILD_TESTING="$(want_check && echo ON || echo OFF)"
	cmake --build build
}

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

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

sha512sums="
5ef4833334ccc3309d43ae4a2644eb57fa2a382b797c791b150b8d78451d7e6d57a8af23d0b7645eecfe539a128d2d8585e2a7380b6772b23cf8fd71d6a7f38b  rapidfuzz-2.2.3.tar.gz
"
