# Packager = Tuxcore <dev@tuxcore.org> 
pkgname=polkit
pkgver=124
pkgrel=2
pkgdesc="Application development toolkit for controlling system-wide privileges"
url="https://gitlab.freedesktop.org/polkit/polkit"
arch=(x86_64)
license=(LGPL-2.0-or-later)
depends=(
  duktape
  expat
  glib2
  pam
  systemd
)
makedepends=(
  git
  gobject-introspection
  gtk-doc
  meson
)
checkdepends=(python-dbusmock)
provides=(libpolkit-{agent,gobject}-1.so)
backup=(etc/pam.d/polkit-1)
install=polkit.install
_commit=82f0924dc0eb23b9df68e88dbaf9e07c81940a5a  # tags/124
source=(
  "git+https://gitlab.freedesktop.org/polkit/polkit.git#commit=$_commit"
  0001-meson-Pass-polkitd_uid-to-meson_post_install.py.patch
)
b2sums=('SKIP'
        '51200f8600e48fdec61403c2d16d499478dabcb8826d11bd388ab0f32a05531130b45566d4716769043695863dbd9a8e9b9f6b5222316d60bc2e1749ec93b20b')

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

prepare() {
  cd polkit
  git apply -3 ../0001-meson-Pass-polkitd_uid-to-meson_post_install.py.patch
}

build() {
  local meson_options=(
    -D examples=true
    -D gtk_doc=true
    -D man=true
    -D os_type=redhat
    -D polkitd_uid=102
    -D polkitd_user=polkitd
    -D session_tracking=libsystemd-login
    -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:
