# Maintainer: Developer <dev@opalos.org>
# Maintainer: Developer <dev@opalos.org>

pkgname=upower
pkgver=%version%
pkgrel=%release%
pkgdesc="Abstraction for enumerating power devices, listening to device events and querying history and statistics"
url="https://upower.freedesktop.org"
arch=(x86_64)
license=(GPL)
depends=(
  libgudev
  libimobiledevice
  systemd
  usbmuxd
)
makedepends=(
  docbook-xsl
  git
  gobject-introspection
  gtk-doc
  meson
  python
)
checkdepends=(
  python-dbus
  python-dbusmock
  python-gobject
  python-packaging
  umockdev
)
backup=(etc/UPower/UPower.conf)
_commit=8dcf54440d7eb58b75d7982bc1c29ee35dccf0c2  # tags/v1.90.2^0
source=("git+https://gitlab.freedesktop.org/upower/upower.git#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd upower
  git describe --tags | sed -e 's/^v\|^UPOWER_//;s/_/\./g;s/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd upower
}

build() {
  arch-meson upower build
  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"

  # Remove installed-tests
  rm -rv "$pkgdir"/usr/{lib/upower,share/installed-tests}
}

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