# Contributor: mellotron <mellotron@tutanota.com>
# Maintainer:
pkgname=thermald
_pkgname=thermal_daemon
pkgver=1.6
pkgrel=0
pkgdesc="Thermal daemon for IA"
url="https://github.com/01org/thermal_daemon"
arch="all !armhf !aarch64 !s390x"
license="GPL-2.0"
depends=""
makedepends="autoconf automake libtool dbus-glib-dev libxml2-dev linux-headers"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/01org/$_pkgname/archive/v$pkgver.tar.gz
	thermald.initd
	ppc64le.patch"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	cd "$builddir"

	./autogen.sh
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		|| return 1
	make || return 1
}

package() {
	cd "$builddir"

	make DESTDIR="$pkgdir" install || return 1
	rm -rf "$pkgdir"/etc/init/ "$pkgdir"/etc/dbus-1

	install -m755 -D "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname || return 1
}

sha512sums="ddcd01dcd2f6b5666ffa16ba635734e4c146244b5df7c3f0deb8120f8ee7ebf1f4ee302d49db2b7e9a4950045650922977bd40bf6b38ccea9896f81e06df1d49  thermald-1.6.tar.gz
c4872ff38e8001b753b12759bcd11364581b12ff710fa1eac21d769fd62cb4ba1a01bd0ba4adec7a72b71be094a425b803239a56296e8c111426e08eb9917c70  thermald.initd
517d2c26dc5464c59e9c0cbea2bb1bcbe78cad87a26965cec8ec6d48a4b1bbb25c73bc5e772bbf0754e56222c8497d534b974b3a94c104bc4213be740aea9a5d  ppc64le.patch"
