# Maintainer: Luca Weiss <luca@lucaweiss.eu>
# Contributor: Brandon Boese <brandonboese@protonmail.com>
pkgname=persistent-cache-cpp
pkgver=1.0.7
pkgrel=2
pkgdesc="Cache of key-value pairs with persistent storage for C++ 11"
url="https://gitlab.com/ubports/development/core/lib-cpp/persistent-cache-cpp"
arch="all"
license="LGPL-3.0-only"
depends="
	dconf
	"
depends_dev="
	boost-dev
	leveldb-dev
	"
makedepends="
	$depends_dev
	cmake
	cmake-extras
	gtest-dev
	samurai
	"
checkdepends="
	xvfb-run
	"
subpackages="$pkgname-dev $pkgname-doc"
source="https://gitlab.com/ubports/development/core/lib-cpp/persistent-cache-cpp/-/archive/$pkgver/persistent-cache-cpp-$pkgver.tar.gz
	0001-src-core-Add-library-versioning.patch
	remove-docs-html-from-makefile.patch
	"
options="!check" # 91% tests passed, 1 tests failed out of 11

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

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

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

sha512sums="
752c758155510c2168c2a4982938867e133b8d8b2bbf3882bce8a2d83fd1547bbcee07dcd239b1732d1dda68b645f5e5fb1c02d1b316218fbb82fb8463ef8afb  persistent-cache-cpp-1.0.7.tar.gz
0bdfcdf80548fe827850f8813bf084e11cddd6bf596093d8d005528ecaa86fc0b752d07432fa588e1e95e292cc0c0df6c16e4f957aa016de7a844d20b7f65a9c  0001-src-core-Add-library-versioning.patch
36ff4a45f203df026c595b0bdc39dd1a40a8fd43dbc30d06184bbfa9a34d26a469e2faca8574b7a18bfbdcd6da36a1f1dd7f486a01f59db4d7d1264506916f30  remove-docs-html-from-makefile.patch
"
