# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=upower
pkgver=0.99.6
pkgrel=0
pkgdesc="Power Management Services"
url="http://upower.freedesktop.org"
arch="all"
license="GPL-2.0-or-later"
depends=""
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
makedepends="linux-headers gtk+-dev libgudev-dev libusb-dev polkit-dev dbus-glib-dev libxslt
		gobject-introspection-dev docbook-xsl"
source="http://upower.freedesktop.org/releases/upower-$pkgver.tar.xz
	lib-Fix-memory-leak-in-up_client_get_devices.patch
	linux-Fix-possible-double-free.patch

	daemon-fix-get_critical_action.patch
	lib-add-propererror-and-cancellable-handling-to-UpClient.patch
	"

_builddir="$srcdir"/$pkgname-$pkgver
prepare() {
	cd "$_builddir"
}

build() {
	cd "$srcdir/$pkgname-$pkgver"
	DATADIRNAME=share ./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--libexecdir=/usr/lib/upower \
		--disable-static \
		|| return 1
	make || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install || return 1
}

sha512sums="7e7256491ecb5d3f04abf41f05a761b79761c8868a1aedadfc5085c3b9cf15f6099c1494596e6a24b0951511bc7cac074e93ebb2b84abb9fb7a4374483052d3f  upower-0.99.6.tar.xz
d18e4c6119e32297f612fa110e01de342381f38c8be42d4fd5322eb17a2cb172c1cb8bf09e0a25e0ef6b76edb82b6748c9c8fd02f44341f51ecd09141ea432fd  lib-Fix-memory-leak-in-up_client_get_devices.patch
13656064551a9b9e40fe3560098319182e980d2ab48134959f9f642a6c42cb0283b3bd00052ef26834ffea5c3a2108b66fd127e165b2167a43064ccd4ba526b0  linux-Fix-possible-double-free.patch
9f2718c7fb7ea77d07fe463d3eecae14e40cc2da71c500e2d747c52bbe2f645632cd7ee8289a7f1b8b252b3eb9d5d568ddcd74e00e5fd9985861514895847006  daemon-fix-get_critical_action.patch
678298e420ce0eb8f9ca65ca0806b856b4d7f3634a70a029dcb9a391a457dcb91b2a5c8bbe7f3054e45a36f33458daedb10e6be11e970bd818ecf42e3587a76e  lib-add-propererror-and-cancellable-handling-to-UpClient.patch"
