summaryrefslogtreecommitdiff
blob: 74c44d3fe535b18d4357ef6f30a4c06e3798eecf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit linux-info systemd toolchain-funcs

DESCRIPTION="Intel CPU undervolting and throttling configuration tool"
HOMEPAGE="https://github.com/kitsunyan/intel-undervolt"

if [ ${PV} == "9999" ] ; then
	inherit git-r3
	EGIT_REPO_URI="https://github.com/kitsunyan/${PN}.git"
else
	SRC_URI="https://github.com/kitsunyan/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
	KEYWORDS="-* ~amd64"
fi

LICENSE="GPL-3"
SLOT="0"
IUSE=""

DEPEND=""
RDEPEND=""
BDEPEND=""

CONFIG_CHECK="~INTEL_RAPL ~X86_MSR"

src_prepare() {
	# respect CC, CFLAGS and avoid calling pkg-config
	sed -i \
		-e 's/^CC=/CC?=/' \
		-e 's/^CFLAGS=/CFLAGS?=/' \
		-e '/^UNITDIR=/d' \
		Makefile || die

	default
}

src_compile() {

	tc-export CC

	myemakeargs=(
		BINDIR="${EPREFIX}"/usr/bin
		SYSCONFDIR="${EPREFIX}"/etc
		UNITDIR="$(systemd_get_systemunitdir)"
	)
	emake "${myemakeargs[@]}"
}

src_install() {
	myemakeargs+=(
		DESTDIR="${D}"
	)
	emake "${myemakeargs[@]}" install

	newinitd "${FILESDIR}"/initd "${PN}"
	newconfd "${FILESDIR}"/confd "${PN}"

	einstalldocs
}