# Contributor: Timo Teräs <timo.teras@iki.fi>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=libfprint
pkgver=1.94.9
pkgrel=0
pkgdesc="Library for fingerprint readers"
url="https://fprint.freedesktop.org/"
arch="all"
license="LGPL-2.1-or-later"
makedepends="
	eudev-dev
	glib-dev
	gobject-introspection-dev
	libgudev-dev
	libgusb-dev
	meson
	openssl-dev
	pixman-dev
	"
checkdepends="
	py3-cairo
	py3-gobject3
	umockdev
	"
subpackages="$pkgname-dev"
source="https://gitlab.freedesktop.org/libfprint/libfprint/-/archive/v$pkgver/libfprint-v$pkgver.tar.gz
	hack-generate-rules-instead-of-hwdb.patch
	0001-tests-fix-identify_done-callbacks.patch
	"
builddir="$srcdir/$pkgname-v$pkgver"

build() {
	abuild-meson \
		-Dgtk-examples=false \
		-Ddoc=false \
		-Dudev_hwdb=disabled \
		-Dudev_rules=enabled \
		-Dinstalled-tests=false \
		output
	meson compile -C output

	# See comment in hack-generate-rules-instead-of-hwdb.patch.
	HACK_GEN_RULES=1 ./output/libfprint/fprint-list-udev-hwdb > 60-fprint-autosuspend.rules
}

check() {
	meson test -C output --print-errorlogs --no-stdsplit --timeout-multiplier 5
}

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

	install -Dm644 60-fprint-autosuspend.rules -t "$pkgdir"/usr/lib/udev/rules.d/
}

sha512sums="
f8debcc1277e6112ed450c04a40cf6113afd7b38377b3fd259bedb1f553b29db758f3519491940bf9cd4ade0f8e70b68040d5bef4c8dbf5f7c2afc1802086397  libfprint-v1.94.9.tar.gz
5997cb0e3bfc0f625a0803d2d59fa55ce34baf7aee7c4fb3d82c74ea680d916a4e1294bbaf97a4567053672f1115d51f2a8b887927af063e2750e6a0e40d8d64  hack-generate-rules-instead-of-hwdb.patch
2141f4a1d4a0305a588cac80e47759ccceac93c16ba700d60c2e97696a753d56d2a029096421bed940f5371c98cb321531db5a8ee96045e21affe0dff792fa72  0001-tests-fix-identify_done-callbacks.patch
"
