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

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - patch to enable linking with libm to fix FTBFS

pkgname=gnome-power-manager
pkgver=43.0
pkgrel=1
pkgdesc="System power information and statistics"
url="https://gitlab.gnome.org/GNOME/gnome-power-manager"
arch=(x86_64)
license=(GPL)
depends=(gtk3 upower dconf)
makedepends=(git meson)
options=(debug)
_commit=98f8ac8275d413f141a3f422e731e3213fc1db03  # tags/GNOME_POWER_MANAGER_43_0^0
source=("git+https://gitlab.gnome.org/GNOME/gnome-power-manager.git#commit=$_commit"
        '0001-set-libm-as-required.patch')
sha256sums=('SKIP'
            '3a70f134c17d649e1c3aeafe84b5e453c7c2a9da828c5dd7992050852c96b465')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/^GNOME_POWER_MANAGER_//;s/_/./g;s/-/+/g'
}

prepare() {
  cd $pkgname
  git apply ../0001-set-libm-as-required.patch
}

build() {
  arch-meson $pkgname build
  ninja -C build
}

check() {
  meson test -C build
}

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