This patch adds the new powertop package with pci support. With the old
one I got a 404 while receiving sources. The newer implementation uses
autotools than plain Makefiles. The libpci patch adds a option for
--enable-pci and --disable-pci for the configure argument, which enable
or disable pci support explicit.

Also add a missing LICENSE env in the rule and dependency on !BUSYBOX_POWERTOP
which was reported by Sophie CARAYOL <[email protected]>.

Signed-off-by: Alexander Aring <[email protected]>
---
 patches/powertop-1.11/add-ldflags.diff             | 31 ----------
 patches/powertop-1.11/remove-bashism.patch         | 37 ------------
 patches/powertop-1.11/series                       |  2 -
 .../0001-powertop-add-enable-pci-argument.patch    | 68 ++++++++++++++++++++++
 patches/powertop-2.5/autogen.sh                    |  1 +
 patches/powertop-2.5/series                        |  1 +
 rules/powertop.in                                  | 26 ++++++++-
 rules/powertop.make                                | 28 ++++-----
 8 files changed, 105 insertions(+), 89 deletions(-)
 delete mode 100644 patches/powertop-1.11/add-ldflags.diff
 delete mode 100644 patches/powertop-1.11/remove-bashism.patch
 delete mode 100644 patches/powertop-1.11/series
 create mode 100644 
patches/powertop-2.5/0001-powertop-add-enable-pci-argument.patch
 create mode 120000 patches/powertop-2.5/autogen.sh
 create mode 100644 patches/powertop-2.5/series

