# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Ionut Biru <ibiru@archlinux.org>

pkgbase=gcr-4
pkgname=(
  gcr-4
  gcr-4-docs
)
pkgver=4.3.0
pkgrel=1
pkgdesc="A library for bits of crypto UI and parsing"
url="https://gitlab.gnome.org/GNOME/gcr"
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
license=(LGPL-2.1-or-later)
depends=(
  glib2
  glibc
  gnutls
  libp11-kit
  libsecret
  openssh
  systemd-libs
)
makedepends=(
  gi-docgen
  git
  glib2-devel
  gobject-introspection
  gtk4
  meson
  systemd
  vala
)
source=("git+https://gitlab.gnome.org/GNOME/gcr.git?signed#tag=$pkgver")
b2sums=('32e952b36530e18a63fb9c4d348575282adc48c2738846a40ec3a2207f1ede731c3e791bd123818e82bc628a17366fd8e68bff2ffdefcc166dd15cd18d29926c')
validpgpkeys=(
  EF3226243ABEFC1A828BC5B46A2AC2B52126D946 # Dhanuka Warusadura <dhanuka@gnome.org>
  A7C626E13F9AD776776BD9CA1D8A57CF2E8D36A3 # Niels De Graef (nielsdg) <nielsdegraef@gmail.com>
)

prepare() {
  cd gcr
}

build() {
  local meson_options=(
    -D crypto=gnutls
  )

  arch-meson gcr build "${meson_options[@]}"
  meson compile -C build
}

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

package_gcr-4() {
  optdepends=('gtk4: gcr-viewer-gtk4')
  provides=(
    libgck-2.so
    libgcr-4.so
  )

  meson install -C build --destdir "$pkgdir"

  mkdir -p doc/usr/share
  mv {"$pkgdir",doc}/usr/share/doc
}

package_gcr-4-docs() {
  pkgdesc+=" (documentation)"
  depends=()

  mv doc/* "$pkgdir"
}

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