# Maintainer: Sergiy Stupar <owner@sestolab.pp.ua>
pkgname=recastnavigation
pkgver=1.6.0
pkgrel=2
pkgdesc="Navigation-mesh Toolset for Games"
url="https://github.com/recastnavigation/recastnavigation"
arch="all"
license="Zlib"
makedepends="cmake samurai"
subpackages="
	$pkgname-dev
	libDebugUtils:lib
	libDetour:lib
	libDetourCrowd:lib
	libDetourTileCache:lib
	libRecast:lib
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/recastnavigation/recastnavigation/archive/refs/tags/v$pkgver.tar.gz"

build() {
	CXXFLAGS="$CXXFLAGS -flto=auto -DNDEBUG" \
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_SHARED_LIBS=ON \
		-DRECASTNAVIGATION_TESTS="$(want_check && echo ON || echo OFF)" \
		-DRECASTNAVIGATION_DEMO=OFF \
		-DRECASTNAVIGATION_EXAMPLES=OFF
	cmake --build build
}

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

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

lib() {
	pkgdesc="$pkgdesc ($subpkgname library)"

	amove usr/lib/$subpkgname.so.*
}

sha512sums="
7567aaa78219cc490a6f76210fba1f130f0c17aeaa06432ab1207e0fd03404abe31042e8b03971aa0d04ad65d39469f13575fe0072fb920c38581d39568b70fb  recastnavigation-1.6.0.tar.gz
"
