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

pkgname=polkit
pkgver=126
pkgrel=2
pkgdesc="Application development toolkit for controlling system-wide privileges"
url="https://github.com/polkit-org/polkit"
arch=(x86_64 aarch64)
license=(LGPL-2.0-or-later)
depends=(
  duktape
  expat
  glib2
  glibc
  pam
  systemd-libs
)
makedepends=(
  dbus
  git
  glib2-devel
  gobject-introspection
  gtk-doc
  meson
  systemd
)
checkdepends=(python-dbusmock)
provides=(libpolkit-{agent,gobject}-1.so)
install=polkit.install
source=(
  "git+$url#tag=$pkgver"
  0001-meson-Support-explicit-GID.patch
  0002-meson-Detect-Arch-Linux-and-set-the-UID-and-GID.patch
)
b2sums=('20659c1a622208e1db7d5f65c5ab75a6a35c55472b5abdadc5405fb83f678e7eb9fe4ac32b1947f6956cc1204f5caa2cad2f5db81de7ea49cdb13bd309c94fa4'
        '9bfb6911469af4d86c973fb3c0949715b3ed6217f20643c7399d79c7a271c24f8c8399442d86903fcc333f62618d7f6b0a7737764e5a3ce829c577b79e30b7d4'
        'f6dc32e6b56129bf8e181c2cce91c868eddb9e6c82e3d674f3ce5085c0ecde005b625b621c1ef28d3afbdcfbfc4d7586dbd4dfed5a611f251388c81270bc380b')

prepare() {
  cd polkit
  git apply -3 ../0001-meson-Support-explicit-GID.patch
  git apply -3 ../0002-meson-Detect-Arch-Linux-and-set-the-UID-and-GID.patch
}

build() {
  local meson_options=(
    -D examples=true
    -D gettext=true
    -D gtk_doc=true
    -D man=true
    -D tests=true
  )

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

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

package() {
  meson install -C build --destdir "$pkgdir"
}

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