# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=cpufrequtils
pkgver=008
pkgrel=7
pkgdesc="Userspace tools for the kernel cpufreq subsystem"
url="https://www.kernel.org/pub/linux/utils/kernel/cpufreq/"
arch="all"
license="GPL-2.0-only"
subpackages="
	$pkgname-dev
	$pkgname-doc
	$pkgname-openrc
	"
depends="sysfsutils"
makedepends="sysfsutils-dev libtool"
source="https://sources.archlinux.org/other/cpufrequtils/cpufrequtils-$pkgver.tar.bz2
	0001-Only-x86-has-cpuid-instruction.patch
	0002-cpufrequtils-Remove-proc-compile-option-and-interfac.patch
	0003-cpufrequtils-aperf-Fix-MSR-read-on-32-bit.patch
	0005-cpufrequtils-sysfs-increase-MAX_LINE_LEN.patch
	0006-aperf-fix-compilation-on-x86-32-with-fPIC.patch
	0007-po-add-missing-word-in-DE.patch
	0008-cpufrequtils-make-NLS-optional.patch
	$pkgname.initd
	$pkgname.confd
	"
options="!check"

build() {
	# distcc and ccache makes libtool confused about the tag.
	# we save 4k by disabling the 2.4 kernel support (PROC=false)
	make -j1 LIBTOOL_OPT="--tag=CC --silent" \
		NLS=false \
		PROC=false
}

package() {
	make mandir=/usr/share/man \
		NLS=false \
		INSTALL=install \
		DESTDIR="$pkgdir" \
		install
	install -D -m755 ../$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -D -m644 ../$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
}

sha512sums="
d25dcc4fbf15bdca65a3fab6ee33d6cf4b7ab7ed291aea42ed7970b707535ddfcd27fd0189aa48affc2792abf72539f1388cc544019e6fc06353a2f9c5a49d17  cpufrequtils-008.tar.bz2
4d841bdf2b829518932505747e68d661219337259c1321cdd6671faf2eb72ff6d7f437e42b98f093f9d6564d2bb7be1d4ab645f08b0fbd58ce43339a12be37da  0001-Only-x86-has-cpuid-instruction.patch
6d8c6beb98d680d4d47c5cc0a067545b1683f259b7d2474a61876b5e97987be30b8d212017122157236ae91bd415793e5f5a0d22214bfc3f2ec72cf626d28832  0002-cpufrequtils-Remove-proc-compile-option-and-interfac.patch
41082f5ed4cc2962927b12b8dcf4b0dadf6fb227b66b8f383931c7ae0416fa5f73e765664376b50e07948e48060770a7d32bc7422b144c0cb82166515e197f9b  0003-cpufrequtils-aperf-Fix-MSR-read-on-32-bit.patch
00fb946b1f0b42038297b9cf63740a4123a4aafa5292400225803ef8cd6f1e89b387509c2f74fa6223b3b2b3032b6e0edcbfc3b6bf15aab73bb480c0208330b9  0005-cpufrequtils-sysfs-increase-MAX_LINE_LEN.patch
7e924424fe3381fd804edfcb0c0c98e73b67e4da7972c7cfe0bc9cfb5febd2ec660f4e84b6bebe2b0b6d2dc5e60279ebe85d1892905b1112ee43d60b46bcdef5  0006-aperf-fix-compilation-on-x86-32-with-fPIC.patch
69343ab9c9b795523bcd09359f4acdb279510a95c6aa13f70be1d0e2e89ed59952a34f979969f6a3ac3498ad7196ee1c810677fe2d04c5f02207682b820b97bb  0007-po-add-missing-word-in-DE.patch
5d5eab9815d77b8ae9c6c9d122f52da7501068b9a6fe7766e74a8f59d1296c0bcb6e5a61a643e371e2e1433912d48205c8f522207144bb02a3c9961043eb968b  0008-cpufrequtils-make-NLS-optional.patch
c9b867a2b49b2ab3c2b7540de7e48443b155a6eb329ec7bd9cfa077993fad66d9168d9009e869191a73e6a4c15448b39294e1eb4cedb364173955209b0b708f9  cpufrequtils.initd
81adc035c781c2c6f94fdb9a69dfb5d867830ab0685f2badce055b9f8095881456522fc0cd5386140d920fd1d9b96c82d8dcecd9962e3e6ef5f9be926153802b  cpufrequtils.confd
"
