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

pkgname=upower
pkgver=1.91.1
pkgrel=1
pkgdesc="Abstraction for enumerating power devices, listening to device events and querying history and statistics"
url="https://upower.freedesktop.org"
arch=(x86_64 aarch64)
license=(GPL-2.0-or-later)
depends=(
  gcc-libs
  glib2
  glibc
  libgudev
  libimobiledevice
  libplist
  polkit
)
makedepends=(
  docbook-xsl
  git
  glib2-devel
  gobject-introspection
  gtk-doc
  meson
  python
  systemd
  usbmuxd
)
optdepends=('usbmuxd: Read charge status of iOS devices')
checkdepends=(
  python-dbus
  python-dbusmock
  python-gobject
  python-packaging
  umockdev
)
backup=(etc/UPower/UPower.conf)
source=("git+https://gitlab.freedesktop.org/upower/upower.git#tag=v$pkgver")
b2sums=('6ae4d556f6b4243896ef2df7391009bfa4f6e95ab4088d9db0085e377b2d47e61671c378577a3c9e32b3d7c1342621ee70ae1051321a3bab490ac4f28ba3b5e1')

prepare() {
  cd upower
}

build() {
  local meson_options=(
    -D installed_tests=false
  )

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

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

package() {
  depends+=(libg{lib,object,io}-2.0.so)
  provides+=(libupower-glib.so)

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

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