diff --git a/patches/powertop-1.11/add-ldflags.diff 
b/patches/powertop-1.11/add-ldflags.diff
deleted file mode 100644
index 44c92f0..0000000
--- a/patches/powertop-1.11/add-ldflags.diff
+++ /dev/null
@@ -1,31 +0,0 @@
-From: Marc Kleine-Budde <[email protected]>
-Subject: use LDFLAGS during linking
-
-powertop fails to link, if ncursesw isn't in the
-standard library search path.
-
-It fails even if the LDFLAGS have the appropriate -L.
-This patch add LDFLAGS to the linker invocation.
-
-Signed-off-by: Marc Kleine-Budde <[email protected]>
-
-send upstream to [email protected]
-should appear here soon: 
http://www.bughost.org/pipermail/power/2009-April/thread.html
-
----
- Makefile |    2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-Index: powertop-1.11/Makefile
-===================================================================
---- powertop-1.11.orig/Makefile
-+++ powertop-1.11/Makefile
-@@ -20,7 +20,7 @@ OBJS = powertop.o config.o process.o mis
-       
- 
- powertop: $(OBJS) Makefile powertop.h
--      $(CC) ${CFLAGS}  $(OBJS) -lncursesw -o powertop
-+      $(CC) ${CFLAGS} $(LDFLAGS) $(OBJS) -lncursesw -o powertop
-       @(cd po/ && $(MAKE))
- 
- powertop.1.gz: powertop.1
diff --git a/patches/powertop-1.11/remove-bashism.patch 
b/patches/powertop-1.11/remove-bashism.patch
deleted file mode 100644
index ba2bce8..0000000
--- a/patches/powertop-1.11/remove-bashism.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From: 
http://ftp.de.debian.org/debian/pool/main/p/powertop/powertop_1.11-1.diff.gz
-
-Signed-off-by: Marc Kleine-Budde <[email protected]>
-
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## remove-bashism.dpatch by Patrick Winnertz <[email protected]>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: remove some bashisms in the output
-
-@DPATCH@
-diff --git a/cpufreq.c b/cpufreq.c
-index ab84dc4..a291fdf 100644
---- a/cpufreq.c
-+++ b/cpufreq.c
-@@ -39,7 +39,7 @@ static void activate_ondemand(void)
-       FILE *file;
-       char filename[PATH_MAX];
- 
--      system("/sbin/modprobe cpufreq_ondemand &> /dev/null");
-+      system("/sbin/modprobe cpufreq_ondemand > /dev/null 2>&1");
- 
- 
-       dir = opendir("/sys/devices/system/cpu");
-diff --git a/powertop.c b/powertop.c
-index fc605ec..4d18de8 100644
---- a/powertop.c
-+++ b/powertop.c
-@@ -798,7 +798,7 @@ int main(int argc, char **argv)
-       if (!dump)
-               ticktime = 5.0;
-  
--      system("/sbin/modprobe cpufreq_stats &> /dev/null");
-+      system("/sbin/modprobe cpufreq_stats > /dev/null 2>&1");
-       read_data(&start_usage[0], &start_duration[0]);
- 
- 
diff --git a/patches/powertop-1.11/series b/patches/powertop-1.11/series
deleted file mode 100644
index 1bb7176..0000000
--- a/patches/powertop-1.11/series
+++ /dev/null
@@ -1,2 +0,0 @@
-add-ldflags.diff
-remove-bashism.patch
diff --git a/patches/powertop-2.5/0001-powertop-add-enable-pci-argument.patch 
b/patches/powertop-2.5/0001-powertop-add-enable-pci-argument.patch
new file mode 100644
index 0000000..aeb5a7e
--- /dev/null
+++ b/patches/powertop-2.5/0001-powertop-add-enable-pci-argument.patch
@@ -0,0 +1,68 @@
+From f62aebb863312b624aec0ebef304a0bdb362e77b Mon Sep 17 00:00:00 2001
+From: Alexander Aring <[email protected]>
+Date: Thu, 3 Apr 2014 09:30:13 +0200
+Subject: [PATCH] powertop: add --enable-pci argument
+
+Signed-off-by: Alexander Aring <[email protected]>
+---
+ configure.ac | 37 +++++++++++++++++++++++--------------
+ 1 file changed, 23 insertions(+), 14 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index b69d608..27c01af 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -48,10 +48,29 @@ AC_CHECK_FUNCS([fdatasync getpagesize gettimeofday memmove 
memset mkdir munmap p
+ 
+ AC_SEARCH_LIBS([delwin], [ncursesw ncurses], [], AC_MSG_ERROR([ncurses is 
required but was not found]), [])
+ 
+-has_libpci=0
+-PKG_CHECK_MODULES([PCIUTILS], [libpci],[has_libpci=1],[
+-      AC_SEARCH_LIBS([pci_get_dev], [pci],[has_libpci=1], [has_libpci=0] )])
+- 
++AC_ARG_ENABLE([pci],
++            AS_HELP_STRING([--enable-pci], [enable pci support 
@<:@default=disabled@:>@]),
++            [enable_pci=$enableval], [enable_pci=no])
++AS_IF([test "x$enable_pci" = "xno"], [
++      AC_DEFINE(HAVE_NO_PCI, [1], [pci support.])
++])
++
++if (test "$enable_pci" == "yes"); then
++      has_libpci=0
++      PKG_CHECK_MODULES([PCIUTILS], [libpci],[has_libpci=1],[
++      AC_SEARCH_LIBS([pci_get_dev], [pci],[has_libpci=1], [has_libpci=0])])
++
++      if (test "$has_libpci" -eq 0); then
++              AC_DEFINE([HAVE_NO_PCI],[1],[Define if pci is not supported])
++              AC_MSG_ERROR([
++      ************* LIBPCI SUPPORT NOT CONFIGURED**************
++      If you need pci support, please install libpci and
++      re-configure PowerTOP with --enable-pci or disable pci
++      support with --disable-pci.
++      *********************************************************
++              ])
++      fi
++fi
+ 
+ has_libnl_ver=0
+ # libnl-2 provides only libnl-2.0.pc file, so we check for separate 
libnl-genl-3.0.pc
+@@ -67,16 +86,6 @@ if (test "$has_libnl_ver" -gt 1); then
+       AC_DEFINE([HAVE_LIBNL20], [1], [Define if you have libnl-2.0 or higher])
+ fi
+ 
+-if (test "$has_libpci" -eq 0); then 
+-      AC_DEFINE([HAVE_NO_PCI],[1],[Define if pci is not supported])
+-        AC_MSG_WARN([
+-                      ************* LIBPCI SUPPORT NOT 
CONFIGURED**************
+-                      If you need or want pci support, please install libpci 
+-                      and re-configure PowerTOP. 
+-                      
*********************************************************
+-      ])
+-fi
+-
+ AC_SEARCH_LIBS([pthread_create], [pthread], [], AC_MSG_ERROR([libpthread is 
required but was not found]), [])
+ AC_SEARCH_LIBS([inet_aton], [resolv], [], AC_MSG_ERROR([libresolv is required 
but was not found]), [])
+ 
+-- 
+1.9.1
+
diff --git a/patches/powertop-2.5/autogen.sh b/patches/powertop-2.5/autogen.sh
new file mode 120000
index 0000000..9f8a4cb
--- /dev/null
+++ b/patches/powertop-2.5/autogen.sh
@@ -0,0 +1 @@
+../autogen.sh
\ No newline at end of file
diff --git a/patches/powertop-2.5/series b/patches/powertop-2.5/series
new file mode 100644
index 0000000..143dde4
--- /dev/null
+++ b/patches/powertop-2.5/series
@@ -0,0 +1 @@
+0001-powertop-add-enable-pci-argument.patch
diff --git a/rules/powertop.in b/rules/powertop.in
index 56e7521..2b6b3b8 100644
--- a/rules/powertop.in
+++ b/rules/powertop.in
@@ -1,10 +1,15 @@
 ## SECTION=debug_tools
 
-config POWERTOP
+menuconfig POWERTOP
        tristate
-       prompt "powertop"
-       select GCCLIBS_GCC_S
+       prompt "powertop                      "
        select NCURSES
+       select LIBNL3
+       select LIBC_RESOLV
+       select LIBC_PTHREAD
+       select PCIUTILS         if POWERTOP_PCI_SUPPORT
+       select PCIUTILS_LIBPCI  if POWERTOP_PCI_SUPPORT
+       depends on !BUSYBOX_POWERTOP || ALLYES
        help
          PowerTOP is a Linux tool that finds the software
          component(s) that make your laptop use more power than
@@ -19,3 +24,18 @@ config POWERTOP
          various sources of information from the kernel into one
          convenient screen so that you can see how well your system
          is doing, and which components are the biggest problem.
+
+if POWERTOP
+
+config POWERTOP_PCI_SUPPORT
+       bool
+       prompt "pci support"
+       help
+         This adds powertop support for the PCI bus. Should only be
+         enabled if you have PCI support.
+
+endif
+
+comment "BusyBox' powertop is selected!"
+        depends on BUSYBOX_POWERTOP
+
diff --git a/rules/powertop.make b/rules/powertop.make
index a3be360..36bc52a 100644
--- a/rules/powertop.make
+++ b/rules/powertop.make
@@ -1,6 +1,7 @@
 # -*-makefile-*-
 #
 # Copyright (C) 2009 by Marc Kleine-Budde <[email protected]>
+#              2014 by Alexander Aring <[email protected]>
 #
 # See CREDITS for details about who has contributed to this project.
 #
@@ -16,31 +17,26 @@ PACKAGES-$(PTXCONF_POWERTOP) += powertop
 #
 # Paths and names
 #
-POWERTOP_VERSION       := 1.11
-POWERTOP_MD5           := 3498f5983c683c3a57dce7379a722082
+POWERTOP_VERSION       := 2.5
+POWERTOP_MD5           := 806bbcbd44fcea1f807c9582fc1f7d3e
 POWERTOP               := powertop-$(POWERTOP_VERSION)
 POWERTOP_SUFFIX                := tar.gz
-POWERTOP_URL           := 
http://www.lesswatts.org/projects/powertop/download/$(POWERTOP).$(POWERTOP_SUFFIX)
+POWERTOP_URL           := 
https://01.org/sites/default/files/downloads/powertop/$(POWERTOP).$(POWERTOP_SUFFIX)
 POWERTOP_SOURCE                := $(SRCDIR)/$(POWERTOP).$(POWERTOP_SUFFIX)
 POWERTOP_DIR           := $(BUILDDIR)/$(POWERTOP)
+POWERTOP_LICENSE       := GPLv2
 
 # ----------------------------------------------------------------------------
 # Prepare
 # ----------------------------------------------------------------------------
 
-POWERTOP_PATH  := PATH=$(CROSS_PATH)
-
-POWERTOP_COMPILE_ENV   := $(CROSS_ENV)
-POWERTOP_MAKEVARS      := BINDIR=/usr/sbin
-
-$(STATEDIR)/powertop.prepare:
-       @$(call targetinfo)
-ifdef PTXCONF_NCURSES_WIDE_CHAR
-       sed -i -e "s/-lncurses[^ ]*/-lncursesw/g" "$(POWERTOP_DIR)/Makefile"
-else
-       sed -i -e "s/-lncurses[^ ]*/-lncurses/g" "$(POWERTOP_DIR)/Makefile"
-endif
-       @$(call touch)
+#
+# autoconf
+#
+POWERTOP_CONF_TOOL     := autoconf
+POWERTOP_CONF_OPT      := \
+       $(CROSS_AUTOCONF_USR) \
+       --$(call ptx/endis, PTXCONF_POWERTOP_PCI_SUPPORT)-pci
 
 # ----------------------------------------------------------------------------
 # Target-Install
-- 
1.9.1


-- 
ptxdist mailing list
[email protected]

Reply via email to