# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
#
# TODO: Figure out how to ditch out Polkit (make it optional).
pkgname=fprintd
pkgver=1.94.4
pkgrel=0
pkgdesc="Daemon that provides fingerprint scanning functionality over D-Bus"
url="https://fprint.freedesktop.org/"
arch="all"
license="GPL-2.0-or-later"
depends="dbus"
makedepends="
	bash
	basu-dev
	cmd:pod2man
	gettext-dev
	libfprint-dev>=$pkgver
	linux-pam-dev
	meson
	polkit-dev
	"
checkdepends="
	dbus
	py3-cairo
	py3-dbus
	py3-dbusmock
	"
subpackages="$pkgname-doc $pkgname-lang $pkgname-pam"
source="https://gitlab.freedesktop.org/libfprint/fprintd/-/archive/v$pkgver/fprintd-v$pkgver.tar.gz
	add-test-feature-and-make-tests-optional.patch
	fix-missing-libintl.patch
	"
builddir="$srcdir/$pkgname-v$pkgver"
options="!check"  # tests are broken, they expect fprintd installed in "/"

build() {
	abuild-meson \
		-Dman=true \
		-Dgtk_doc=false \
		-Dsystemd=false \
		-Dlibsystemd=basu \
		-Dpam=true \
		-Dtests=false \
		output
	meson compile -C output
}

check() {
	meson test -C output --no-rebuild --print-errorlogs --no-stdsplit
}

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

pam() {
	pkgdesc="PAM module for fingerprint authentication"
	install_if="$pkgname=$pkgver-r$pkgrel linux-pam"

	amove usr/lib/security
}

sha512sums="
f8d0859d901da2ed419cb57a21dd51bab1b08057e60c555bac129e1f37777d946fc46752b27fc99a52040ef95529728f2936b65de7751ace0bba5c1c5787908d  fprintd-v1.94.4.tar.gz
25abf87dddc4f9b5e2bb7141b5468b10478bc37a3075cd8fbd4cc125e08a1487ff46d5d433366f5627c0bed3bca8e4d8845403ce6d01b59c1e4da11b4125f9c7  add-test-feature-and-make-tests-optional.patch
dabfeacd5677e5553bec559cdbc837dc298ac3729ca5d62f5dbe7c9fdc68ef8cd95c4b0d4b6c706553b9cffe5de59c7e4399e5d43d1b5fc142ac3a91673ef516  fix-missing-libintl.patch
"
