summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-01-15 07:41:51 +0000
committerMike Frysinger <vapier@gentoo.org>2010-01-15 07:41:51 +0000
commit56eddb5b744ae5fcbf373ba96338073372d3ef0e (patch)
tree3a40a78815976740acf5eccf90abb5980b2eb1f3 /sys-power/cpufrequtils
parentKeyworded ~sparc. (diff)
downloadgentoo-2-56eddb5b744ae5fcbf373ba96338073372d3ef0e.tar.gz
gentoo-2-56eddb5b744ae5fcbf373ba96338073372d3ef0e.tar.bz2
gentoo-2-56eddb5b744ae5fcbf373ba96338073372d3ef0e.zip
Version bump #292246 by gionnico with updated NLS patch by Lars Wendler and a more flexible init.d script #179729 by Oliver Koch.
(Portage version: 2.2_rc61/cvs/Linux x86_64)
Diffstat (limited to 'sys-power/cpufrequtils')
-rw-r--r--sys-power/cpufrequtils/ChangeLog11
-rw-r--r--sys-power/cpufrequtils/cpufrequtils-006.ebuild49
-rw-r--r--sys-power/cpufrequtils/files/cpufrequtils-006-modprobe-gov.patch50
-rw-r--r--sys-power/cpufrequtils/files/cpufrequtils-006-nls.patch76
-rw-r--r--sys-power/cpufrequtils/files/cpufrequtils-conf.d-00611
-rwxr-xr-xsys-power/cpufrequtils/files/cpufrequtils-init.d-00641
6 files changed, 237 insertions, 1 deletions
diff --git a/sys-power/cpufrequtils/ChangeLog b/sys-power/cpufrequtils/ChangeLog
index 410a0b8b9b82..fd1b1023a2c7 100644
--- a/sys-power/cpufrequtils/ChangeLog
+++ b/sys-power/cpufrequtils/ChangeLog
@@ -1,6 +1,15 @@
# ChangeLog for sys-power/cpufrequtils
# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-power/cpufrequtils/ChangeLog,v 1.46 2010/01/15 06:04:47 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-power/cpufrequtils/ChangeLog,v 1.47 2010/01/15 07:41:50 vapier Exp $
+
+*cpufrequtils-006 (15 Jan 2010)
+
+ 15 Jan 2010; Mike Frysinger <vapier@gentoo.org>
+ +files/cpufrequtils-conf.d-006, +files/cpufrequtils-init.d-006,
+ +cpufrequtils-006.ebuild, +files/cpufrequtils-006-modprobe-gov.patch,
+ +files/cpufrequtils-006-nls.patch:
+ Version bump #292246 by gionnico with updated NLS patch by Lars Wendler
+ and a more flexible init.d script #179729 by Oliver Koch.
15 Jan 2010; Mike Frysinger <vapier@gentoo.org>
cpufrequtils-005-r1.ebuild:
diff --git a/sys-power/cpufrequtils/cpufrequtils-006.ebuild b/sys-power/cpufrequtils/cpufrequtils-006.ebuild
new file mode 100644
index 000000000000..73ee25521872
--- /dev/null
+++ b/sys-power/cpufrequtils/cpufrequtils-006.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-power/cpufrequtils/cpufrequtils-006.ebuild,v 1.1 2010/01/15 07:41:50 vapier Exp $
+
+inherit eutils toolchain-funcs multilib
+
+DESCRIPTION="Userspace utilities for the Linux kernel cpufreq subsystem"
+HOMEPAGE="http://www.kernel.org/pub/linux/utils/kernel/cpufreq/cpufrequtils.html"
+SRC_URI="mirror://kernel/linux/utils/kernel/cpufreq/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ia64 ~ppc ~ppc64 ~sparc ~x86"
+IUSE="debug nls"
+
+DEPEND="sys-fs/sysfsutils"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}"/${PN}-005-build.patch
+ epatch "${FILESDIR}"/${PN}-006-nls.patch #205576 #292246
+ epatch "${FILESDIR}"/${PN}-006-modprobe-gov.patch #204069
+}
+
+ft() { use $1 && echo true || echo false ; }
+
+src_compile() {
+ emake \
+ OPTIMIZATION= V=true \
+ DEBUG=$(ft debug) \
+ NLS=$(ft nls) \
+ CC=$(tc-getCC) LD=$(tc-getCC) AR=$(tc-getAR) STRIP=: RANLIB=$(tc-getRANLIB) \
+ || die "emake failed"
+}
+
+src_install() {
+ emake \
+ DESTDIR="${D}" \
+ NLS=$(ft nls) \
+ mandir=/usr/share/man \
+ libdir=/usr/$(get_libdir) \
+ install || die "make install failed"
+
+ newinitd "${FILESDIR}"/${PN}-init.d-006 ${PN}
+ newconfd "${FILESDIR}"/${PN}-conf.d-006 ${PN}
+
+ dodoc AUTHORS README
+}
diff --git a/sys-power/cpufrequtils/files/cpufrequtils-006-modprobe-gov.patch b/sys-power/cpufrequtils/files/cpufrequtils-006-modprobe-gov.patch
new file mode 100644
index 000000000000..4011f77bf236
--- /dev/null
+++ b/sys-power/cpufrequtils/files/cpufrequtils-006-modprobe-gov.patch
@@ -0,0 +1,50 @@
+if a gov isnt loaded, try to modprobe it first
+
+http://bugs.gentoo.org/204069
+
+--- a/lib/sysfs.c
++++ b/lib/sysfs.c
+@@ -12,6 +12,7 @@
+ #include <limits.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
++#include <sys/wait.h>
+ #include <fcntl.h>
+ #include <unistd.h>
+
+@@ -539,8 +540,23 @@ static int verify_gov(char *new_gov, char *passed_gov)
+ return 0;
+ }
+
++static int modprobe(const char *module)
++{
++ char new_module[strlen(module) + 10];
++ int status;
++ pid_t child;
++
++ sprintf(new_module, "cpufreq_%s", module);
++ child = vfork();
++ if (child == 0)
++ _exit(execlp("modprobe", "modprobe", "-q", new_module, NULL));
++ waitpid(child, &status, 0);
++ return (WIFEXITED(status) && WEXITSTATUS(status) == 0 ? 0 : 1);
++}
++
+ int sysfs_modify_policy_governor(unsigned int cpu, char *governor)
+ {
++ int ret;
+ char new_gov[SYSFS_PATH_MAX];
+
+ if (!governor)
+@@ -549,7 +565,10 @@ int sysfs_modify_policy_governor(unsigned int cpu, char *governor)
+ if (verify_gov(new_gov, governor))
+ return -EINVAL;
+
+- return sysfs_write_one_value(cpu, WRITE_SCALING_GOVERNOR, new_gov, strlen(new_gov));
++ ret = sysfs_write_one_value(cpu, WRITE_SCALING_GOVERNOR, new_gov, strlen(new_gov));
++ if (ret == -ENODEV && modprobe(new_gov) == 0)
++ return sysfs_write_one_value(cpu, WRITE_SCALING_GOVERNOR, new_gov, strlen(new_gov));
++ return ret;
+ };
+
+ int sysfs_modify_policy_max(unsigned int cpu, unsigned long max_freq)
diff --git a/sys-power/cpufrequtils/files/cpufrequtils-006-nls.patch b/sys-power/cpufrequtils/files/cpufrequtils-006-nls.patch
new file mode 100644
index 000000000000..fa0b6015c4a4
--- /dev/null
+++ b/sys-power/cpufrequtils/files/cpufrequtils-006-nls.patch
@@ -0,0 +1,76 @@
+make nls/gettext support optional
+
+patch by
+Jos van der Ende <seraph@xs4all.nl>
+Lars Wendler <polynomial-c@gentoo.org>
+
+http://bugs.gentoo.org/205576
+http://bugs.gentoo.org/292246
+
+--- cpufrequtils-006/Makefile
++++ cpufrequtils-006/Makefile
+@@ -147,6 +147,7 @@
+ ifeq ($(strip $(NLS)),true)
+ INSTALL_NLS += install-gmo
+ COMPILE_NLS += update-gmo
++ CFLAGDEF += -DNLS
+ endif
+
+ ifeq ($(strip $(CPUFRQ_BENCH)),true)
+--- cpufrequtils-006/utils/info.c
++++ cpufrequtils-006/utils/info.c
+@@ -10,7 +10,6 @@
+ #include <errno.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <libintl.h>
+ #include <locale.h>
+
+ #include <getopt.h>
+@@ -18,9 +17,18 @@
+ #include "cpufreq.h"
+
+
++#ifdef NLS
++#include <libintl.h>
+ #define _(String) gettext (String)
+ #define gettext_noop(String) String
+ #define N_(String) gettext_noop (String)
++#else
++#define gettext_noop(String) String
++#define _(String) gettext_noop (String)
++#define gettext(String) gettext_noop (String)
++#define N_(String) gettext_noop (String)
++#define textdomain(String)
++#endif
+
+ #define LINE_LEN 10
+
+--- cpufrequtils-006/utils/set.c
++++ cpufrequtils-006/utils/set.c
+@@ -12,16 +12,24 @@
+ #include <limits.h>
+ #include <string.h>
+ #include <ctype.h>
+-#include <libintl.h>
+ #include <locale.h>
+
+ #include <getopt.h>
+
+ #include "cpufreq.h"
+
++#ifdef NLS
++#include <libintl.h>
+ #define _(String) gettext(String)
+ #define gettext_noop(String) String
+ #define N_(String) gettext_noop(String)
++#else
++#define gettext_noop(String) String
++#define _(String) gettext_noop (String)
++#define gettext(String) gettext_noop (String)
++#define N_(String) gettext_noop (String)
++#define textdomain(String)
++#endif
+
+ #define NORM_FREQ_LEN 32
+
diff --git a/sys-power/cpufrequtils/files/cpufrequtils-conf.d-006 b/sys-power/cpufrequtils/files/cpufrequtils-conf.d-006
new file mode 100644
index 000000000000..895966448e44
--- /dev/null
+++ b/sys-power/cpufrequtils/files/cpufrequtils-conf.d-006
@@ -0,0 +1,11 @@
+# /etc/conf.d/cpufrequtils: config file for /etc/init.d/cpufrequtils
+
+# Options when starting cpufreq (given to the `cpufreq-set` program)
+START_OPTS="--governor ondemand"
+
+# Options when stopping cpufreq (given to the `cpufreq-set` program)
+STOP_OPTS="--governor performance"
+
+# Extra settings to write to sysfs cpufreq values.
+#SYSFS_EXTRA="ondemand/ignore_nice_load=1 ondemand/up_threshold=70"
+
diff --git a/sys-power/cpufrequtils/files/cpufrequtils-init.d-006 b/sys-power/cpufrequtils/files/cpufrequtils-init.d-006
new file mode 100755
index 000000000000..201f2341cbf9
--- /dev/null
+++ b/sys-power/cpufrequtils/files/cpufrequtils-init.d-006
@@ -0,0 +1,41 @@
+#!/sbin/runscript
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-power/cpufrequtils/files/cpufrequtils-init.d-006,v 1.1 2010/01/15 07:41:51 vapier Exp $
+
+affect_change() {
+ local c ret=0 opts="$1"
+ shift
+ ebegin "Running cpufreq-set ${opts}"
+ for c in $(cpufreq-info -o | awk '$1 == "CPU" { print $2 }') ; do
+ cpufreq-set -c ${c} ${opts}
+ : $(( ret += $? ))
+ done
+ eend ${ret}
+
+ if [ $# -gt 0 ] ; then
+ c=1
+ einfo "Setting extra options: $*"
+ if cd /sys/devices/system/cpu/cpufreq ; then
+ local o v
+ for o in "$@" ; do
+ v=${o#*=}
+ o=${o%%=*}
+ echo ${v} > ${o} || break
+ done
+ c=0
+ fi
+ eend ${c}
+ : $(( ret += c ))
+ fi
+
+ return ${ret}
+}
+
+start() {
+ affect_change "${START_OPTS}" ${SYSFS_EXTRA}
+}
+
+stop() {
+ affect_change "${STOP_OPTS}"
+}