# Contributor: Sodface <sod@sodface.com>
# Maintainer: Sodface <sod@sodface.com>
pkgname=sdcv
pkgver=0.5.5
pkgrel=1
pkgdesc="Console version of StarDict"
url="https://dushistov.github.io/sdcv/"
license="GPL-2.0-or-later"
arch="all"
makedepends="cmake glib-dev readline-dev samurai zlib-dev"
checkdepends="jq"
subpackages="$pkgname-doc $pkgname-lang"
source="$pkgname-$pkgver.tar.gz::https://github.com/Dushistov/sdcv/archive/v$pkgver.tar.gz
	gcc14.patch
	"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		local crossopts="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=None \
		-DBUILD_TESTS=True \
		$crossopts
	cmake --build build
}

check() {
	ctest --test-dir build -j1
}

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

sha512sums="
6059e1ddc43a023f7cb0e2a8d99929bcb204c211863fce4dece2dc30b92e7d1ce91bc25d2ed4bc54b713f61671264ac7e906d2b9ce078fa943cc5d81cd5d37dd  sdcv-0.5.5.tar.gz
d37aca0493f369299c6b8436b10950514348bd2e15e8886d247dbdb771c31ca7eda605100136925b86c63c041a0db02dab32bd0f392452234b8cf0fafd034d70  gcc14.patch
"
