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

pkgname=accountsservice
pkgver=25.34.76
pkgrel=2
pkgdesc="D-Bus interface for user account query and manipulation"
url="https://gitlab.freedesktop.org/accountsservice/accountsservice"
arch=(x86_64 aarch64)
license=(GPL-3.0-or-later)
depends=(
  glib2
  glibc
  json-c
  libgcc
  libxcrypt
  polkit
  shadow
  systemd
)
makedepends=(
  docbook-xsl
  git
  glib2-devel
  gobject-introspection
  gtk-doc
  meson
  vala
  xmlto
)
checkdepends=(
  glibc-locales
  python-dbusmock
  python-gobject
)
source=(
  "git+$url.git#tag=$pkgver"
  accounts-daemon-restart.hook
  0001-tests-Drop-check-format-test.patch
)
b2sums=('5a4d9107d2bfdd2d84d128bfccd36ca55a614a15548670eafa2aa3c8b568fc7de9279006242f8d7736507bc0d8eaad968979d9b575877cd449874b60835e257d'
        '62f69bafdfc08a9a43c3d2bd8e66461960603a91826d1b42001eb6f320e4b6b39bbe99fa715c08a995c295bf0626a88e35b2ef4f0fc96ff4ced6dfe805f1a2a2'
        'e59a6c0d092a28d34cc9f7260aa58cbe73e2a4d5d303f5676fcc929764cd1158e59c330cbd0115e895ca0cae52ed31e4f3ad2e2549fb7dbf618bf8327f1c438d')

prepare() {
  cd $pkgname

  # Fix build with patches
  git apply -3 ../0001-tests-Drop-check-format-test.patch
}

build() {
  local meson_options=(
    -D admin_group=wheel
    -D docbook=true
    -D gtk_doc=true
  )

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

check() {
  meson test -C build --print-errorlogs
}

package() {
  depends+=(
    libcrypt.so
    libg{lib,object,io}-2.0.so
    libsystemd.so
  )
  provides+=(libaccountsservice.so)

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

  install -Dt "$pkgdir/usr/share/libalpm/hooks" -m644 *.hook
  install -d "$pkgdir/usr/share/accountsservice/interfaces"
}

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