# Forked from Alpine
# systemd unit activation
# Co-Maintainer: Pablo Correa Gomez <pabloyoyoista@postmarketos.org>
# Co-Maintainer: Achill Gilgenast <achill@achill.org>
maintainer="Newbyte <newbyte@postmarketos.org>"
pkgname=gnome-keyring
_pkgver=48.0
pkgver=9999$_pkgver
pkgrel=1
pkgdesc="GNOME keyring"
url="https://gitlab.gnome.org/GNOME/gnome-keyring"
# armhf: pmb#2618
arch="all !armhf"
license="GPL-2.0-only LGPL-2.0-only"
# the gcr binaries are needed for things to open the keyring via libsecret
depends="gcr"
makedepends="
	gcr-dev
	gobject-introspection-dev
	gtk+3.0-dev
	gtk-doc
	intltool
	libcap-ng-dev
	libgcrypt-dev
	libxslt
	linux-pam-dev
	meson
	openssh-client
	systemd-dev
	"
checkdepends="
	dbus
	python3
	"
provides="dbus:org.freedesktop.Secrets"
# Highest priority of the bunch since it has the least deps
provider_priority=500
options="!check" # flaky
subpackages="
	$pkgname-doc
	$pkgname-lang
	$pkgname-pam
	$pkgname-systemd
	"
source="https://download.gnome.org/sources/gnome-keyring/${_pkgver%.*}/gnome-keyring-$_pkgver.tar.xz
	libgkm-source-gkm-marshal.patch"
builddir="$srcdir/gnome-keyring-$_pkgver"

build() {
	abuild-meson \
		-Dsystemd=enabled \
		. output
	meson compile -C output
}

check() {
	dbus-run-session \
	meson test --print-errorlogs -C output
}

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

pam() {
	pkgdesc="PAM module for gnome-keyring"
	depends=""
	# Allows disabling installation of the PAM module via `apk add !gnome-keyring-pam`.
	#
	# See https://gitlab.alpinelinux.org/alpine/aports/-/issues/16999
	install_if="$pkgname=$pkgver-r$pkgrel"

	amove usr/lib/security/pam*
}

sha512sums="
9eac06164c22a854a171f538467403c6764a6a6c2665959d721f5e3515bd91c8709a374c292cde93143f944b4ed7ec9b5613d28808d7e79839a9377d5aaa5daa  gnome-keyring-48.0.tar.xz
7e2494f11423136856813349d4c0363b3cb11f0ea147048cfce10e383f93c8901b903bdcb02581268de7cd8f2513acf169f767de860134beb4716b5ee5323410  libgkm-source-gkm-marshal.patch
"
