maintainer="fossdd <fossdd@pwned.life>"
pkgname=zint
pkgver=2.15.0
pkgrel=0
pkgdesc="Barcode encoding library supporting over 50 symbologies"
url="https://zint.org.uk/"
arch="all"
license="GPL-3.0-or-later"
makedepends="
	cmake
	ninja
	qt6-qtsvg-dev
	qt6-qttools-dev
	"
subpackages="
	$pkgname-qt
	$pkgname-dev
	$pkgname-doc
	"
source="https://downloads.sourceforge.net/zint/zint-$pkgver-src.tar.gz
	shared-libqzint.patch
	"
builddir="$srcdir/$pkgname-$pkgver-src"
options="!check" # tests fail

build() {
	CMAKE_PREFIX_PATH="6.0.0" \
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DUSE_QT6=ON \
		-DZINT_TEST="$(want_check && echo ON || echo OFF)"

	cmake --build build
}

check() {
	cmake --build build --target test
}

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

qt() {
	pkgdesc="Zint Barcode Studio GUI"
	depends="hicolor-icon-theme"

	amove usr/bin/zint-qt
	amove usr/include/qzint.h
	amove usr/lib/libQZint.so*

	install -Dm644 "$builddir"/zint-qt.desktop -t "$subpkgdir"/usr/share/applications/
	install -Dm644 "$builddir"/zint-qt.png -t "$subpkgdir"/usr/share/icons/hicolor/48x48/apps/
}

sha512sums="
7b5f44837a3a16637be5871ce848747ef520d623d86c88602c4ba8f0fe76705836ccee67a83e7ad0544e56b041dadbe88c5ed0b3219946be924213be18d74e2a  zint-2.15.0-src.tar.gz
11011523e7a130d59e1a7061ab17c394119194f9490fc3b9870b30344916138eca5dc9c4c0f38357364093bf4f50c78d143df7f344f6d190c00e9f0a16aa8c7b  shared-libqzint.patch
"
