# Maintainer:
pkgname=krita-kseexpr
pkgver=4.0.4.0
pkgrel=1
pkgdesc="Krita fork of the KSeExpr embedded evaluation engine"
url="https://github.com/KDE/kseexpr"
arch="all"
license="Apache-2.0"
makedepends="
	cmake
	extra-cmake-modules
	qt5-qtbase-dev
	samurai
	"
checkdepends="gtest-dev"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/KDE/kseexpr/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/kseexpr-$pkgver"
options="!check" # the tests use some glibc features, todo

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

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

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

sha512sums="
f69457464b80f5c0247cf27632f4811b7ad66c658310fce46372dfc1873c79ee03b59762c6a17edb04da1bacbcb2a6c7ef8cf54cea932b38079be7ee587556f4  krita-kseexpr-4.0.4.0.tar.gz
"
