powertop-2.0

svn path=/nixpkgs/trunk/; revision=34451
This commit is contained in:
Florian Friesdorf 2012-06-11 10:28:21 +00:00
parent 22da1866a7
commit a44af6bbc1
4 changed files with 8 additions and 82 deletions

View File

@ -1,17 +1,14 @@
{stdenv, fetchurl, ncurses, gettext}: { stdenv, fetchurl, gettext, libnl1, ncurses, pciutils, pkgconfig, zlib }:
stdenv.mkDerivation { stdenv.mkDerivation rec {
name = "powertop-1.13"; name = "powertop-2.0";
src = fetchurl { src = fetchurl {
url = http://www.lesswatts.org/projects/powertop/download/powertop-1.13.tar.gz; url = "https://01.org/powertop/sites/default/files/downloads/${name}.tar.bz2";
sha256 = "164dqp6msdaxpi2bmvwawasyrf1sfvanlc9ddp97v1wnjh46dj1b"; sha256 = "7af51d320856b3446bcc314c9414385f3b05b9360f650883b0210cd3b12c5c1c";
}; };
patches = [
./powertop-1.13.patch buildInputs = [ gettext libnl1 ncurses pciutils pkgconfig zlib ];
./inotify_user.patch
./modprobe_configs.patch
];
buildInputs = [ncurses gettext];
meta = { meta = {
description = "Analyze power consumption on Intel-based laptops"; description = "Analyze power consumption on Intel-based laptops";
license = "GPLv2"; license = "GPLv2";

View File

@ -1,28 +0,0 @@
From 89e46f3270e3b6d704959c4d0f44ae6bab8f7616 Mon Sep 17 00:00:00 2001
From: Florian Friesdorf <flo@chaoflow.net>
Date: Thu, 13 Oct 2011 10:14:34 +0200
Subject: [PATCH] CONFIG_INOTIFY_USER instead of CONFIG_INOTIFY
since 2.6.36 the former fully replaced the latter
---
powertop.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/powertop.c b/powertop.c
index 74eb328..8df3652 100644
--- a/powertop.c
+++ b/powertop.c
@@ -1191,8 +1191,8 @@ int main(int argc, char **argv)
suggest_kernel_config("CONFIG_CPU_FREQ_STAT", 1,
_("Suggestion: Enable the CONFIG_CPU_FREQ_STAT kernel configuration option.\n"
"This option allows PowerTOP to show P-state percentages \n" "P-states correspond to CPU frequencies."), 2);
- suggest_kernel_config("CONFIG_INOTIFY", 1,
- _("Suggestion: Enable the CONFIG_INOTIFY kernel configuration option.\n"
+ suggest_kernel_config("CONFIG_INOTIFY_USER", 1,
+ _("Suggestion: Enable the CONFIG_INOTIFY_USER kernel configuration option.\n"
"This option allows programs to wait for changes in files and directories\n"
"instead of having to poll for these changes"), 5);
--
1.7.6

View File

@ -1,28 +0,0 @@
From 0002a70b83221a8a831d776836d13105ac886323 Mon Sep 17 00:00:00 2001
From: Florian Friesdorf <flo@chaoflow.net>
Date: Thu, 13 Oct 2011 14:57:02 +0200
Subject: [PATCH] powertop tries to load configs, if /proc/config.gz is
missing
---
config.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/config.c b/config.c
index b2567f2..62ac978 100644
--- a/config.c
+++ b/config.c
@@ -44,6 +44,10 @@ static void read_kernel_config(void)
char filename[100];
if (configcount)
return;
+ if (access("/proc/config.gz", R_OK) != 0) {
+ file = popen("modprobe configs >/dev/null 2>&1", "r");
+ pclose(file);
+ }
if (access("/proc/config.gz", R_OK) == 0) {
file = popen("zcat /proc/config.gz 2> /dev/null", "r");
while (file && !feof(file)) {
--
1.7.6

View File

@ -1,15 +0,0 @@
diff -ru powertop-1.13/Makefile powertop-1.13.new/Makefile
--- powertop-1.13/Makefile
+++ powertop-1.13.new/Makefile
@@ -1,8 +1,8 @@
VERSION = 1.13
-BINDIR=/usr/bin
-LOCALESDIR=/usr/share/locale
-MANDIR=/usr/share/man/man8
+BINDIR=${out}/bin
+LOCALESDIR=${out}/share/locale
+MANDIR=${out}/share/man/man8
WARNFLAGS=-Wall -Wshadow -W -Wformat -Wimplicit-function-declaration -Wimplicit-int
CFLAGS?=-Os -g ${WARNFLAGS}
CC?=gcc