# Contributor: fossdd <fossdd@pwned.life>
# Maintainer: fossdd <fossdd@pwned.life>
pkgname=zint
pkgver=2.13.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
	no-rpath.patch
	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="
8dacd8088ab9c99ea64bf1aa49b618251d1e2d49382817d536a824ef25d9e8f0e2d8dbd0baa5dc1b4945dbede83d1af08e9f317107b1356a3ceb382acb6dd8c2  zint-2.13.0-src.tar.gz
20e500a2ee201742fd9924548d845a70cb250eab33f6de8f796e288cd19096f7f955499559ff97b0025b23f78d233875a5348be447bde18d6c98db3bcb72fa5e  no-rpath.patch
11011523e7a130d59e1a7061ab17c394119194f9490fc3b9870b30344916138eca5dc9c4c0f38357364093bf4f50c78d143df7f344f6d190c00e9f0a16aa8c7b  shared-libqzint.patch
"
