]> Pileus Git - ~andy/sunrise/blob - app-laptop/linux-phc/linux-phc-0.2.8.ebuild
Whitespace cleanup
[~andy/sunrise] / app-laptop / linux-phc / linux-phc-0.2.8.ebuild
1 # Copyright 1999-2006 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 WANT_AUTOCONF=2.5
6 WANT_AUTOMAKE=1.9
7 inherit linux-info eutils autotools
8
9 DESCRIPTION="linux-phc is a kernel patch to change the voltage/frequency pairs of processors from userspace."
10 HOMEPAGE="https://www.dedigentoo.org/trac/linux-phc/"
11 SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
12
13 LICENSE="GPL-2"
14 SLOT="0"
15 KEYWORDS="~x86"
16 IUSE=""
17
18 which_patch() {
19         if kernel_is ge 2 6 19
20         then
21                 PATCH="kernel-patch/${P}-kernel-vanilla-2.6.19.patch"
22         elif kernel_is ge 2 6 18
23         then
24                 PATCH="kernel-patch/${P}-kernel-vanilla-2.6.18.patch"
25         elif kernel_is ge 2 6 17
26         then
27                 PATCH="kernel-patch/${P}-kernel-vanilla-2.6.17.patch"
28         elif kernel_is ge 2 6 16
29         then
30                 PATCH="kernel-patch/${P}-kernel-vanilla-2.6.16.patch"
31         elif kernel_is ge 2 6 15
32         then
33                 PATCH="kernel-patch/${P}-kernel-vanilla-2.6.15.patch"
34         else
35                 die "No ${PN} patch for kernel version ${KV_FULL} - sorry not supported"
36         fi
37 }
38
39 collision_check() {
40         if has collision_protect ${FEATURES}; then
41                 ewarn "Collisions are expected as this patches kernel code. Disable"
42                 ewarn "FEATURES=collision-protect before use"
43                 die 'incompatible FEATURES=collision-protect'
44         fi
45 }
46
47 pkg_setup() {
48         linux-info_pkg_setup
49         collision_check
50 }
51
52 src_unpack() {
53         which_patch
54
55         if egrep -q 'linux-phc' \
56                 ${KV_DIR}/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
57         then
58                 ewarn "already installed ${PN} for kernel ${KV_FULL}"
59                 ewarn "If this is an upgrade attempt, reemerge your kernel sources"
60                 ewarn "and try emerging this package again."
61                 die
62         fi
63
64         unpack ${A}
65         cd "${S}"
66
67         local mydir="arch/i386/kernel/cpu/cpufreq"
68         mkdir -p "${S}/${mydir}"
69
70         cp -P "${KV_DIR}/${mydir}/Kconfig" "${S}/${mydir}/"
71         cp -P "${KV_DIR}/${mydir}/speedstep-centrino.c" "${S}/${mydir}/"
72
73         epatch "${S}/${PATCH}" || die "epatch failed"
74 }
75
76 src_compile() {
77         einfo 'Compiling measurefreq'
78         cd "${S}/utils/measurefreq"
79         eautoconf
80         eautomake
81         econf || die 'econf failed'
82         emake || die 'emake failed'
83 }
84
85 src_install() {
86         insinto "$(/bin/readlink -f ${KV_DIR})"
87         doins -r arch/*
88         dodoc README
89         doinitd gentoo/etc/init.d/undervolt
90         doconfd gentoo/etc/conf.d/undervolt
91         cd "${S}/utils/measurefreq"
92         emake DESTDIR="${D}" install || die "emake failed"
93 }
94
95 pkg_preinst() {
96         collision_check
97 }
98
99 pkg_postinst() {
100         elog  "Please read https://www.dedigentoo.org/trac/linux-phc/#Documentation before using linux-phc"
101         elog  "You can use the utility measurefreq to find appropriate voltage values."
102         ewarn "Edit /etc/conf.d/undervolt before using the initscript"
103 }
104
105 pkg_postrm() {
106         ewarn "Unmerging this ebuild won't revert the patches in your kernel"
107         ewarn "Reemerge your kernel if you want that."
108 }