# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=libzim
pkgver=9.2.3
_testing_suite_ver=0.7.0
pkgrel=0
pkgdesc="Reference implementation of the ZIM file format"
url="https://openzim.org/"
arch="all"
license="GPL-2.0-or-later"
options="!check" #temporary disable tests
makedepends="
	icu-dev
	meson
	xapian-core-dev
	xz-dev
	zlib-dev
	zstd-dev
	"
checkdepends="
	cython
	gtest-dev
	python3-dev
	"
subpackages="$pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver-2.tar.gz::https://github.com/openzim/libzim/archive/$pkgver.tar.gz
	https://github.com/openzim/zim-testing-suite/releases/download/$_testing_suite_ver/zim-testing-suite-$_testing_suite_ver.tar.gz
	icu-76.patch
	"

build() {
	abuild-meson . output \
		-Dtest_data_dir="$srcdir/zim-testing-suite/data"
	meson compile -C output
}

check() {
	SKIP_BIG_MEMORY_TEST=1 meson test --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output

	install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
}

sha512sums="
31b29a4727320ecf3a0d59b7bd7c8c5485ee29d5f028fbad53316edf53e35a239e6f7f45e2a99bcddadda22846823b89dfdfc1b805542f3fbd1180065a227744  libzim-9.2.3-2.tar.gz
cdb96967c9d303cd3ddf0d7bf04889684f870c9e36ab7a6e38bdd82b8b685331eaa0348aa0496898d7c9444fcdc0d435eda421a446bb0a14982997833db57247  zim-testing-suite-0.7.0.tar.gz
e18f74d973a6312b80caae2336de9d0e20d11d0d18708e91c9a6dd74064aa530b1501267b622eeb06954ad9f4fa2658d3c180a40124d60921c5c285e927930ed  icu-76.patch
"
