# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=cpufreqd
pkgver=2.4.2
pkgrel=4
pkgdesc="A small daemon to adjust cpu speed (and indeed voltage)"
url="https://sourceforge.net/projects/cpufreqd"
arch="all"
license="GPL-2.0-or-later"
subpackages="$pkgname-doc"
depends=
makedepends="cpufrequtils-dev sysfsutils-dev"
install=
source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.bz2
	cpufreqd.initd"

_builddir="$srcdir/$pkgname-$pkgver"
prepare() {
	cd "$_builddir"
	update_config_sub || return 1
}

build () {
	cd "$_builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		|| return 1
	make LIBS=-lpthread || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install || return 1
	install -Dm 755 ../cpufreqd.initd "$pkgdir"/etc/init.d/cpufreqd \
		|| return 1
}

md5sums="2ca80a77849c9a69b81e27c1843c97f5  cpufreqd-2.4.2.tar.bz2
3ae9eb20e7e07712d26d9e7281e8c45f  cpufreqd.initd"
sha256sums="3b7810a3d244d9b10c8c151fd6037e7d14c9889cdf5cdff1867bd978b9f7482a  cpufreqd-2.4.2.tar.bz2
ee5e1bca3eb1b7670fb5dabbb36c00e04413d71fe183a864df891074b55092af  cpufreqd.initd"
sha512sums="42067a28c1901cb2c45f21f918169648db77f553db1fbd44e2aae64e7092b530a1e3697a0cc4b4b70e0d474966671e924950501a0feb5d0ada166aa369dbc33b  cpufreqd-2.4.2.tar.bz2
cc5769f2f06ffeefe54ddde4d8829f8c1b9ddb82f32d883bf5df403c6386cac6ae8067cc7fa63c2b685b47bb88e6460b1f08bbf8ddf1c1fa392ecd6a17bea493  cpufreqd.initd"
