# $Id: PKGBUILD 210539 2014-04-14 20:07:36Z jgc $
# Maintainer: Jan de Groot <jgc@archlinux.org>

pkgname=upower
pkgver=0.99.0
pkgrel=2
pkgdesc="Abstraction for enumerating power devices, listening to device events and querying history and statistics"
arch=('i686' 'x86_64')
url="http://upower.freedesktop.org"
license=('GPL')
depends=('systemd-tools' 'systemd' 'libusb' 'polkit' 'dbus-glib' 'libimobiledevice')
makedepends=('intltool' 'docbook-xsl' 'gobject-introspection' 'systemd')
backup=('etc/UPower/UPower.conf')
source=($url/releases/$pkgname-$pkgver.tar.xz
        create-dir-runtime.patch
        fix-segfault.patch)
md5sums=('14f43bc13353e23e7280863f33ac50d2'
         '74901767f9c94451083b3d92396454ab'
         'fa2f37eec44703e4c10edb5d9abb0f6b')

prepare() {
  cd $pkgname-$pkgver
  patch -Np1 -i ../create-dir-runtime.patch
  patch -Np1 -i ../fix-segfault.patch
}

build() {
  cd "$pkgname-$pkgver"

  ./configure --prefix=/usr --sysconfdir=/etc \
    --localstatedir=/var \
    --libexecdir=/usr/lib/$pkgname \
    --disable-static
  make
}

package() {
  cd "$pkgname-$pkgver"
  make DESTDIR="$pkgdir" install
}
