sys-apps/dbus-broker: new package
[gentoo.git] / sys-power / cpupower / cpupower-3.18.ebuild
1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5 inherit multilib toolchain-funcs
6
7 DESCRIPTION="Shows and sets processor power related values"
8 HOMEPAGE="https://www.kernel.org/"
9 SRC_URI="mirror://kernel/linux/kernel/v3.x/linux-${PV}.tar.xz"
10
11 LICENSE="GPL-2"
12 SLOT="0"
13 KEYWORDS="amd64 ~arm x86"
14 IUSE="cpufreq_bench debug nls"
15
16 # File collision w/ headers of the deprecated cpufrequtils
17 RDEPEND="sys-apps/pciutils
18         !<sys-apps/linux-misc-apps-3.6-r2
19         !sys-power/cpufrequtils"
20 DEPEND="${RDEPEND}
21         virtual/os-headers
22         virtual/pkgconfig
23         nls? ( sys-devel/gettext )"
24
25 S=${WORKDIR}/linux-${PV}/tools/power/${PN}
26
27 pkg_setup() {
28         myemakeargs=(
29                 DEBUG=$(usex debug true false)
30                 V=1
31                 CPUFREQ_BENCH=$(usex cpufreq_bench true false)
32                 NLS=$(usex nls true false)
33                 docdir=/usr/share/doc/${PF}/${PN}
34                 mandir=/usr/share/man
35                 libdir=/usr/$(get_libdir)
36                 AR="$(tc-getAR)"
37                 CC="$(tc-getCC)"
38                 LD="$(tc-getCC)"
39                 STRIP=true
40                 LDFLAGS="${LDFLAGS}"
41                 OPTIMIZATION="${CFLAGS}"
42                 )
43 }
44
45 src_unpack() {
46         tar -xf "${DISTDIR}"/linux-${PV}.tar.xz \
47                 linux-${PV}/tools/power/${PN} \
48                 linux-${PV}/Makefile \
49                 || die
50 }
51
52 src_prepare() {
53         # -Wl,--as-needed compat
54         local libs="-lcpupower -lrt $($(tc-getPKG_CONFIG) --libs-only-l libpci)"
55         sed -i \
56                 -e "/$libs/{ s,${libs},,g; s,\$, ${libs},g;}" \
57                 -e "s:-O1 -g::" \
58                 Makefile || die
59 }
60
61 src_compile() {
62         emake "${myemakeargs[@]}"
63 }
64
65 src_install() {
66         emake DESTDIR="${D}" "${myemakeargs[@]}" install
67         dodoc README ToDo
68
69         newconfd "${FILESDIR}"/conf.d-r2 ${PN}
70         newinitd "${FILESDIR}"/init.d-r4 ${PN}
71 }