# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Ionut Biru <ibiru@archlinux.org>

pkgname=gcr
pkgver=3.40.0
pkgrel=1
pkgdesc="A library for bits of crypto UI and parsing"
url="https://gitlab.gnome.org/GNOME/gcr"
arch=(x86_64)
license=(GPL2)
depends=(gtk3 libgcrypt p11-kit)
makedepends=(gobject-introspection vala libxslt git gtk-doc meson)
provides=(libgck-1.so libgcr-{base,ui}-3.so)
_commit=dbde3e131180bcee7c930e21170da05ec0494a3d  # tags/3.40.0^0
backup=(etc/security/limits.d/10-gcr.conf)
install=gcr.install
source=("git+https://gitlab.gnome.org/GNOME/gcr.git#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd $pkgname
}

build() {
  arch-meson $pkgname build
  meson compile -C build
}

check() {
  # Secure memory tests fail
  dbus-run-session meson test -C build --print-errorlogs || :
}

package() {
  DESTDIR="$pkgdir" meson install -C build

  # gcr wants to lock some memory to prevent swapping out private keys
  # https://bugs.archlinux.org/task/32616
  # https://bugzilla.gnome.org/show_bug.cgi?id=688161
  install -Dm644 /dev/stdin "$pkgdir/etc/security/limits.d/10-gcr.conf" <<END
@users - memlock 1024
END
}

# vim:set ts=2 sw=2 et:
