# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Jan De Groot <jgc@archlinux.org>

pkgname=gnome-keyring
pkgver=46.1
pkgrel=2
epoch=1
pkgdesc="Stores passwords and encryption keys"
url="https://wiki.gnome.org/Projects/GnomeKeyring"
arch=(x86_64 aarch64)
license=(
  GPL-2.0-or-later
  LGPL-2.1-or-later
)
depends=(
  dconf
  gcr
  gcr-4
  glib2
  glibc
  libgcrypt
  pam
  systemd-libs
)
makedepends=(
  docbook-xsl
  git
  p11-kit
  python
  python-packaging
)
provides=(org.freedesktop.secrets)
groups=(gnome)
install=gnome-keyring.install
_commit=4e173494bf15795a1ebab6e2bbd9377fac456240  # tags/46.1^0
source=(
  "git+https://gitlab.gnome.org/GNOME/gnome-keyring.git#commit=$_commit"
  0001-daemon-Add-Cinnamon-to-autostart-files.patch
)
b2sums=('SKIP'
        '584832e529ee2be98b78b128ab4271fae919a194f2d9254526943da6baccfe5eb6deb17ee03cfb54261cade4be0e93ea7fbcc91ebc77ecfacd2f25d90f9e29c4')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd $pkgname

  # Autolaunch in Cinnamon
  git apply -3 ../0001-daemon-Add-Cinnamon-to-autostart-files.patch

  NOCONFIGURE=1 ./autogen.sh
}

build() {
  local configure_options=(
    --prefix=/usr
    --sysconfdir=/etc
    --localstatedir=/var
    --libexecdir=/usr/lib
    --with-pam-dir=/usr/lib/security
    --without-libcap-ng
    --disable-static
    --disable-schemas-compile
  )

  cd $pkgname
  ./configure "${configure_options[@]}"
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

check() {
  cd $pkgname
  # Secure memory tests fail
  dbus-run-session make -k check || :
}

package() {
  cd $pkgname
  make DESTDIR="$pkgdir" install
}

# vim:set sw=2 sts=-1 et:
