summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /sys-power
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'sys-power')
-rw-r--r--sys-power/acpi/Manifest1
-rw-r--r--sys-power/acpi/acpi-1.6.ebuild16
-rw-r--r--sys-power/acpi/metadata.xml10
-rw-r--r--sys-power/acpi_call/Manifest1
-rw-r--r--sys-power/acpi_call/acpi_call-1.1.0-r1.ebuild37
-rw-r--r--sys-power/acpi_call/acpi_call-1.1.0.ebuild33
-rw-r--r--sys-power/acpi_call/acpi_call-9999.ebuild33
-rw-r--r--sys-power/acpi_call/files/acpi_call-1.1.0-linux-3.17.patch26
-rw-r--r--sys-power/acpi_call/metadata.xml14
-rw-r--r--sys-power/acpid/Manifest4
-rw-r--r--sys-power/acpid/acpid-2.0.20.ebuild61
-rw-r--r--sys-power/acpid/acpid-2.0.21.ebuild61
-rw-r--r--sys-power/acpid/acpid-2.0.22.ebuild68
-rw-r--r--sys-power/acpid/acpid-2.0.23.ebuild68
-rw-r--r--sys-power/acpid/files/acpid-1.0.4-default19
-rwxr-xr-xsys-power/acpid/files/acpid-1.0.6-default.sh59
-rw-r--r--sys-power/acpid/files/acpid-2.0.16-conf.d6
-rw-r--r--sys-power/acpid/files/acpid-2.0.16-init.d21
-rw-r--r--sys-power/acpid/files/systemd/acpid.service10
-rw-r--r--sys-power/acpid/files/systemd/acpid.socket8
-rw-r--r--sys-power/acpid/metadata.xml11
-rw-r--r--sys-power/acpitool/Manifest1
-rw-r--r--sys-power/acpitool/acpitool-0.5.1-r1.ebuild25
-rw-r--r--sys-power/acpitool/files/acpitool-0.5.1-ac_adapter.patch73
-rw-r--r--sys-power/acpitool/files/acpitool-0.5.1-battery.patch484
-rw-r--r--sys-power/acpitool/files/acpitool-0.5.1-kernel3.patch14
-rw-r--r--sys-power/acpitool/files/acpitool-0.5.1-wakeup.patch70
-rw-r--r--sys-power/acpitool/metadata.xml5
-rw-r--r--sys-power/apcupsd/Manifest3
-rw-r--r--sys-power/apcupsd/apcupsd-3.14.10-r6.ebuild144
-rw-r--r--sys-power/apcupsd/apcupsd-3.14.12-r1.ebuild139
-rw-r--r--sys-power/apcupsd/apcupsd-3.14.12.ebuild142
-rw-r--r--sys-power/apcupsd/apcupsd-3.14.8-r2.ebuild134
-rw-r--r--sys-power/apcupsd/files/apcupsd-3.14.9-aliasing.patch39
-rw-r--r--sys-power/apcupsd/files/apcupsd-snmp-5.7.2.patch104
-rw-r--r--sys-power/apcupsd/files/apcupsd-tmpfiles.conf3
-rw-r--r--sys-power/apcupsd/files/apcupsd-udev.rules10
-rw-r--r--sys-power/apcupsd/files/apcupsd.conf329
-rw-r--r--sys-power/apcupsd/files/apcupsd.init.2a37
-rw-r--r--sys-power/apcupsd/files/apcupsd.init.328
-rwxr-xr-xsys-power/apcupsd/files/apcupsd.init.449
-rw-r--r--sys-power/apcupsd/files/apcupsd.powerfail.init18
-rw-r--r--sys-power/apcupsd/files/apcupsd.service8
-rw-r--r--sys-power/apcupsd/metadata.xml23
-rw-r--r--sys-power/athcool/Manifest1
-rw-r--r--sys-power/athcool/athcool-0.3.12.ebuild44
-rwxr-xr-xsys-power/athcool/files/athcool15
-rw-r--r--sys-power/athcool/files/athcool-0.3.11-build.patch36
-rw-r--r--sys-power/athcool/metadata.xml5
-rw-r--r--sys-power/bbswitch/Manifest2
-rw-r--r--sys-power/bbswitch/bbswitch-0.7.ebuild36
-rw-r--r--sys-power/bbswitch/bbswitch-0.8.ebuild38
-rw-r--r--sys-power/bbswitch/files/bbswitch.modprobe1
-rw-r--r--sys-power/bbswitch/metadata.xml24
-rw-r--r--sys-power/cpudyn/Manifest1
-rw-r--r--sys-power/cpudyn/cpudyn-1.0.1.ebuild41
-rw-r--r--sys-power/cpudyn/files/cpudyn-0.99.0-init_conf_updates.patch29
-rw-r--r--sys-power/cpudyn/files/cpudyn.init102
-rw-r--r--sys-power/cpudyn/metadata.xml5
-rw-r--r--sys-power/cpupower/Manifest4
-rw-r--r--sys-power/cpupower/cpupower-3.13.ebuild65
-rw-r--r--sys-power/cpupower/cpupower-3.14.ebuild65
-rw-r--r--sys-power/cpupower/cpupower-3.15.ebuild72
-rw-r--r--sys-power/cpupower/cpupower-3.18.ebuild72
-rw-r--r--sys-power/cpupower/files/conf.d-r236
-rw-r--r--sys-power/cpupower/files/init.d-r442
-rw-r--r--sys-power/cpupower/metadata.xml12
-rw-r--r--sys-power/cpuspeedy/Manifest1
-rw-r--r--sys-power/cpuspeedy/cpuspeedy-0.4.1.ebuild44
-rw-r--r--sys-power/cpuspeedy/metadata.xml15
-rw-r--r--sys-power/hibernate-script/Manifest2
-rw-r--r--sys-power/hibernate-script/files/hibernate-script-2.0-init.d.patch56
-rw-r--r--sys-power/hibernate-script/hibernate-script-2.0-r6.ebuild75
-rw-r--r--sys-power/hibernate-script/metadata.xml7
-rw-r--r--sys-power/iasl/Manifest8
-rw-r--r--sys-power/iasl/files/iasl-20080701-parallelmake.patch47
-rw-r--r--sys-power/iasl/files/iasl-20120816-locale.patch15
-rw-r--r--sys-power/iasl/files/iasl-20140214-locale.patch14
-rw-r--r--sys-power/iasl/files/iasl-20140214-nostrip.patch11
-rw-r--r--sys-power/iasl/files/iasl-20140828-locale.patch17
-rw-r--r--sys-power/iasl/iasl-20121018.ebuild124
-rw-r--r--sys-power/iasl/iasl-20130117-r1.ebuild129
-rw-r--r--sys-power/iasl/iasl-20140828.ebuild124
-rw-r--r--sys-power/iasl/iasl-20150717.ebuild124
-rw-r--r--sys-power/iasl/metadata.xml11
-rw-r--r--sys-power/metadata.xml43
-rw-r--r--sys-power/ncpufreqd/Manifest1
-rw-r--r--sys-power/ncpufreqd/metadata.xml10
-rw-r--r--sys-power/ncpufreqd/ncpufreqd-2.4.ebuild28
-rw-r--r--sys-power/nut/Manifest2
-rw-r--r--sys-power/nut/files/lighttpd_nut.conf-2.2.023
-rwxr-xr-xsys-power/nut/files/nut-2.2.2-init.d-upsd38
-rwxr-xr-xsys-power/nut/files/nut-2.2.2-init.d-upsdrv44
-rwxr-xr-xsys-power/nut/files/nut-2.2.2-init.d-upsmon30
-rw-r--r--sys-power/nut/files/nut-2.4.1-no-libdummy.patch18
-rw-r--r--sys-power/nut/files/nut-2.4.3-lowspeed-buffer-size.patch21
-rw-r--r--sys-power/nut/files/nut-2.6.2-lowspeed-buffer-size.patch16
-rw-r--r--sys-power/nut/files/nut-2.6.3-CVE-2012-2944.patch21
-rw-r--r--sys-power/nut/files/nut-2.6.5-freeipmi_fru.patch448
-rwxr-xr-xsys-power/nut/files/nut-2.6.5-init.d-upsd38
-rw-r--r--sys-power/nut/files/nut-2.6.5-init.d-upslog31
-rwxr-xr-xsys-power/nut/files/nut-2.6.5-init.d-upsmon30
-rw-r--r--sys-power/nut/files/nut-2.7.1-fix-scanning.patch72
-rw-r--r--sys-power/nut/files/nut-2.7.1-snmpusb-order.patch37
-rw-r--r--sys-power/nut/files/nut-2.7.2/nut-2.7.2-no-libdummy.patch13
-rw-r--r--sys-power/nut/files/nut.powerfail.initd49
-rw-r--r--sys-power/nut/metadata.xml66
-rw-r--r--sys-power/nut/nut-2.6.5-r1.ebuild232
-rw-r--r--sys-power/nut/nut-2.7.2-r2.ebuild275
-rw-r--r--sys-power/nvclock/Manifest1
-rw-r--r--sys-power/nvclock/files/nvclock-0.8_p20110102-buffers.patch202
-rw-r--r--sys-power/nvclock/files/nvclock-0.8_p20110102-desktop.patch18
-rw-r--r--sys-power/nvclock/files/nvclock-0.8_p20110102-r1-make.patch94
-rw-r--r--sys-power/nvclock/files/nvclock-0.8_p20110102-usleep.patch14
-rw-r--r--sys-power/nvclock/files/nvclock_confd9
-rw-r--r--sys-power/nvclock/files/nvclock_initd12
-rw-r--r--sys-power/nvclock/metadata.xml12
-rw-r--r--sys-power/nvclock/nvclock-0.8_p20110102-r2.ebuild66
-rw-r--r--sys-power/nvram-reboot/Manifest1
-rw-r--r--sys-power/nvram-reboot/metadata.xml8
-rw-r--r--sys-power/nvram-reboot/nvram-reboot-2004.10.03.ebuild26
-rw-r--r--sys-power/nvram-wakeup/Manifest2
-rw-r--r--sys-power/nvram-wakeup/files/nvram-wakeup-0.97-nonls.patch18
-rw-r--r--sys-power/nvram-wakeup/metadata.xml8
-rw-r--r--sys-power/nvram-wakeup/nvram-wakeup-1.0.ebuild70
-rw-r--r--sys-power/nvram-wakeup/nvram-wakeup-1.1.ebuild74
-rw-r--r--sys-power/phc-intel/Manifest3
-rw-r--r--sys-power/phc-intel/files/phc-intel-0.3.2-rev12-trailing-space-misc.patch1179
-rw-r--r--sys-power/phc-intel/files/phc-intel-0.3.2-rev14-trailing-space-3.13.patch51
-rw-r--r--sys-power/phc-intel/files/phc-intel-0.3.2-rev14-trailing-space-3.14.patch51
-rw-r--r--sys-power/phc-intel/files/phc-intel-0.3.2-rev15-trailing-space-3.15.patch51
-rw-r--r--sys-power/phc-intel/files/phc-intel-0.3.2-rev15-trailing-space-3.5.patch51
-rw-r--r--sys-power/phc-intel/files/phc-intel-0.3.2-rev16-trailing-space-3.16.patch51
-rw-r--r--sys-power/phc-intel/metadata.xml8
-rw-r--r--sys-power/phc-intel/phc-intel-0.3.2.12.15.1.ebuild70
-rw-r--r--sys-power/phc-intel/phc-intel-0.3.2.12.16.ebuild72
-rw-r--r--sys-power/phc-intel/phc-intel-0.3.2.12.17.ebuild72
-rw-r--r--sys-power/phc-k8/Manifest2
-rw-r--r--sys-power/phc-k8/metadata.xml8
-rw-r--r--sys-power/phc-k8/phc-k8-0.4.3.ebuild43
-rw-r--r--sys-power/phc-k8/phc-k8-0.4.4.ebuild48
-rw-r--r--sys-power/phctool/Manifest1
-rw-r--r--sys-power/phctool/files/phctool-0.5.2.2_all_paths_tool_no_sudo.patch17
-rw-r--r--sys-power/phctool/files/phctool-0.5.2.2_all_paths_tool_sudo.patch18
-rw-r--r--sys-power/phctool/files/phctool-0.5.2.2_all_paths_tray.patch32
-rw-r--r--sys-power/phctool/files/phctool-0.5.2.2_gui_kernel_2.6.38.patch21
-rw-r--r--sys-power/phctool/files/phctool-0.5.2.2_kernel_2.6.36.patch79
-rw-r--r--sys-power/phctool/metadata.xml11
-rw-r--r--sys-power/phctool/phctool-0.5.2.2-r1.ebuild79
-rw-r--r--sys-power/phctool/phctool-0.5.2.2-r2.ebuild78
-rw-r--r--sys-power/pm-quirks/Manifest1
-rw-r--r--sys-power/pm-quirks/metadata.xml5
-rw-r--r--sys-power/pm-quirks/pm-quirks-20100619.ebuild22
-rw-r--r--sys-power/pm-utils/Manifest1
-rw-r--r--sys-power/pm-utils/files/1.4.1-bluetooth-sync.patch43
-rw-r--r--sys-power/pm-utils/files/1.4.1-disable-sata-alpm.patch24
-rw-r--r--sys-power/pm-utils/files/1.4.1-echo-n.patch51
-rw-r--r--sys-power/pm-utils/files/1.4.1-fix-alpm-typo.patch29
-rw-r--r--sys-power/pm-utils/files/1.4.1-fix-intel-audio-powersave-hook.patch40
-rw-r--r--sys-power/pm-utils/files/1.4.1-ignore-led-failure.patch14
-rw-r--r--sys-power/pm-utils/files/1.4.1-inhibit-on-right-status.patch20
-rw-r--r--sys-power/pm-utils/files/1.4.1-logging-append.patch17
-rw-r--r--sys-power/pm-utils/files/1.4.1-run-hook-logging.patch17
-rw-r--r--sys-power/pm-utils/files/1.4.1-suspend-hybrid.patch36
-rw-r--r--sys-power/pm-utils/files/1.4.1-uswsusp-hibernate-mode.patch19
-rw-r--r--sys-power/pm-utils/files/1.4.1-xfs_buffer_arguments.patch31
-rw-r--r--sys-power/pm-utils/files/pm-utils.logrotate8
-rw-r--r--sys-power/pm-utils/files/power.d/pci_devices61
-rw-r--r--sys-power/pm-utils/files/power.d/usb_bluetooth45
-rw-r--r--sys-power/pm-utils/files/sleep.d/50unload_alx18
-rw-r--r--sys-power/pm-utils/metadata.xml11
-rw-r--r--sys-power/pm-utils/pm-utils-1.4.1-r6.ebuild94
-rw-r--r--sys-power/pm-utils/pm-utils-1.4.1-r7.ebuild95
-rw-r--r--sys-power/pmtools/Manifest2
-rw-r--r--sys-power/pmtools/files/pmtools-20071116-64bit.patch20
-rw-r--r--sys-power/pmtools/files/pmtools-20071116-acpixtract-pmtools.patch42
-rw-r--r--sys-power/pmtools/files/pmtools-20071116-cflags-ldflags.patch38
-rw-r--r--sys-power/pmtools/files/pmtools-20100123-acpixtract-pmtools.patch42
-rw-r--r--sys-power/pmtools/files/pmtools-20100123-cflags-ldflags.patch52
-rw-r--r--sys-power/pmtools/files/pmtools-20100123-madt.patch39
-rw-r--r--sys-power/pmtools/files/pmtools-20101124-cflags-ldflags.patch48
-rw-r--r--sys-power/pmtools/metadata.xml17
-rw-r--r--sys-power/pmtools/pmtools-20071116.ebuild52
-rw-r--r--sys-power/pmtools/pmtools-20110323-r1.ebuild55
-rw-r--r--sys-power/pmtools/pmtools-20110323.ebuild58
-rw-r--r--sys-power/powerman/Manifest1
-rw-r--r--sys-power/powerman/files/powerman24
-rw-r--r--sys-power/powerman/metadata.xml19
-rw-r--r--sys-power/powerman/powerman-2.3.9.ebuild38
-rw-r--r--sys-power/powermgmt-base/Manifest1
-rw-r--r--sys-power/powermgmt-base/metadata.xml8
-rw-r--r--sys-power/powermgmt-base/powermgmt-base-1.31.ebuild49
-rw-r--r--sys-power/powernowd/Manifest1
-rw-r--r--sys-power/powernowd/files/powernowd-1.00-buf.patch11
-rw-r--r--sys-power/powernowd/files/powernowd.confd24
-rw-r--r--sys-power/powernowd/files/powernowd.initd21
-rw-r--r--sys-power/powernowd/files/powernowd.service8
-rw-r--r--sys-power/powernowd/metadata.xml10
-rw-r--r--sys-power/powernowd/powernowd-1.00-r3.ebuild39
-rw-r--r--sys-power/powertop/Manifest4
-rw-r--r--sys-power/powertop/files/csstoh18
-rw-r--r--sys-power/powertop/files/powertop-1.98-build-cc.patch28
-rw-r--r--sys-power/powertop/files/powertop-1.98-build-libnl-3.patch27
-rw-r--r--sys-power/powertop/files/powertop-1.98-build.patch80
-rw-r--r--sys-power/powertop/files/powertop-1.98-gcc-4.7.patch151
-rw-r--r--sys-power/powertop/files/powertop-2.2-cpu-add-new-Intel-cpuid.patch41
-rw-r--r--sys-power/powertop/files/powertop-2.2-use-package_version.patch26
-rw-r--r--sys-power/powertop/files/powertop-2.4-tinfo.patch11
-rw-r--r--sys-power/powertop/files/powertop-2.7-baytrail-msr.patch33
-rw-r--r--sys-power/powertop/files/powertop-2.7-braswell.patch81
-rw-r--r--sys-power/powertop/files/powertop-2.7-broadwell.patch28
-rw-r--r--sys-power/powertop/files/powertop-2.7-skylake-2.patch37
-rw-r--r--sys-power/powertop/files/powertop-2.7-skylake.patch58
-rw-r--r--sys-power/powertop/metadata.xml8
-rw-r--r--sys-power/powertop/powertop-1.13.ebuild44
-rw-r--r--sys-power/powertop/powertop-2.5.ebuild110
-rw-r--r--sys-power/powertop/powertop-2.6.ebuild107
-rw-r--r--sys-power/powertop/powertop-2.7-r1.ebuild104
-rw-r--r--sys-power/powertop/powertop-2.7-r2.ebuild108
-rw-r--r--sys-power/powertop/powertop-2.7.ebuild104
-rw-r--r--sys-power/powertop/powertop-9999.ebuild104
-rw-r--r--sys-power/sispmctl/Manifest2
-rw-r--r--sys-power/sispmctl/metadata.xml21
-rw-r--r--sys-power/sispmctl/sispmctl-2.7.ebuild26
-rw-r--r--sys-power/sispmctl/sispmctl-3.1.ebuild45
-rw-r--r--sys-power/suspend/Manifest3
-rw-r--r--sys-power/suspend/files/suspend-1.0-automake-1.13.patch11
-rw-r--r--sys-power/suspend/files/suspend-1.0-bzip2.patch37
-rw-r--r--sys-power/suspend/files/suspend-1.0-errno.patch10
-rw-r--r--sys-power/suspend/metadata.xml19
-rw-r--r--sys-power/suspend/suspend-1.0.ebuild60
-rw-r--r--sys-power/suspend/suspend-1.0_p20150622.ebuild58
-rw-r--r--sys-power/thermald/Manifest2
-rw-r--r--sys-power/thermald/files/thermald19
-rw-r--r--sys-power/thermald/files/thermald-1.4.2-terminate-r1.patch65
-rw-r--r--sys-power/thermald/metadata.xml16
-rw-r--r--sys-power/thermald/thermald-1.3.ebuild41
-rw-r--r--sys-power/thermald/thermald-1.4.2-r1.ebuild45
-rw-r--r--sys-power/upower-pm-utils/Manifest1
-rw-r--r--sys-power/upower-pm-utils/files/upower-pm-utils-0.9.23-always_use_pm-utils_backend.patch27
-rw-r--r--sys-power/upower-pm-utils/files/upower-pm-utils-0.9.23-clamp_percentage_for_overfull_batt.patch72
-rw-r--r--sys-power/upower-pm-utils/files/upower-pm-utils-0.9.23-create-dir-runtime.patch34
-rw-r--r--sys-power/upower-pm-utils/files/upower-pm-utils-0.9.23-fix-segfault.patch24
-rw-r--r--sys-power/upower-pm-utils/metadata.xml8
-rw-r--r--sys-power/upower-pm-utils/upower-pm-utils-0.9.23-r2.ebuild102
-rw-r--r--sys-power/upower/Manifest2
-rw-r--r--sys-power/upower/metadata.xml8
-rw-r--r--sys-power/upower/upower-0.99.2-r1.ebuild85
-rw-r--r--sys-power/upower/upower-0.99.3.ebuild85
-rw-r--r--sys-power/yacpi/Manifest1
-rw-r--r--sys-power/yacpi/metadata.xml8
-rw-r--r--sys-power/yacpi/yacpi-3.0.1.ebuild40
252 files changed, 12048 insertions, 0 deletions
diff --git a/sys-power/acpi/Manifest b/sys-power/acpi/Manifest
new file mode 100644
index 000000000000..f2bba8fc8470
--- /dev/null
+++ b/sys-power/acpi/Manifest
@@ -0,0 +1 @@
+DIST acpi-1.6.tar.gz 92448 SHA256 ed61d20400c4fd3965dde9b49ab3ac74da02f8eca1a55454f7a1ac3fa1fd5c31
diff --git a/sys-power/acpi/acpi-1.6.ebuild b/sys-power/acpi/acpi-1.6.ebuild
new file mode 100644
index 000000000000..15598413f788
--- /dev/null
+++ b/sys-power/acpi/acpi-1.6.ebuild
@@ -0,0 +1,16 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+DESCRIPTION="Attempts to replicate the functionality of the 'old' apm command on ACPI systems"
+HOMEPAGE="http://sourceforge.net/projects/acpiclient/"
+SRC_URI="mirror://sourceforge/acpiclient/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE=""
+
+DOCS="AUTHORS ChangeLog README"
diff --git a/sys-power/acpi/metadata.xml b/sys-power/acpi/metadata.xml
new file mode 100644
index 000000000000..5b9e7167420f
--- /dev/null
+++ b/sys-power/acpi/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>maintainer-needed@gentoo.org</email>
+ </maintainer>
+ <upstream>
+ <remote-id type="sourceforge">acpiclient</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-power/acpi_call/Manifest b/sys-power/acpi_call/Manifest
new file mode 100644
index 000000000000..793682380e1f
--- /dev/null
+++ b/sys-power/acpi_call/Manifest
@@ -0,0 +1 @@
+DIST acpi_call-1.1.0.tar.gz 10470 SHA256 d0d14b42944282724fca76f57d598eed794ef97448f387d1c489d85ad813f2f0 SHA512 d5cf13c15f9057e3a27aaacfee6dcdb17b6a79194bdc8fd57b8140c07a532e2e58151bea881aa158c1183ac3bbe89f83fcfc2279ffd9e945a72331b6ddbf2c70 WHIRLPOOL 9cfc9e8a9b21e712eb21ee2e708e9f1825f5ad19ddfc292e9b0c9e126b7841114f9e6bee2716bc58094a71a7cb231cdc70943cf33b2a5d8c15bd477af0abe849
diff --git a/sys-power/acpi_call/acpi_call-1.1.0-r1.ebuild b/sys-power/acpi_call/acpi_call-1.1.0-r1.ebuild
new file mode 100644
index 000000000000..1df9e2e8e561
--- /dev/null
+++ b/sys-power/acpi_call/acpi_call-1.1.0-r1.ebuild
@@ -0,0 +1,37 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils linux-info linux-mod
+
+if [ "${PV}" = "9999" ]; then
+ inherit git-2
+ EGIT_REPO_URI="git://github.com/mkottman/acpi_call.git"
+ KEYWORDS=""
+else
+ inherit vcs-snapshot
+ SRC_URI="https://github.com/mkottman/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+ KEYWORDS="~amd64"
+fi
+
+DESCRIPTION="A kernel module that enables you to call ACPI methods"
+HOMEPAGE="http://github.com/mkottman/acpi_call"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+CONFIG_CHECK="ACPI"
+MODULE_NAMES="acpi_call(misc:${S})"
+BUILD_TARGETS="default"
+
+src_prepare(){
+ epatch "${FILESDIR}/${P}-linux-3.17.patch"
+}
+
+src_compile(){
+ BUILD_PARAMS="KDIR=${KV_OUT_DIR} M=${S}"
+ linux-mod_src_compile
+}
diff --git a/sys-power/acpi_call/acpi_call-1.1.0.ebuild b/sys-power/acpi_call/acpi_call-1.1.0.ebuild
new file mode 100644
index 000000000000..a6e17ad2cf52
--- /dev/null
+++ b/sys-power/acpi_call/acpi_call-1.1.0.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit linux-info linux-mod
+
+if [ "${PV}" = "9999" ]; then
+ inherit git-2
+ EGIT_REPO_URI="git://github.com/mkottman/acpi_call.git"
+ KEYWORDS=""
+else
+ inherit vcs-snapshot
+ SRC_URI="https://github.com/mkottman/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+ KEYWORDS="~amd64"
+fi
+
+DESCRIPTION="A kernel module that enables you to call ACPI methods"
+HOMEPAGE="http://github.com/mkottman/acpi_call"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+CONFIG_CHECK="ACPI"
+MODULE_NAMES="acpi_call(misc:${S})"
+BUILD_TARGETS="default"
+
+src_compile(){
+ BUILD_PARAMS="KDIR=${KV_OUT_DIR} M=${S}"
+ linux-mod_src_compile
+}
diff --git a/sys-power/acpi_call/acpi_call-9999.ebuild b/sys-power/acpi_call/acpi_call-9999.ebuild
new file mode 100644
index 000000000000..a6e17ad2cf52
--- /dev/null
+++ b/sys-power/acpi_call/acpi_call-9999.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit linux-info linux-mod
+
+if [ "${PV}" = "9999" ]; then
+ inherit git-2
+ EGIT_REPO_URI="git://github.com/mkottman/acpi_call.git"
+ KEYWORDS=""
+else
+ inherit vcs-snapshot
+ SRC_URI="https://github.com/mkottman/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+ KEYWORDS="~amd64"
+fi
+
+DESCRIPTION="A kernel module that enables you to call ACPI methods"
+HOMEPAGE="http://github.com/mkottman/acpi_call"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+CONFIG_CHECK="ACPI"
+MODULE_NAMES="acpi_call(misc:${S})"
+BUILD_TARGETS="default"
+
+src_compile(){
+ BUILD_PARAMS="KDIR=${KV_OUT_DIR} M=${S}"
+ linux-mod_src_compile
+}
diff --git a/sys-power/acpi_call/files/acpi_call-1.1.0-linux-3.17.patch b/sys-power/acpi_call/files/acpi_call-1.1.0-linux-3.17.patch
new file mode 100644
index 000000000000..32923a488aed
--- /dev/null
+++ b/sys-power/acpi_call/files/acpi_call-1.1.0-linux-3.17.patch
@@ -0,0 +1,26 @@
+From c5b7a4bf93a28e6ce68beb54b48d3745db943e54 Mon Sep 17 00:00:00 2001
+From: Christoph Junghans <ottxor@gentoo.org>
+Date: Mon, 27 Oct 2014 21:57:10 -0600
+Subject: [PATCH] fix build with linux-3.17
+
+https://bugs.gentoo.org/show_bug.cgi?id=524614
+---
+ acpi_call.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/acpi_call.c b/acpi_call.c
+index 3025d97..fa4f2c6 100644
+--- a/acpi_call.c
++++ b/acpi_call.c
+@@ -6,7 +6,7 @@
+ #include <linux/proc_fs.h>
+ #include <linux/slab.h>
+ #include <asm/uaccess.h>
+-#include <acpi/acpi.h>
++#include <linux/acpi.h>
+
+ MODULE_LICENSE("GPL");
+
+--
+2.0.4
+
diff --git a/sys-power/acpi_call/metadata.xml b/sys-power/acpi_call/metadata.xml
new file mode 100644
index 000000000000..e555b0bb58b5
--- /dev/null
+++ b/sys-power/acpi_call/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>maksbotan@gentoo.org</email>
+ </maintainer>
+ <maintainer>
+ <email>ottxor@gentoo.org</email>
+ <name>Christoph Junghans</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">mkottman/acpi_call</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-power/acpid/Manifest b/sys-power/acpid/Manifest
new file mode 100644
index 000000000000..937904dea199
--- /dev/null
+++ b/sys-power/acpid/Manifest
@@ -0,0 +1,4 @@
+DIST acpid-2.0.20.tar.xz 151380 SHA256 6a1ebaf52c6bef0f3d6da24a364e5f9401004d60ef4f42ec2a23057799fcf750 SHA512 f1c1a91cd5db45c1da6b3f698671bb55b629eb149e09a680cc061a7cf921499f8486ce471d4789dd98f548247ecf1afffc0127fdfb120b3d3adfe0cfa35d172b WHIRLPOOL b22e1578b337e69e6ebbecd3a5e9fdcef9ba0a87e3364e23545f9db2a91bf77a40e70f8e772f85dbdda574c06efdf65848ca7dc75bb773f410a679c73fea4f9e
+DIST acpid-2.0.21.tar.xz 152968 SHA256 c4e67e59888ccb43e6b8f01efb794945356aecdff86155c6a5b0f371d1ff636f SHA512 c449a234f04e8d2e1c7a3eac7e36c020c829e5cd00de3e8716c7645c7e53d8fd4d430f862cb320ed536918fff190b6582f932feff315b0cb117ef89d9fec274e WHIRLPOOL b7162e6f6d00cb2495bb61112e26cfd2c0c27567f35d6329b9f4c953ad74b189ba0141253517b24af447ef3b4352ab00cfeb067e2f779694397d0788bd1edc3f
+DIST acpid-2.0.22.tar.xz 153596 SHA256 3d11454f4283c8f771d8dbd5eb6b5f2bbd9d94d9f77d68bab89e35d98b67ab31 SHA512 ed52d80a17bca082cfe8d14acd4e9f736337f43c3c5c1e90b9fd5c4e8bfc2525dd0992d47230f0cae65e0eac1b2454adb350024f2955e82ffa7125e6eabf4f6a WHIRLPOOL 18acb58b2f454ed15fb024005e2bbb42550b9c283c1a1514cd08c2db8d2daccab2509871c956ea0f528519aa8896748119cc7a972c3d1216600f3fa8353761ac
+DIST acpid-2.0.23.tar.xz 154504 SHA256 4396aaec13510c3a1faa941a15a4b5335b6ae4fbec8438b9249b88c3b66187ee SHA512 b2f01f04a9c5370608016c16ecfbc5b503170c2686e6557ab1463e25d56a3ef1d2093d4701205ec1261564b1073653b404d0ae278c0bd8c8496606be1785963f WHIRLPOOL b9c7d4d64e663ffb9c58d2129b4f599453b4da0111b244269cf89ca50cc2de7ecdbea361825724963ee0b93294cadde12dee06c4816f5b709a23e7d443df0afd
diff --git a/sys-power/acpid/acpid-2.0.20.ebuild b/sys-power/acpid/acpid-2.0.20.ebuild
new file mode 100644
index 000000000000..c67a5735d28a
--- /dev/null
+++ b/sys-power/acpid/acpid-2.0.20.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit systemd
+
+DESCRIPTION="Daemon for Advanced Configuration and Power Interface"
+HOMEPAGE="http://sourceforge.net/projects/acpid2"
+SRC_URI="mirror://sourceforge/${PN}2/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ia64 x86"
+IUSE="selinux"
+
+RDEPEND="selinux? ( sec-policy/selinux-apm )"
+DEPEND="${RDEPEND}
+ >=sys-kernel/linux-headers-3"
+
+src_configure() {
+ econf --docdir=/usr/share/doc/${PF}
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+
+ newdoc kacpimon/README README.kacpimon
+ dodoc -r samples
+ rm -f "${D}"/usr/share/doc/${PF}/COPYING || die
+
+ exeinto /etc/acpi
+ newexe "${FILESDIR}"/${PN}-1.0.6-default.sh default.sh
+ exeinto /etc/acpi/actions
+ newexe samples/powerbtn/powerbtn.sh powerbtn.sh
+ insinto /etc/acpi/events
+ newins "${FILESDIR}"/${PN}-1.0.4-default default
+
+ newinitd "${FILESDIR}"/${PN}-2.0.16-init.d ${PN}
+ newconfd "${FILESDIR}"/${PN}-2.0.16-conf.d ${PN}
+
+ systemd_dounit "${FILESDIR}"/systemd/${PN}.{service,socket}
+}
+
+pkg_postinst() {
+ if [[ -z ${REPLACING_VERSIONS} ]]; then
+ elog
+ elog "You may wish to read the Gentoo Linux Power Management Guide,"
+ elog "which can be found online at:"
+ elog "http://www.gentoo.org/doc/en/power-management-guide.xml"
+ elog
+ fi
+
+ # files/systemd/acpid.socket -> ListenStream=/run/acpid.socket
+ mkdir -p "${ROOT}"/run
+
+ if ! grep -qs "^tmpfs.*/run " "${ROOT}"/proc/mounts ; then
+ echo
+ ewarn "You should reboot the system now to get /run mounted with tmpfs!"
+ fi
+}
diff --git a/sys-power/acpid/acpid-2.0.21.ebuild b/sys-power/acpid/acpid-2.0.21.ebuild
new file mode 100644
index 000000000000..244e0f1e53d7
--- /dev/null
+++ b/sys-power/acpid/acpid-2.0.21.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit systemd
+
+DESCRIPTION="Daemon for Advanced Configuration and Power Interface"
+HOMEPAGE="http://sourceforge.net/projects/acpid2"
+SRC_URI="mirror://sourceforge/${PN}2/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ia64 ~x86"
+IUSE="selinux"
+
+RDEPEND="selinux? ( sec-policy/selinux-apm )"
+DEPEND="${RDEPEND}
+ >=sys-kernel/linux-headers-3"
+
+src_configure() {
+ econf --docdir=/usr/share/doc/${PF}
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+
+ newdoc kacpimon/README README.kacpimon
+ dodoc -r samples
+ rm -f "${D}"/usr/share/doc/${PF}/COPYING || die
+
+ exeinto /etc/acpi
+ newexe "${FILESDIR}"/${PN}-1.0.6-default.sh default.sh
+ exeinto /etc/acpi/actions
+ newexe samples/powerbtn/powerbtn.sh powerbtn.sh
+ insinto /etc/acpi/events
+ newins "${FILESDIR}"/${PN}-1.0.4-default default
+
+ newinitd "${FILESDIR}"/${PN}-2.0.16-init.d ${PN}
+ newconfd "${FILESDIR}"/${PN}-2.0.16-conf.d ${PN}
+
+ systemd_dounit "${FILESDIR}"/systemd/${PN}.{service,socket}
+}
+
+pkg_postinst() {
+ if [[ -z ${REPLACING_VERSIONS} ]]; then
+ elog
+ elog "You may wish to read the Gentoo Linux Power Management Guide,"
+ elog "which can be found online at:"
+ elog "http://www.gentoo.org/doc/en/power-management-guide.xml"
+ elog
+ fi
+
+ # files/systemd/acpid.socket -> ListenStream=/run/acpid.socket
+ mkdir -p "${ROOT}"/run
+
+ if ! grep -qs "^tmpfs.*/run " "${ROOT}"/proc/mounts ; then
+ echo
+ ewarn "You should reboot the system now to get /run mounted with tmpfs!"
+ fi
+}
diff --git a/sys-power/acpid/acpid-2.0.22.ebuild b/sys-power/acpid/acpid-2.0.22.ebuild
new file mode 100644
index 000000000000..9e1df318feff
--- /dev/null
+++ b/sys-power/acpid/acpid-2.0.22.ebuild
@@ -0,0 +1,68 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit linux-info systemd
+
+DESCRIPTION="Daemon for Advanced Configuration and Power Interface"
+HOMEPAGE="http://sourceforge.net/projects/acpid2"
+SRC_URI="mirror://sourceforge/${PN}2/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ia64 ~x86"
+IUSE="selinux"
+
+RDEPEND="selinux? ( sec-policy/selinux-apm )"
+DEPEND=">=sys-kernel/linux-headers-3"
+
+pkg_pretend() {
+ local CONFIG_CHECK="~INPUT_EVDEV"
+ local WARNING_INPUT_EVDEV="CONFIG_INPUT_EVDEV is required for ACPI button event support."
+ [[ ${MERGE_TYPE} != buildonly ]] && check_extra_config
+}
+
+pkg_setup() { :; }
+
+src_configure() {
+ econf --docdir=/usr/share/doc/${PF}
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+
+ newdoc kacpimon/README README.kacpimon
+ dodoc -r samples
+ rm -f "${D}"/usr/share/doc/${PF}/COPYING || die
+
+ exeinto /etc/acpi
+ newexe "${FILESDIR}"/${PN}-1.0.6-default.sh default.sh
+ exeinto /etc/acpi/actions
+ newexe samples/powerbtn/powerbtn.sh powerbtn.sh
+ insinto /etc/acpi/events
+ newins "${FILESDIR}"/${PN}-1.0.4-default default
+
+ newinitd "${FILESDIR}"/${PN}-2.0.16-init.d ${PN}
+ newconfd "${FILESDIR}"/${PN}-2.0.16-conf.d ${PN}
+
+ systemd_dounit "${FILESDIR}"/systemd/${PN}.{service,socket}
+}
+
+pkg_postinst() {
+ if [[ -z ${REPLACING_VERSIONS} ]]; then
+ elog
+ elog "You may wish to read the Gentoo Linux Power Management Guide,"
+ elog "which can be found online at:"
+ elog "http://www.gentoo.org/doc/en/power-management-guide.xml"
+ elog
+ fi
+
+ # files/systemd/acpid.socket -> ListenStream=/run/acpid.socket
+ mkdir -p "${ROOT%/}"/run
+
+ if ! grep -qs "^tmpfs.*/run " "${ROOT%/}"/proc/mounts ; then
+ echo
+ ewarn "You should reboot the system now to get /run mounted with tmpfs!"
+ fi
+}
diff --git a/sys-power/acpid/acpid-2.0.23.ebuild b/sys-power/acpid/acpid-2.0.23.ebuild
new file mode 100644
index 000000000000..777d679c8791
--- /dev/null
+++ b/sys-power/acpid/acpid-2.0.23.ebuild
@@ -0,0 +1,68 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit linux-info systemd
+
+DESCRIPTION="Daemon for Advanced Configuration and Power Interface"
+HOMEPAGE="http://sourceforge.net/projects/acpid2"
+SRC_URI="mirror://sourceforge/${PN}2/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ia64 x86"
+IUSE="selinux"
+
+RDEPEND="selinux? ( sec-policy/selinux-apm )"
+DEPEND=">=sys-kernel/linux-headers-3"
+
+pkg_pretend() {
+ local CONFIG_CHECK="~INPUT_EVDEV"
+ local WARNING_INPUT_EVDEV="CONFIG_INPUT_EVDEV is required for ACPI button event support."
+ [[ ${MERGE_TYPE} != buildonly ]] && check_extra_config
+}
+
+pkg_setup() { :; }
+
+src_configure() {
+ econf --docdir=/usr/share/doc/${PF}
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+
+ newdoc kacpimon/README README.kacpimon
+ dodoc -r samples
+ rm -f "${D}"/usr/share/doc/${PF}/COPYING || die
+
+ exeinto /etc/acpi
+ newexe "${FILESDIR}"/${PN}-1.0.6-default.sh default.sh
+ exeinto /etc/acpi/actions
+ newexe samples/powerbtn/powerbtn.sh powerbtn.sh
+ insinto /etc/acpi/events
+ newins "${FILESDIR}"/${PN}-1.0.4-default default
+
+ newinitd "${FILESDIR}"/${PN}-2.0.16-init.d ${PN}
+ newconfd "${FILESDIR}"/${PN}-2.0.16-conf.d ${PN}
+
+ systemd_dounit "${FILESDIR}"/systemd/${PN}.{service,socket}
+}
+
+pkg_postinst() {
+ if [[ -z ${REPLACING_VERSIONS} ]]; then
+ elog
+ elog "You may wish to read the Gentoo Linux Power Management Guide,"
+ elog "which can be found online at:"
+ elog "http://www.gentoo.org/doc/en/power-management-guide.xml"
+ elog
+ fi
+
+ # files/systemd/acpid.socket -> ListenStream=/run/acpid.socket
+ mkdir -p "${ROOT%/}"/run
+
+ if ! grep -qs "^tmpfs.*/run " "${ROOT%/}"/proc/mounts ; then
+ echo
+ ewarn "You should reboot the system now to get /run mounted with tmpfs!"
+ fi
+}
diff --git a/sys-power/acpid/files/acpid-1.0.4-default b/sys-power/acpid/files/acpid-1.0.4-default
new file mode 100644
index 000000000000..a07c1827f4e9
--- /dev/null
+++ b/sys-power/acpid/files/acpid-1.0.4-default
@@ -0,0 +1,19 @@
+# /etc/acpi/events/default
+# This is the ACPID default configuration, it takes all
+# events and passes them to /etc/acpi/default.sh for further
+# processing.
+
+# event keeps a regular expression matching the event. To get
+# power events only, just use something like "event=button[ /]power.*"
+# to catch it.
+# action keeps the command to be executed after an event occurs
+# In case of the power event above, your entry may look this way:
+#event=button[ /]power.*
+#action=/sbin/init 0
+
+# Optionally you can specify the placeholder %e. It will pass
+# through the whole kernel event message to the program you've
+# specified.
+
+event=.*
+action=/etc/acpi/default.sh %e
diff --git a/sys-power/acpid/files/acpid-1.0.6-default.sh b/sys-power/acpid/files/acpid-1.0.6-default.sh
new file mode 100755
index 000000000000..8be6f3e1a9f4
--- /dev/null
+++ b/sys-power/acpid/files/acpid-1.0.6-default.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+# /etc/acpi/default.sh
+# Default acpi script that takes an entry for all actions
+
+set $*
+
+group=${1%%/*}
+action=${1#*/}
+device=$2
+id=$3
+value=$4
+
+log_unhandled() {
+ logger "ACPI event unhandled: $*"
+}
+
+case "$group" in
+ button)
+ case "$action" in
+ power)
+ /etc/acpi/actions/powerbtn.sh
+ ;;
+
+ # if your laptop doesnt turn on/off the display via hardware
+ # switch and instead just generates an acpi event, you can force
+ # X to turn off the display via dpms. note you will have to run
+ # 'xhost +local:0' so root can access the X DISPLAY.
+ #lid)
+ # xset dpms force off
+ # ;;
+
+ *) log_unhandled $* ;;
+ esac
+ ;;
+
+ ac_adapter)
+ case "$value" in
+ # Add code here to handle when the system is unplugged
+ # (maybe change cpu scaling to powersave mode). For
+ # multicore systems, make sure you set powersave mode
+ # for each core!
+ #*0)
+ # cpufreq-set -g powersave
+ # ;;
+
+ # Add code here to handle when the system is plugged in
+ # (maybe change cpu scaling to performance mode). For
+ # multicore systems, make sure you set performance mode
+ # for each core!
+ #*1)
+ # cpufreq-set -g performance
+ # ;;
+
+ *) log_unhandled $* ;;
+ esac
+ ;;
+
+ *) log_unhandled $* ;;
+esac
diff --git a/sys-power/acpid/files/acpid-2.0.16-conf.d b/sys-power/acpid/files/acpid-2.0.16-conf.d
new file mode 100644
index 000000000000..9aadb4cd814a
--- /dev/null
+++ b/sys-power/acpid/files/acpid-2.0.16-conf.d
@@ -0,0 +1,6 @@
+# /etc/conf.d/acpid: config file for /etc/init.d/acpid
+
+# Options to pass to the acpid daemon.
+# See the acpid(8) man page for more info.
+
+ACPID_ARGS=""
diff --git a/sys-power/acpid/files/acpid-2.0.16-init.d b/sys-power/acpid/files/acpid-2.0.16-init.d
new file mode 100644
index 000000000000..aa8ff75f18e3
--- /dev/null
+++ b/sys-power/acpid/files/acpid-2.0.16-init.d
@@ -0,0 +1,21 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+extra_started_commands="reload"
+command="/usr/sbin/acpid"
+command_args="${ACPID_ARGS}"
+start_stop_daemon_args="--quiet"
+description="Daemon for Advanced Configuration and Power Interface"
+
+depend() {
+ need localmount
+ use logger
+}
+
+reload() {
+ ebegin "Reloading acpid configuration"
+ start-stop-daemon --exec $command --signal HUP
+ eend $?
+}
diff --git a/sys-power/acpid/files/systemd/acpid.service b/sys-power/acpid/files/systemd/acpid.service
new file mode 100644
index 000000000000..e4ddacdbead7
--- /dev/null
+++ b/sys-power/acpid/files/systemd/acpid.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=ACPI event daemon
+Requires=acpid.socket
+
+[Service]
+ExecStart=/usr/sbin/acpid -f
+
+[Install]
+WantedBy=multi-user.target
+Also=acpid.socket
diff --git a/sys-power/acpid/files/systemd/acpid.socket b/sys-power/acpid/files/systemd/acpid.socket
new file mode 100644
index 000000000000..1b23f8735d48
--- /dev/null
+++ b/sys-power/acpid/files/systemd/acpid.socket
@@ -0,0 +1,8 @@
+[Unit]
+Description=ACPID Listen Socket
+
+[Socket]
+ListenStream=/var/run/acpid.socket
+
+[Install]
+WantedBy=sockets.target
diff --git a/sys-power/acpid/metadata.xml b/sys-power/acpid/metadata.xml
new file mode 100644
index 000000000000..1eb122264547
--- /dev/null
+++ b/sys-power/acpid/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>miska@gentoo.org</email>
+ <name>Michal Hrušecký</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="sourceforge">acpid2</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-power/acpitool/Manifest b/sys-power/acpitool/Manifest
new file mode 100644
index 000000000000..1332daf4e6d8
--- /dev/null
+++ b/sys-power/acpitool/Manifest
@@ -0,0 +1 @@
+DIST acpitool-0.5.1.tar.bz2 109584 SHA256 004fb6cd43102918b6302cf537a2db7ceadda04aef2e0906ddf230f820dad34f SHA512 3e8684525b3dbe165b30507943beb975881a374ac3171fcfdf88098721fa3f751bfc161c3ac84180df1ae455673e0c0bc24fd06f0786911f15502effeeaab86b WHIRLPOOL bad79e2513d9c9c8225e6962e172e57eefe9bff35fc40ed2419e5c06e8ce8479363159c3b4c0f11ab671f2b4464afc855c67fee799ee1c70d669009f95c25b83
diff --git a/sys-power/acpitool/acpitool-0.5.1-r1.ebuild b/sys-power/acpitool/acpitool-0.5.1-r1.ebuild
new file mode 100644
index 000000000000..e33a54b69862
--- /dev/null
+++ b/sys-power/acpitool/acpitool-0.5.1-r1.ebuild
@@ -0,0 +1,25 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils
+
+DESCRIPTION="A small command line application, intended to be a replacement for the apm tool"
+HOMEPAGE="http://packages.debian.org/sid/acpitool"
+SRC_URI="mirror://gentoo/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE=""
+
+DOCS="AUTHORS ChangeLog README TODO"
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/${P}-ac_adapter.patch \
+ "${FILESDIR}"/${P}-battery.patch \
+ "${FILESDIR}"/${P}-kernel3.patch \
+ "${FILESDIR}"/${P}-wakeup.patch
+}
diff --git a/sys-power/acpitool/files/acpitool-0.5.1-ac_adapter.patch b/sys-power/acpitool/files/acpitool-0.5.1-ac_adapter.patch
new file mode 100644
index 000000000000..070fdf9de1b7
--- /dev/null
+++ b/sys-power/acpitool/files/acpitool-0.5.1-ac_adapter.patch
@@ -0,0 +1,73 @@
+Author: Michael Meskes <meskes@debian.org>
+Description: Fix reading of ac_adapter information.
+
+--- src/ac_adapter.cpp
++++ src/ac_adapter.cpp
+@@ -149,7 +149,7 @@
+ int Do_AC_Info_Sys()
+ {
+ ifstream file_in;
+- char filename[2][65], str[100], temp[100];
++ char filename[2][65], str[100], temp[100], attr[100];
+ int ac_count = 0, start = 0, findex = 0;
+ DIR *ac_dir;
+ char *name, *dirname;
+@@ -206,31 +206,40 @@
+
+ if(ac_count>0)
+ {
+- for(int i=0; i<ac_count; i++) /* I don't expect to find > 1, but you never know */
++ for(int i=0, t=0; i<ac_count; i++) /* I don't expect to find > 1, but you never know */
+ {
+ FILE *power_fp = fopen(filename[i], "r");
+ if(power_fp)
+ {
+- for(int t=0; t<5; t++)
+- fgets(str, 100, power_fp); /* just skip the first 5 lines */
+-
+- memset(str, '\0', 100);
+- fgets(str, 100, power_fp);
++ // see linux-2.6/drivers/power/power_supply_sysfs.c
++ // there can be different number of lines, so read up to 40 lines
++ for(; t<40; t++)
++ {
++ memset(str, '\0', 100);
++ fgets(str, 100, power_fp);
+
+- if (strlen(str)!=0)
+- {
+- memset(temp, '\0', 100);
+- sscanf(str, "%*[^=] %*c %s %[^\n]",temp);
++ if (strlen(str)!=0)
++ {
++ memset(temp, '\0', 100);
++ memset(attr, '\0', 100);
++ sscanf(str, "%[^=]s %*s %[^\n]", attr);
++ sscanf(str, "%*[^=] %*c %s %[^\n]",temp);
+
+- /* keep this for debugging */
+- /* printf(" from Do_AC_SYS: temp = %s \n", temp);*/
+-
+- if(strncmp(temp,"1",1)==0)
+- printf(" AC adapter : online \n");
+- else
+- printf(" AC adapter : off-line \n");
++ /* keep this for debugging */
++ /* printf(" from Do_AC_SYS: temp = %s \n", temp);*/
++
++ if (strcmp(attr, "POWER_SUPPLY_ONLINE") == 0)
++ {
++ if(strncmp(temp,"1",1)==0)
++ printf(" AC adapter : online \n");
++ else
++ printf(" AC adapter : off-line \n");
++
++ break;
++ }
++ }
+ }
+- else
++ if (t == 40)
+ printf(" AC adapter : <info not available> \n");
+ }
+ else
diff --git a/sys-power/acpitool/files/acpitool-0.5.1-battery.patch b/sys-power/acpitool/files/acpitool-0.5.1-battery.patch
new file mode 100644
index 000000000000..76428ca7d970
--- /dev/null
+++ b/sys-power/acpitool/files/acpitool-0.5.1-battery.patch
@@ -0,0 +1,484 @@
+Author: Evgeni Golov <evgeni@debian.org>, Michael Meskes <meskes@debian.org>
+Description: Fix reading of battery information.
+
+--- src/acpitool.h
++++ src/acpitool.h
+@@ -39,6 +39,9 @@
+ char Serial[13];
+ char Bat_Type[13];
+ char Voltage_Now[13];
++ char Charge_Now[13];
++ char Charge_Full[13];
++ char Charge_Full_Design[13];
+ };
+
+
+--- src/battery.cpp
++++ src/battery.cpp
+@@ -107,6 +107,9 @@
+ memset(Batt_Info[i]->Serial, '\0', 13);
+ memset(Batt_Info[i]->Bat_Type, '\0', 13);
+ memset(Batt_Info[i]->Voltage_Now, '\0', 13);
++ memset(Batt_Info[i]->Charge_Now, '\0', 13);
++ memset(Batt_Info[i]->Charge_Full, '\0', 13);
++ memset(Batt_Info[i]->Charge_Full_Design, '\0', 13);
+
+ // initialize all struct members to blanks --> avoid rubbish in output //
+
+@@ -139,7 +142,12 @@
+ case 1 :
+ {
+ Present_Batteries++;
+- Remaining_Percentage = float(atoi(Batt_Info[i]->Remaining_Cap)) / float(atoi(Batt_Info[i]->LastFull_Cap)) * 100.0;
++
++ if (strcmp(Batt_Info[i]->Charge_Now,"")!=0 &&
++ strcmp(Batt_Info[i]->Charge_Now,"unknown")!=0)
++ Remaining_Percentage = float(atoi(Batt_Info[i]->Charge_Now)) / float(atoi(Batt_Info[i]->Charge_Full)) * 100.0;
++ else
++ Remaining_Percentage = float(atoi(Batt_Info[i]->Remaining_Cap)) / float(atoi(Batt_Info[i]->LastFull_Cap)) * 100.0;
+
+ /* from Alan Pope : some broken Dell batteries report a remaining capacity bigger
+ than their last full capacity or their design capacity. This led acpitool to report
+@@ -153,19 +161,24 @@
+ else
+ Precision = 4;
+
+- if( strncmp(Batt_Info[i]->Charging_State,"char",4)==0 )
++ if(strncasecmp(Batt_Info[i]->Charging_State,"char",4)==0)
+ {
+ Is_Charging = 1;
+ }
+ else
+ {
+- if(strncmp(Batt_Info[i]->Charging_State,"disch",5)==0) Is_Discharging = 1;
++ if(strncasecmp(Batt_Info[i]->Charging_State,"disch",5)==0) Is_Discharging = 1;
+ }
+
+ if(Show_Time) // calculate remaining or charging time only if present battery rate != 0 //
+ {
+- if(Is_Charging)
+- Remaining_Time = (float(atoi(Batt_Info[i]->LastFull_Cap)) - float(atoi(Batt_Info[i]->Remaining_Cap))) / float(atoi(Batt_Info[i]->Present_Rate));
++ if(Is_Charging) {
++ if (strcmp(Batt_Info[i]->Charge_Now,"")!=0 &&
++ strcmp(Batt_Info[i]->Charge_Now,"unknown")!=0)
++ Remaining_Time = (float(atoi(Batt_Info[i]->Charge_Full)) - float(atoi(Batt_Info[i]->Charge_Now))) / float(atoi(Batt_Info[i]->Present_Rate));
++ else
++ Remaining_Time = (float(atoi(Batt_Info[i]->LastFull_Cap)) - float(atoi(Batt_Info[i]->Remaining_Cap))) / float(atoi(Batt_Info[i]->Present_Rate));
++ }
+ else
+ Remaining_Time = float(atoi(Batt_Info[i]->Remaining_Cap)) / float(atoi(Batt_Info[i]->Present_Rate));
+ // this represents hours //
+@@ -180,9 +193,11 @@
+ Minutes = Time_In_Seconds / 60;
+ Time_In_Seconds = Time_In_Seconds - (Minutes * 60);
+ }
+-
++
+ if(atoi(Batt_Info[i]->Design_Cap) > 0)
+ Battery_Left_Percent = float(atoi(Batt_Info[i]->LastFull_Cap)) / float(atoi(Batt_Info[i]->Design_Cap)) * 100.0;
++ else if(atoi(Batt_Info[i]->Charge_Full_Design) > 0)
++ Battery_Left_Percent = float(atoi(Batt_Info[i]->Charge_Full)) / float(atoi(Batt_Info[i]->Charge_Full_Design)) * 100.0;
+ else
+ Battery_Left_Percent = -1.0;
+
+@@ -207,8 +222,15 @@
+ <<setfill('0')<<setw(2)<<Time_In_Seconds;
+ cout<<endl;
+
+- cout<<" Design capacity : "<<Batt_Info[i]->Design_Cap<<endl;
+- cout<<" Last full capacity : "<<Batt_Info[i]->LastFull_Cap;
++ if(atoi(Batt_Info[i]->Design_Cap) > 0)
++ cout<<" Design capacity : "<<Batt_Info[i]->Design_Cap<<endl;
++ else if(atoi(Batt_Info[i]->Charge_Full_Design) > 0)
++ cout<<" Design capacity : "<<Batt_Info[i]->Charge_Full_Design<<endl;
++
++ if(atoi(Batt_Info[i]->LastFull_Cap) > 0)
++ cout<<" Last full capacity : "<<Batt_Info[i]->LastFull_Cap;
++ else if(atoi(Batt_Info[i]->Charge_Full) > 0)
++ cout<<" Last full capacity : "<<Batt_Info[i]->Charge_Full;
+
+ if(Battery_Left_Percent<100.0)
+ {
+@@ -327,7 +349,7 @@
+
+
+
+-int Get_Battery_Info_from_Proc(const int bat_nr, Battery_Info *bat_info, int verbose)
++int Get_Battery_Info_from_Proc(const int bat_nr, Battery_Info *batt_info, int verbose)
+ {
+ ifstream file_in;
+ char filename[4][65], str[100], temp[100];
+@@ -378,7 +400,7 @@
+ {
+ if(!verbose)
+ {
+- bat_info->Battery_Present = 2; // 2 represents error value //
++ batt_info->Battery_Present = 2; // 2 represents error value //
+ return 0;
+ }
+ else
+@@ -422,24 +444,24 @@
+ file_in.getline(str, 100);
+ strncpy(temp, str+25, 4);
+ if(strncmp(temp,"yes",3)==0)
+- bat_info->Battery_Present = 1; //yes, we have a battery //
++ batt_info->Battery_Present = 1; //yes, we have a battery //
+ else
+ {
+- bat_info->Battery_Present = 0;
++ batt_info->Battery_Present = 0;
+ return 0; //bail out if battery is not present //
+ }
+
+ // then get the design capacity //
+ file_in.getline(str, 100);
+- strncpy(bat_info->Design_Cap, str+25, 9);
++ strncpy(batt_info->Design_Cap, str+25, 9);
+
+ // then get the last full capacity //
+ file_in.getline(str, 100);
+- strncpy(bat_info->LastFull_Cap, str+25, 9);
++ strncpy(batt_info->LastFull_Cap, str+25, 9);
+
+- if (strncmp(bat_info->LastFull_Cap,"unknown",7)==0)
++ if (strncmp(batt_info->LastFull_Cap,"unknown",7)==0)
+ {
+- bat_info->Battery_Present = 0;
++ batt_info->Battery_Present = 0;
+ return 0; //bail out if battery is not present //
+ }
+ /* some Dell laptops seem to report a 2nd battery as being present, while it is NOT, but then report the
+@@ -449,21 +471,21 @@
+
+ // then get the technology //
+ file_in.getline(str, 100);
+- strncpy(bat_info->Technology, str+25, 12);
++ strncpy(batt_info->Technology, str+25, 12);
+
+ // then get the model number //
+ for(int t=0; t<5; t++)
+ file_in.getline(str, 100); //skip 5 lines //
+ file_in.getline(str, 100);
+- strncpy(bat_info->Model, str+25, 12);
++ strncpy(batt_info->Model, str+25, 12);
+
+ // then get the serial number //
+ file_in.getline(str, 100);
+- strncpy(bat_info->Serial, str+25, 12);
++ strncpy(batt_info->Serial, str+25, 12);
+
+ // then get the battery type //
+ file_in.getline(str, 100);
+- strncpy(bat_info->Bat_Type, str+25, 12);
++ strncpy(batt_info->Bat_Type, str+25, 12);
+
+ file_in.close();
+
+@@ -480,17 +502,17 @@
+ // then get the charging state //
+ file_in.getline(str, 100); file_in.getline(str, 100); // skip first 2 lines //
+ file_in.getline(str, 100);
+- strncpy(bat_info->Charging_State, str+25, 12);
+- if (strncmp(bat_info->Charging_State,"unknown",7)==0) strncpy(bat_info->Charging_State, "charged",7);
++ strncpy(batt_info->Charging_State, str+25, 12);
++ if (strncmp(batt_info->Charging_State,"unknown",7)==0) strncpy(batt_info->Charging_State, "charged",7);
+ /* on older kernels, like 2.4.22, the charging state is reported as "unknown", whereas in recent kernels
+ this was changed to "charged". */
+
+ // then get the charging rate //
+ file_in.getline(str, 100);
+- strncpy(bat_info->Present_Rate, str+25, 9);
+- if (strncmp(bat_info->Charging_State,"charged",7)==0)
++ strncpy(batt_info->Present_Rate, str+25, 9);
++ if (strncmp(batt_info->Charging_State,"charged",7)==0)
+ {
+- if (strncmp(bat_info->Present_Rate, "unknown",7)==0) strncpy(bat_info->Present_Rate, "0 ",7);
++ if (strncmp(batt_info->Present_Rate, "unknown",7)==0) strncpy(batt_info->Present_Rate, "0 ",7);
+ }
+ /* some batteries report the present rate as "unknown", even when they report the battery as being charged.
+ If the battery is charged, the rate should be 0 */
+@@ -498,12 +520,12 @@
+
+ // then get the remaining capacity //
+ file_in.getline(str, 100);
+- strncpy(bat_info->Remaining_Cap, str+25, 9);
++ strncpy(batt_info->Remaining_Cap, str+25, 9);
+
+ file_in.close();
+ }
+ else // battery dir is readable but empty : only . and .. at most //
+- bat_info->Battery_Present = 3;
++ batt_info->Battery_Present = 3;
+
+ return 0;
+ }
+@@ -513,8 +535,8 @@
+ int Get_Battery_Info_from_Sys(const int bat_nr, Battery_Info *batt_info, int verbose)
+ {
+ ifstream file_in;
+- char filename[6][65], str[100], temp[100];
+- int bat_count = 0, start = 0, findex = 0;
++ char filename[6][65], str[100], temp[100], attr[100];
++ int bat_count = 0, start = 0, findex = 0, value = 0;
+ DIR *battery_dir;
+ char *name, *dirname;
+
+@@ -613,165 +635,104 @@
+ return -1;
+ }
+
+- memset(str, '\0', 100);
+- for(int t=0; t<5; t++)
+- fgets(str, 100, power_fp); /* skip first 5 lines */
+-
+- /* get battery status (full, charging, ...) */
+- memset(str, '\0', 100);
+- fgets(str, 100, power_fp);
+- if (strlen(str)>0)
+- {
+- memset(temp, '\0', 100);
+- sscanf(str, "%*[^=] %*c %s %[^\n]",temp);
+- strncpy(batt_info->Charging_State, temp, 12);
+- }
+-
+-
+- /* get battery presence (0 or 1) */
+- memset(str, '\0', 100);
+- fgets(str, 100, power_fp);
+- if (strlen(str)>0)
+- {
+- memset(temp, '\0', 100);
+- strncpy(temp, str+21, 1);
+- if(strncmp(temp,"1",1)==0)
+- batt_info->Battery_Present = 1; /* yes, we have a battery */
+- else
+- {
+- batt_info->Battery_Present = 0;
+- printf(" Battery is not present, bailing out. \n");
+- return 0; /* bail out if battery is not present */
+- }
+- }
+-
+-
+- /* get technology */
+- memset(str, '\0', 100);
+- fgets(str, 100, power_fp);
+- if (strlen(str)>0)
+- {
+- memset(temp, '\0', 100);
+- sscanf(str, "%*[^=] %*c %s %[^\n]",temp);
+- strncpy(batt_info->Technology, temp, 12);
+- }
+- else
+- strncpy(batt_info->Technology, "unknown", 7);
+-
+-
+-
+- //printf(" \n bat_info_tech = %s \n\n ", batt_info->Technology);
+-
+-
+-
+- fgets(str, 100, power_fp); /* skip 1 line */
+-
+-
+- /* get voltage_now */
+- memset(str, '\0', 100);
+- fgets(str, 100, power_fp);
+- if (strlen(str)>0)
+- {
+- memset(temp, '\0', 100);
+- sscanf(str, "%*[^=] %*c %s %[^\n]",temp);
+- strncpy(batt_info->Voltage_Now, temp, 12);
+- }
+- else
+- strncpy(batt_info->Voltage_Now, "unknown", 7);
+-
+-
+- /* get current_now, which I believe is the charging rate ? */
+- memset(str, '\0', 100);
+- fgets(str, 100, power_fp);
+- if (strlen(str)>0)
+- {
+- memset(temp, '\0', 100);
+- sscanf(str, "%*[^=] %*c %s %[^\n]",temp);
+- strncpy(batt_info->Present_Rate, temp, 12);
+- }
+- else
+- strncpy(batt_info->Present_Rate, "unknown", 7);
+-
+-
+- /* get charge_full_design */
+- memset(str, '\0', 100);
+- fgets(str, 100, power_fp);
+- if (strlen(str)>0)
+- {
+- memset(temp, '\0', 100);
+- sscanf(str, "%*[^=] %*c %s %[^\n]",temp);
+- strncpy(batt_info->Design_Cap, temp, 12);
+- }
+- else
+- strncpy(batt_info->Design_Cap, "unknown", 7);
+-
+-
+- //printf(" \n bat_info_design_cap = %s \n ", batt_info->Design_Cap);
+-
+-
+- /* get charge_full, which is the last full capacity I guess ? */
+- memset(str, '\0', 100);
+- fgets(str, 100, power_fp);
+- if (strlen(str)>0)
+- {
+- memset(temp, '\0', 100);
+- sscanf(str, "%*[^=] %*c %s %[^\n]",temp);
+- strncpy(batt_info->LastFull_Cap, temp, 12);
+- }
+- else
+- strncpy(batt_info->LastFull_Cap, "unknown", 7);
+-
+-
+- //printf(" \n bat_info_lastfull_cap = %s \n\n ", batt_info->LastFull_Cap);
+-
+-
+- /* get charge_now */
+- memset(str, '\0', 100);
+- fgets(str, 100, power_fp);
+- if (strlen(str)>0)
+- {
+- memset(temp, '\0', 100);
+- sscanf(str, "%*[^=] %*c %s %[^\n]",temp);
+- strncpy(batt_info->Remaining_Cap, temp, 12);
+- }
+- else
+- strncpy(batt_info->Remaining_Cap, "unknown", 7);
+-
+- //printf(" \n bat_info_remaining_cap = %s \n\n ", batt_info->Remaining_Cap);
+-
+-
+- /* get model_name */
+- memset(str, '\0', 100);
+- fgets(str, 100, power_fp);
+- if (strlen(str)>0)
+- {
+- memset(temp, '\0', 100);
+- strncpy(temp, str+24, 12); // use strncpy here because sscanf chokes on blanks in this one ? //
+-
+- memset(str, '\0', 100);
+- sscanf(temp, "%[^\n]", str); // strip trailing \n, fucks up output //
+-
+- strncpy(batt_info->Model, str, 12);
++ strncpy(batt_info->Technology, "unknown", 7);
++ strncpy(batt_info->Voltage_Now, "unknown", 7);
++ strncpy(batt_info->Charge_Now, "unknown", 7);
++ strncpy(batt_info->Charge_Full, "unknown", 7);
++ strncpy(batt_info->Charge_Full_Design, "unknown", 7);
++ strncpy(batt_info->Present_Rate, "unknown", 7);
++ strncpy(batt_info->Design_Cap, "unknown", 7);
++ strncpy(batt_info->LastFull_Cap, "unknown", 7);
++ strncpy(batt_info->Remaining_Cap, "unknown", 7);
++ strncpy(batt_info->Model, "unknown", 7);
++ strncpy(batt_info->Serial, "unknown", 7);
++
++ // see linux-2.6/drivers/power/power_supply_sysfs.c
++ // there can be different number of lines, so read up to 40 lines
++ for(int t=0; t<40; t++) {
++ memset(str, '\0', 100);
++ memset(attr, '\0', 100);
++ memset(temp, '\0', 100);
++ fgets(str, 100, power_fp);
++ sscanf(str, "%[^=]s %*s %*[^\n]", attr);
++ sscanf(str, "%*[^=] %*c %s %*[^\n]",temp);
++ if (strcmp(attr,"POWER_SUPPLY_STATUS")==0) {
++ strncpy(batt_info->Charging_State, temp, 12);
++ }
++ else if (strcmp(attr,"POWER_SUPPLY_TYPE")==0) {
++ strncpy(batt_info->Bat_Type, temp, 12);
++ }
++ else if (strcmp(attr,"POWER_SUPPLY_TECHNOLOGY")==0) {
++ strncpy(batt_info->Technology, temp, 12);
++ }
++ else if (strcmp(attr,"POWER_SUPPLY_VOLTAGE_NOW")==0) {
++ value = atoi(temp) / 1000;
++ snprintf(temp, sizeof(temp), "%i mV", value);
++ strncpy(batt_info->Voltage_Now, temp, 12);
++ }
++ else if (strcmp(attr,"POWER_SUPPLY_CURRENT_NOW")==0 ||
++ strcmp(attr,"POWER_SUPPLY_POWER_NOW")==0) {
++ value = atoi(temp) / 1000;
++ snprintf(temp, sizeof(temp), "%i", value);
++ strncpy(batt_info->Present_Rate, temp, 9);
++ }
++ else if (strcmp(attr,"POWER_SUPPLY_CHARGE_NOW")==0) {
++ value = atoi(temp) / 1000;
++ snprintf(temp, sizeof(temp), "%i mA", value);
++ strncpy(batt_info->Charge_Now, temp, 12);
++ }
++ else if (strcmp(attr,"POWER_SUPPLY_CHARGE_FULL_DESIGN")==0) {
++ value = atoi(temp) / 1000;
++ snprintf(temp, sizeof(temp), "%i mA", value);
++ strncpy(batt_info->Charge_Full_Design, temp, 12);
++ }
++ else if (strcmp(attr,"POWER_SUPPLY_CHARGE_FULL")==0) {
++ value = atoi(temp) / 1000;
++ snprintf(temp, sizeof(temp), "%i mA", value);
++ strncpy(batt_info->Charge_Full, temp, 12);
++ }
++ else if (strcmp(attr,"POWER_SUPPLY_ENERGY_FULL_DESIGN")==0) {
++ value = atoi(temp) / 1000;
++ snprintf(temp, sizeof(temp), "%i mWh", value);
++ strncpy(batt_info->Design_Cap, temp, 9);
++ }
++ else if (strcmp(attr,"POWER_SUPPLY_ENERGY_FULL")==0) {
++ value = atoi(temp) / 1000;
++ snprintf(temp, sizeof(temp), "%i mWh", value);
++ strncpy(batt_info->LastFull_Cap, temp, 9);
++ }
++ else if (strcmp(attr,"POWER_SUPPLY_ENERGY_NOW")==0) {
++ value = atoi(temp) / 1000;
++ snprintf(temp, sizeof(temp), "%i mWh", value);
++ strncpy(batt_info->Remaining_Cap, temp, 9);
++ }
++ else if (strcmp(attr,"POWER_SUPPLY_MODEL_NAME")==0) {
++ strncpy(batt_info->Model, temp, 12);
++ }
++ else if (strcmp(attr,"POWER_SUPPLY_SERIAL_NUMBER")==0) {
++ strncpy(batt_info->Serial, temp, 12);
++ }
++ else if (strcmp(attr,"POWER_SUPPLY_PRESENT")==0) {
++ if(strncmp(temp,"1",1)==0) {
++ batt_info->Battery_Present = 1;
++ }
++ else {
++ batt_info->Battery_Present = 0;
++ printf(" Battery is not present, bailing out. \n");
++ return 0;
++ }
++ }
+ }
++ if (strcmp(batt_info->Charge_Now,"")!=0 &&
++ strcmp(batt_info->Charge_Now,"unknown")!=0)
++ snprintf(temp, sizeof(temp), "%s mA", batt_info->Present_Rate);
+ else
+- strncpy(batt_info->Model, "unknown", 7);
++ snprintf(temp, sizeof(temp), "%s mW", batt_info->Present_Rate);
+
+- fgets(str, 100, power_fp);
++ strncpy(batt_info->Present_Rate, temp, 9);
+
+- /* get serial */
+- memset(str, '\0', 100);
+- fgets(str, 100, power_fp);
+- if (strlen(str)!=0)
+- {
+- memset(temp, '\0', 100);
+- sscanf(str, "%*[^=] %*c %s %[^\n]",temp);
+- strncpy(batt_info->Serial, temp, 12);
+- }
+- else
+- strncpy(batt_info->Serial, "unknown", 7);
+-
+ fclose(power_fp);
+- }
++ }
+ else // battery dir is readable but empty : only . and .. at most //
+ batt_info->Battery_Present = 3;
+ return 0;
diff --git a/sys-power/acpitool/files/acpitool-0.5.1-kernel3.patch b/sys-power/acpitool/files/acpitool-0.5.1-kernel3.patch
new file mode 100644
index 000000000000..cd793d2e1e67
--- /dev/null
+++ b/sys-power/acpitool/files/acpitool-0.5.1-kernel3.patch
@@ -0,0 +1,14 @@
+http://bugs.gentoo.org/377355
+
+--- src/acpitool.cpp
++++ src/acpitool.cpp
+@@ -205,8 +205,7 @@
+ Kernel_24 = 1;
+ Kernel_26 = 0;
+ }
+-
+- if(strncmp(str,"2.6",3)==0)
++ else
+ {
+ Kernel_24 = 0;
+ Kernel_26 = 1;
diff --git a/sys-power/acpitool/files/acpitool-0.5.1-wakeup.patch b/sys-power/acpitool/files/acpitool-0.5.1-wakeup.patch
new file mode 100644
index 000000000000..b36d7306bddf
--- /dev/null
+++ b/sys-power/acpitool/files/acpitool-0.5.1-wakeup.patch
@@ -0,0 +1,70 @@
+From 3a87a4132667f78fc85c54ad89992bbdd02d1e55 Mon Sep 17 00:00:00 2001
+From: Carlos Alberto Lopez Perez <clopez@igalia.com>
+Date: Thu, 6 Oct 2011 03:12:55 +0200
+Subject: [PATCH] Use dynamic structures instead of predefined ones
+
+ * The file /proc/acpi/wakeup can have much more than 25 entries.
+ In my computer (Dell E6420) I have 27 entries.
+ So instead of using an array of [x] entries better use dynamic
+ vectors and push the new entries when a new line from the file
+ is read.
+
+ * The name of the device is not ever 4 characters. For example I
+ have a device called "LID" which is 3 characters long.
+ Instead of using a fixed size for the device we split the line
+ on the first tab (\t) and use the first part.
+---
+ src/acpitool.cpp | 23 +++++++++++------------
+ 1 files changed, 11 insertions(+), 12 deletions(-)
+
+diff --git a/src/acpitool.cpp b/src/acpitool.cpp
+index 2a610a5..71e01d7 100644
+--- a/src/acpitool.cpp
++++ b/src/acpitool.cpp
+@@ -460,16 +460,14 @@ int Show_WakeUp_Devices(int verbose)
+
+ int Toggle_WakeUp_Device(const int Device, int verbose)
+ {
+- ifstream file_in;
+ ofstream file_out;
+- char *filename, str[50];
+- int index = 1;
+- char Name[25][5]; // 25 should be enough I guess, I have only 9 so far //
+-
++ char *filename; string str;
++ int index = 1; int charindex = 0;
++ std::vector <std::string> Name(index); // Never is enough, use dynamic structures //
+ filename = "/proc/acpi/wakeup";
+
+- file_in.open(filename);
+- if (!file_in)
++ ifstream file_in(filename, ifstream::in);
++ if (!file_in.good()) // if opening is not successful
+ {
+ if(!verbose)
+ {
+@@ -484,14 +482,15 @@ int Toggle_WakeUp_Device(const int Device, int verbose)
+ }
+ }
+
+- file_in.getline(str, 50); // first line are just headers //
++ getline(file_in, str); // first line are just headers //
+ while(!file_in.eof()) // count all devices and store their names//
+ {
+- file_in.getline(str, 50);
+- if(strlen(str)!=0) // avoid empty last line //
++ getline(file_in, str);
++ if( str.length() != 0 ) // avoid empty last line //
+ {
+- memset(Name[index], '\0', 5);
+- strncpy(Name[index], str, 4);
++ charindex = 0; // reset to zero
++ while ( (str[++charindex]!='\t') ); // stop on first tab and get the array index
++ Name.push_back(str.substr(0,charindex)); // Push the name into the vector
+ index++;
+ }
+ }
+--
+1.7.5.4
+
+
diff --git a/sys-power/acpitool/metadata.xml b/sys-power/acpitool/metadata.xml
new file mode 100644
index 000000000000..4538a68724a6
--- /dev/null
+++ b/sys-power/acpitool/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer><email>maintainer-needed@gentoo.org</email></maintainer>
+</pkgmetadata>
diff --git a/sys-power/apcupsd/Manifest b/sys-power/apcupsd/Manifest
new file mode 100644
index 000000000000..4758a56a4f13
--- /dev/null
+++ b/sys-power/apcupsd/Manifest
@@ -0,0 +1,3 @@
+DIST apcupsd-3.14.10.tar.gz 1336852 SHA256 0707b5ec9916fbde9e44eb8d18037c8d8f75dfd6aeef51aba5487e189eef2032 SHA512 f95918bff783cb60fa40b03a532ee7447293b0542f44f2f9ecf36ee028df3aa414f01e2b834a28fc319d88ec2e84c81314cd546b5628554176f2ca47fdc66bbc WHIRLPOOL 1fb40a5199eb8dfcd287bab08c2bbf51f02a3657ba615e16395d5f377bc9a5b6144db24b83ef5e9172ff970a715f87f685118a035c00372c34702984fac02d38
+DIST apcupsd-3.14.12.tar.gz 2014699 SHA256 1b4f703cb19cfdf44daf173dc8394cafd30fee0b30a0c75a7d19db622454a440 SHA512 2ed409ce4c7c7af667cecf0c73c47315d7516c696383c811945ead720afc146fe2ceda0efef722c3208a1b41a7d4661c9544bc4fe37a36ca4779a5dc1621f3d4 WHIRLPOOL 13a2491e4ad5446ba91a075f7408e48e94a35885288c9ee6108891d89412be5c81f69f4ab5064f86b8bece8c0de44357e4c378d05aad5d9d27bd85f0d95a83d5
+DIST apcupsd-3.14.8.tar.gz 1317601 SHA256 8e7f2574d3abaf6637da3e790860c3f9ba64fab1ec7e50bb080de4439441c5a7 SHA512 07e6a15538bf1824b5063a1a93f33231639cf962e658c0dada1b244f2554af81824825d807ea81fd0388e25ed8fac0957621bfded96e3faeb7b594548fc4d418 WHIRLPOOL e5a580afc4955a373f020cb6e4ccbf07f9f020d4c15eaae59b416499c25a00b9d4bbc6af012bd2529024e8a3668a1d7c47f19f1bcb99f5ba60dc0108fa13c4f2
diff --git a/sys-power/apcupsd/apcupsd-3.14.10-r6.ebuild b/sys-power/apcupsd/apcupsd-3.14.10-r6.ebuild
new file mode 100644
index 000000000000..a3419b5fdd69
--- /dev/null
+++ b/sys-power/apcupsd/apcupsd-3.14.10-r6.ebuild
@@ -0,0 +1,144 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit eutils linux-info flag-o-matic systemd udev
+
+DESCRIPTION="APC UPS daemon with integrated tcp/ip remote shutdown"
+HOMEPAGE="http://www.apcupsd.org/"
+SRC_URI="mirror://sourceforge/apcupsd/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~x86 ~x86-fbsd"
+IUSE="snmp +usb cgi nls gnome kernel_linux systemd"
+
+DEPEND="
+ || ( >=sys-apps/util-linux-2.23[tty-helpers(-)]
+ <=sys-apps/sysvinit-2.88-r4
+ sys-freebsd/freebsd-ubin
+ )
+ cgi? ( >=media-libs/gd-1.8.4 )
+ nls? ( sys-devel/gettext )
+ snmp? ( >=net-analyzer/net-snmp-5.7.2 )
+ gnome? ( >=x11-libs/gtk+-2.4.0:2
+ dev-libs/glib:2
+ >=gnome-base/gconf-2.0 )"
+RDEPEND="${DEPEND}
+ sys-apps/openrc
+ virtual/mailx"
+
+CONFIG_CHECK="~USB_HIDDEV ~HIDRAW"
+ERROR_USB_HIDDEV="CONFIG_USB_HIDDEV: needed to access USB-attached UPSes"
+ERROR_HIDRAW="CONFIG_HIDRAW: needed to access USB-attached UPSes"
+
+pkg_setup() {
+ if use kernel_linux && use usb && linux_config_exists; then
+ check_extra_config
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-3.14.9-aliasing.patch"
+ if use snmp; then
+ epatch "${FILESDIR}/${PN}-snmp-5.7.2.patch"
+ fi
+}
+
+src_configure() {
+ local myconf
+ use cgi && myconf="${myconf} --enable-cgi --with-cgi-bin=/usr/libexec/${PN}/cgi-bin"
+ if use usb; then
+ myconf="${myconf} --with-upstype=usb --with-upscable=usb --enable-usb --with-dev= "
+ else
+ myconf="${myconf} --with-upstype=apcsmart --with-upscable=smart --disable-usb"
+ fi
+
+ # We force the DISTNAME to gentoo so it will use gentoo's layout also
+ # when installed on non-linux systems.
+ econf \
+ --sbindir=/sbin \
+ --sysconfdir=/etc/apcupsd \
+ --with-pwrfail-dir=/etc/apcupsd \
+ --with-lock-dir=/run/apcupsd \
+ --with-pid-dir=/run/apcupsd \
+ --with-log-dir=/var/log \
+ --with-nis-port=3551 \
+ --enable-net --enable-pcnet \
+ --with-distname=gentoo \
+ $(use_enable snmp net-snmp) \
+ $(use_enable gnome gapcmon) \
+ ${myconf} \
+ APCUPSD_MAIL=/bin/mail
+}
+
+src_compile() {
+ # Workaround for bug #280674; upstream should really just provide
+ # the text files in the distribution, but I wouldn't count on them
+ # doing that anytime soon.
+ MANPAGER=$(type -p cat) \
+ emake || die "emake failed"
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "installed failed"
+ rm -f "${D}"/etc/init.d/halt
+
+ insinto /etc/apcupsd
+ newins examples/safe.apccontrol safe.apccontrol
+ doins "${FILESDIR}"/apcupsd.conf
+
+ dodoc ChangeLog* ReleaseNotes
+ doman doc/*.8 doc/*.5
+
+ dohtml -r doc/manual/*
+
+ rm "${D}"/etc/init.d/apcupsd
+ newinitd "${FILESDIR}/${PN}.init.4" "${PN}"
+ newinitd "${FILESDIR}/${PN}.powerfail.init" "${PN}".powerfail
+
+ if use systemd; then
+ systemd_dounit "${FILESDIR}"/${PN}.service
+ systemd_dotmpfilesd "${FILESDIR}"/${PN}-tmpfiles.conf
+ fi
+
+ # remove hal settings, we don't really want to have it around still.
+ rm -r "${D}"/usr/share/hal
+
+ # replace it with our udev rules if we're in Linux
+ if use kernel_linux; then
+ udev_newrules "${FILESDIR}"/apcupsd-udev.rules 60-${PN}.rules
+ fi
+
+}
+
+pkg_postinst() {
+ if use cgi; then
+ elog "The cgi-bin directory for ${PN} is /usr/libexec/${PN}/cgi-bin."
+ elog "Set up your ScriptAlias or symbolic links accordingly."
+ fi
+
+ elog ""
+ elog "Since version 3.14.0 you can use multiple apcupsd instances to"
+ elog "control more than one UPS in a single box with openRC."
+ elog "To do this, create a link between /etc/init.d/apcupsd to a new"
+ elog "/etc/init.d/apcupsd.something, and it will then load the"
+ elog "configuration file at /etc/apcupsd/something.conf."
+ elog ""
+
+ elog 'If you want apcupsd to power off your UPS when it'
+ elog 'shuts down your system in a power failure, you must'
+ elog 'add apcupsd.powerfail to your shutdown runlevel:'
+ elog ''
+ elog ' \e[01m rc-update add apcupsd.powerfail shutdown \e[0m'
+ elog ''
+
+ if use kernel_linux; then
+ elog "Starting from version 3.14.9-r1, ${PN} installs udev rules"
+ elog "for persistent device naming. If you have multiple UPS"
+ elog "connected to the machine, you can point them to the devices"
+ elog "in /dev/apcups/by-id directory."
+ fi
+}
diff --git a/sys-power/apcupsd/apcupsd-3.14.12-r1.ebuild b/sys-power/apcupsd/apcupsd-3.14.12-r1.ebuild
new file mode 100644
index 000000000000..75d43a778e5a
--- /dev/null
+++ b/sys-power/apcupsd/apcupsd-3.14.12-r1.ebuild
@@ -0,0 +1,139 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit eutils linux-info flag-o-matic systemd udev
+
+DESCRIPTION="APC UPS daemon with integrated tcp/ip remote shutdown"
+HOMEPAGE="http://www.apcupsd.org/"
+SRC_URI="mirror://sourceforge/apcupsd/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~x86 ~x86-fbsd"
+IUSE="snmp +usb cgi nls gnome kernel_linux"
+
+DEPEND="
+ || ( >=sys-apps/util-linux-2.23[tty-helpers(-)]
+ <=sys-apps/sysvinit-2.88-r4
+ sys-freebsd/freebsd-ubin
+ )
+ cgi? ( >=media-libs/gd-1.8.4 )
+ nls? ( sys-devel/gettext )
+ snmp? ( >=net-analyzer/net-snmp-5.7.2 )
+ gnome? ( >=x11-libs/gtk+-2.4.0:2
+ dev-libs/glib:2
+ >=gnome-base/gconf-2.0 )"
+RDEPEND="${DEPEND}
+ sys-apps/openrc
+ virtual/mailx"
+
+CONFIG_CHECK="~USB_HIDDEV ~HIDRAW"
+ERROR_USB_HIDDEV="CONFIG_USB_HIDDEV: needed to access USB-attached UPSes"
+ERROR_HIDRAW="CONFIG_HIDRAW: needed to access USB-attached UPSes"
+
+pkg_setup() {
+ if use kernel_linux && use usb && linux_config_exists; then
+ check_extra_config
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-3.14.9-aliasing.patch"
+}
+
+src_configure() {
+ local myconf
+ use cgi && myconf="${myconf} --enable-cgi --with-cgi-bin=/usr/libexec/${PN}/cgi-bin"
+ if use usb; then
+ myconf="${myconf} --with-upstype=usb --with-upscable=usb --enable-usb --with-dev= "
+ else
+ myconf="${myconf} --with-upstype=apcsmart --with-upscable=smart --disable-usb"
+ fi
+
+ # We force the DISTNAME to gentoo so it will use gentoo's layout also
+ # when installed on non-linux systems.
+ econf \
+ --sbindir=/sbin \
+ --sysconfdir=/etc/apcupsd \
+ --with-pwrfail-dir=/etc/apcupsd \
+ --with-lock-dir=/run/apcupsd \
+ --with-pid-dir=/run/apcupsd \
+ --with-log-dir=/var/log \
+ --with-nis-port=3551 \
+ --enable-net --enable-pcnet \
+ --with-distname=gentoo \
+ $(use_enable snmp net-snmp) \
+ $(use_enable gnome gapcmon) \
+ ${myconf} \
+ APCUPSD_MAIL=/bin/mail
+}
+
+src_compile() {
+ # Workaround for bug #280674; upstream should really just provide
+ # the text files in the distribution, but I wouldn't count on them
+ # doing that anytime soon.
+ MANPAGER=$(type -p cat) \
+ emake || die "emake failed"
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "installed failed"
+ rm -f "${D}"/etc/init.d/halt
+
+ insinto /etc/apcupsd
+ newins examples/safe.apccontrol safe.apccontrol
+ doins "${FILESDIR}"/apcupsd.conf
+
+ dodoc ChangeLog* ReleaseNotes
+ doman doc/*.8 doc/*.5
+
+ dohtml -r doc/manual/*
+
+ rm "${D}"/etc/init.d/apcupsd
+ newinitd "${FILESDIR}/${PN}.init.4" "${PN}"
+ newinitd "${FILESDIR}/${PN}.powerfail.init" "${PN}".powerfail
+
+ systemd_dounit "${FILESDIR}"/${PN}.service
+ systemd_dotmpfilesd "${FILESDIR}"/${PN}-tmpfiles.conf
+
+ # remove hal settings, we don't really want to have it around still.
+ rm -r "${D}"/usr/share/hal
+
+ # replace it with our udev rules if we're in Linux
+ if use kernel_linux; then
+ udev_newrules "${FILESDIR}"/apcupsd-udev.rules 60-${PN}.rules
+ fi
+
+}
+
+pkg_postinst() {
+ if use cgi; then
+ elog "The cgi-bin directory for ${PN} is /usr/libexec/${PN}/cgi-bin."
+ elog "Set up your ScriptAlias or symbolic links accordingly."
+ fi
+
+ elog ""
+ elog "Since version 3.14.0 you can use multiple apcupsd instances to"
+ elog "control more than one UPS in a single box with openRC."
+ elog "To do this, create a link between /etc/init.d/apcupsd to a new"
+ elog "/etc/init.d/apcupsd.something, and it will then load the"
+ elog "configuration file at /etc/apcupsd/something.conf."
+ elog ""
+
+ elog 'If you want apcupsd to power off your UPS when it'
+ elog 'shuts down your system in a power failure, you must'
+ elog 'add apcupsd.powerfail to your shutdown runlevel:'
+ elog ''
+ elog ' \e[01m rc-update add apcupsd.powerfail shutdown \e[0m'
+ elog ''
+
+ if use kernel_linux; then
+ elog "Starting from version 3.14.9-r1, ${PN} installs udev rules"
+ elog "for persistent device naming. If you have multiple UPS"
+ elog "connected to the machine, you can point them to the devices"
+ elog "in /dev/apcups/by-id directory."
+ fi
+}
diff --git a/sys-power/apcupsd/apcupsd-3.14.12.ebuild b/sys-power/apcupsd/apcupsd-3.14.12.ebuild
new file mode 100644
index 000000000000..f0f27fde190a
--- /dev/null
+++ b/sys-power/apcupsd/apcupsd-3.14.12.ebuild
@@ -0,0 +1,142 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit eutils linux-info flag-o-matic systemd udev
+
+DESCRIPTION="APC UPS daemon with integrated tcp/ip remote shutdown"
+HOMEPAGE="http://www.apcupsd.org/"
+SRC_URI="mirror://sourceforge/apcupsd/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~x86 ~x86-fbsd"
+IUSE="snmp +usb cgi nls gnome kernel_linux"
+
+DEPEND="
+ || ( >=sys-apps/util-linux-2.23[tty-helpers(-)]
+ <=sys-apps/sysvinit-2.88-r4
+ sys-freebsd/freebsd-ubin
+ )
+ cgi? ( >=media-libs/gd-1.8.4 )
+ nls? ( sys-devel/gettext )
+ snmp? ( >=net-analyzer/net-snmp-5.7.2 )
+ gnome? ( >=x11-libs/gtk+-2.4.0:2
+ dev-libs/glib:2
+ >=gnome-base/gconf-2.0 )"
+RDEPEND="${DEPEND}
+ sys-apps/openrc
+ virtual/mailx"
+
+CONFIG_CHECK="~USB_HIDDEV ~HIDRAW"
+ERROR_USB_HIDDEV="CONFIG_USB_HIDDEV: needed to access USB-attached UPSes"
+ERROR_HIDRAW="CONFIG_HIDRAW: needed to access USB-attached UPSes"
+
+pkg_setup() {
+ if use kernel_linux && use usb && linux_config_exists; then
+ check_extra_config
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-3.14.9-aliasing.patch"
+ if use snmp; then
+ epatch "${FILESDIR}/${PN}-snmp-5.7.2.patch"
+ fi
+}
+
+src_configure() {
+ local myconf
+ use cgi && myconf="${myconf} --enable-cgi --with-cgi-bin=/usr/libexec/${PN}/cgi-bin"
+ if use usb; then
+ myconf="${myconf} --with-upstype=usb --with-upscable=usb --enable-usb --with-dev= "
+ else
+ myconf="${myconf} --with-upstype=apcsmart --with-upscable=smart --disable-usb"
+ fi
+
+ # We force the DISTNAME to gentoo so it will use gentoo's layout also
+ # when installed on non-linux systems.
+ econf \
+ --sbindir=/sbin \
+ --sysconfdir=/etc/apcupsd \
+ --with-pwrfail-dir=/etc/apcupsd \
+ --with-lock-dir=/run/apcupsd \
+ --with-pid-dir=/run/apcupsd \
+ --with-log-dir=/var/log \
+ --with-nis-port=3551 \
+ --enable-net --enable-pcnet \
+ --with-distname=gentoo \
+ $(use_enable snmp net-snmp) \
+ $(use_enable gnome gapcmon) \
+ ${myconf} \
+ APCUPSD_MAIL=/bin/mail
+}
+
+src_compile() {
+ # Workaround for bug #280674; upstream should really just provide
+ # the text files in the distribution, but I wouldn't count on them
+ # doing that anytime soon.
+ MANPAGER=$(type -p cat) \
+ emake || die "emake failed"
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "installed failed"
+ rm -f "${D}"/etc/init.d/halt
+
+ insinto /etc/apcupsd
+ newins examples/safe.apccontrol safe.apccontrol
+ doins "${FILESDIR}"/apcupsd.conf
+
+ dodoc ChangeLog* ReleaseNotes
+ doman doc/*.8 doc/*.5
+
+ dohtml -r doc/manual/*
+
+ rm "${D}"/etc/init.d/apcupsd
+ newinitd "${FILESDIR}/${PN}.init.4" "${PN}"
+ newinitd "${FILESDIR}/${PN}.powerfail.init" "${PN}".powerfail
+
+ systemd_dounit "${FILESDIR}"/${PN}.service
+ systemd_dotmpfilesd "${FILESDIR}"/${PN}-tmpfiles.conf
+
+ # remove hal settings, we don't really want to have it around still.
+ rm -r "${D}"/usr/share/hal
+
+ # replace it with our udev rules if we're in Linux
+ if use kernel_linux; then
+ udev_newrules "${FILESDIR}"/apcupsd-udev.rules 60-${PN}.rules
+ fi
+
+}
+
+pkg_postinst() {
+ if use cgi; then
+ elog "The cgi-bin directory for ${PN} is /usr/libexec/${PN}/cgi-bin."
+ elog "Set up your ScriptAlias or symbolic links accordingly."
+ fi
+
+ elog ""
+ elog "Since version 3.14.0 you can use multiple apcupsd instances to"
+ elog "control more than one UPS in a single box with openRC."
+ elog "To do this, create a link between /etc/init.d/apcupsd to a new"
+ elog "/etc/init.d/apcupsd.something, and it will then load the"
+ elog "configuration file at /etc/apcupsd/something.conf."
+ elog ""
+
+ elog 'If you want apcupsd to power off your UPS when it'
+ elog 'shuts down your system in a power failure, you must'
+ elog 'add apcupsd.powerfail to your shutdown runlevel:'
+ elog ''
+ elog ' \e[01m rc-update add apcupsd.powerfail shutdown \e[0m'
+ elog ''
+
+ if use kernel_linux; then
+ elog "Starting from version 3.14.9-r1, ${PN} installs udev rules"
+ elog "for persistent device naming. If you have multiple UPS"
+ elog "connected to the machine, you can point them to the devices"
+ elog "in /dev/apcups/by-id directory."
+ fi
+}
diff --git a/sys-power/apcupsd/apcupsd-3.14.8-r2.ebuild b/sys-power/apcupsd/apcupsd-3.14.8-r2.ebuild
new file mode 100644
index 000000000000..d1744af862bd
--- /dev/null
+++ b/sys-power/apcupsd/apcupsd-3.14.8-r2.ebuild
@@ -0,0 +1,134 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=3
+
+inherit eutils linux-info flag-o-matic systemd
+
+DESCRIPTION="APC UPS daemon with integrated tcp/ip remote shutdown"
+HOMEPAGE="http://www.apcupsd.org/"
+SRC_URI="mirror://sourceforge/apcupsd/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86 ~x86-fbsd"
+IUSE="snmp +usb cgi nls gnome kernel_linux"
+
+DEPEND="
+ || ( >=sys-apps/util-linux-2.23[tty-helpers]
+ <=sys-apps/sysvinit-2.88-r4
+ sys-freebsd/freebsd-ubin
+ )
+ cgi? ( >=media-libs/gd-1.8.4 )
+ nls? ( sys-devel/gettext )
+ snmp? ( net-analyzer/net-snmp )
+ gnome? ( >=x11-libs/gtk+-2.4.0:2
+ dev-libs/glib:2
+ >=gnome-base/gconf-2.0 )"
+RDEPEND="${DEPEND}
+ virtual/mailx"
+
+CONFIG_CHECK="~USB_HIDDEV ~HIDRAW"
+ERROR_USB_HIDDEV="CONFIG_USB_HIDDEV: needed to access USB-attached UPSes"
+ERROR_HIDRAW="CONFIG_HIDRAW: needed to access USB-attached UPSes"
+
+pkg_setup() {
+ if use kernel_linux && use usb && linux_config_exists; then
+ check_extra_config
+ fi
+}
+
+src_configure() {
+ local myconf
+ use cgi && myconf="${myconf} --enable-cgi --with-cgi-bin=/usr/libexec/${PN}/cgi-bin"
+ if use usb; then
+ myconf="${myconf} --with-upstype=usb --with-upscable=usb --enable-usb --with-dev= "
+ else
+ myconf="${myconf} --with-upstype=apcsmart --with-upscable=smart --disable-usb"
+ fi
+
+ append-flags -fno-strict-aliasing
+
+ # We force the DISTNAME to gentoo so it will use gentoo's layout also
+ # when installed on non-linux systems.
+ econf \
+ --sbindir=/sbin \
+ --sysconfdir=/etc/apcupsd \
+ --with-pwrfail-dir=/etc/apcupsd \
+ --with-lock-dir=/var/lock \
+ --with-pid-dir=/var/run \
+ --with-log-dir=/var/log \
+ --with-nis-port=3551 \
+ --enable-net --enable-pcnet \
+ --with-distname=gentoo \
+ $(use_enable snmp net-snmp) \
+ $(use_enable gnome gapcmon) \
+ ${myconf} \
+ APCUPSD_MAIL=/bin/mail \
+ || die "econf failed"
+}
+
+src_compile() {
+ # Workaround for bug #280674; upstream should really just provide
+ # the text files in the distribution, but I wouldn't count on them
+ # doing that anytime soon.
+ MANPAGER=$(type -p cat) \
+ emake || die "emake failed"
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "installed failed"
+ rm -f "${D}"/etc/init.d/halt
+
+ insinto /etc/apcupsd
+ newins examples/safe.apccontrol safe.apccontrol
+
+ dodoc ChangeLog* ReleaseNotes
+ doman doc/*.8 doc/*.5 || die "doman failed"
+
+ dohtml -r doc/manual/* || die "dodoc failed"
+
+ rm "${D}"/etc/init.d/apcupsd
+ newinitd "${FILESDIR}/${PN}.init.2a" "${PN}" || die "newinitd failed"
+ systemd_dounit "${FILESDIR}"/${PN}.service
+ systemd_dotmpfilesd "${FILESDIR}"/${PN}-tmpfiles.conf
+
+ if has_version sys-apps/openrc; then
+ newinitd "${FILESDIR}/${PN}.powerfail.init" "${PN}".powerfail || die "newinitd failed"
+ fi
+
+ # remove hal settings, we don't really want to have it around still.
+ rm -r "${D}"/usr/share/hal
+
+ # Without this it'll crash at startup. When merging in ROOT= this
+ # won't be created by default, so we want to make sure we got it!
+ keepdir /var/lock
+ fowners root:uucp /var/lock
+ fperms 0775 /var/lock
+}
+
+pkg_postinst() {
+ if use cgi; then
+ elog "The cgi-bin directory for ${PN} is /usr/libexec/${PN}/cgi-bin."
+ elog "Set up your ScriptAlias or symbolic links accordingly."
+ fi
+
+ elog ""
+ elog "Since version 3.14.0 you can use multiple apcupsd instances to"
+ elog "control more than one UPS in a single box."
+ elog "To do this, create a link between /etc/init.d/apcupsd to a new"
+ elog "/etc/init.d/apcupsd.something, and it will then load the"
+ elog "configuration file at /etc/apcupsd/something.conf."
+ elog ""
+
+ if [ -d "${ROOT}"/etc/runlevels/shutdown -a \
+ ! -e "${ROOT}"/etc/runlevels/shutdown/"${PN}".powerfail ] ; then
+ elog 'If you want apcupsd to power off your UPS when it'
+ elog 'shuts down your system in a power failure, you must'
+ elog 'add apcupsd.powerfail to your shutdown runlevel:'
+ elog ''
+ elog ' \e[01m rc-update add apcupsd.powerfail shutdown \e[0m'
+ elog ''
+ fi
+}
diff --git a/sys-power/apcupsd/files/apcupsd-3.14.9-aliasing.patch b/sys-power/apcupsd/files/apcupsd-3.14.9-aliasing.patch
new file mode 100644
index 000000000000..09d9883a22f2
--- /dev/null
+++ b/sys-power/apcupsd/files/apcupsd-3.14.9-aliasing.patch
@@ -0,0 +1,39 @@
+Index: apcupsd-3.14.9/src/apctest.c
+===================================================================
+--- apcupsd-3.14.9.orig/src/apctest.c
++++ apcupsd-3.14.9/src/apctest.c
+@@ -2206,18 +2206,18 @@ static struct {
+ const char *config_directive;
+ const char *descript;
+ char type;
+- int *data;
++ void *data;
+ } cmd_table[] = {
+ {'u', "HITRANSFER", "Upper transfer voltage", 'i', &eeprom_ups.hitrans},
+ {'l', "LOTRANSFER", "Lower transfer voltage", 'i', &eeprom_ups.lotrans},
+ {'e', "RETURNCHARGE", "Return threshold", 'i', &eeprom_ups.rtnpct},
+ {'o', "OUTPUTVOLTS", "Output voltage on batts", 'i', &eeprom_ups.NomOutputVoltage},
+- {'s', "SENSITIVITY", "Sensitivity", 'c', (int *)eeprom_ups.sensitivity},
++ {'s', "SENSITIVITY", "Sensitivity", 'c', eeprom_ups.sensitivity},
+ {'q', "LOWBATT", "Low battery warning", 'i', &eeprom_ups.dlowbatt},
+ {'p', "SLEEP", "Shutdown grace delay", 'i', &eeprom_ups.dshutd},
+- {'k', "BEEPSTATE", "Alarm delay", 'c', (int *)eeprom_ups.beepstate},
++ {'k', "BEEPSTATE", "Alarm delay", 'c', eeprom_ups.beepstate},
+ {'r', "WAKEUP", "Wakeup delay", 'i', &eeprom_ups.dwake},
+- {'E', "SELFTEST", "Self test interval", 'c', (int *)eeprom_ups.selftest},
++ {'E', "SELFTEST", "Self test interval", 'c', eeprom_ups.selftest},
+ {0, NULL, NULL} /* Last entry */
+ };
+
+@@ -2240,9 +2240,9 @@ static void print_valid_eeprom_values(UP
+ for (j = 0; cmd_table[j].cmd; j++) {
+ if (cmd[i].cmd == cmd_table[j].cmd) {
+ if (cmd_table[j].type == 'c')
+- asnprintf(val, sizeof(val), "%s", (char *)cmd_table[j].data);
++ asnprintf(val, sizeof(val), "%s", cmd_table[j].data);
+ else
+- asnprintf(val, sizeof(val), "%d", *cmd_table[j].data);
++ asnprintf(val, sizeof(val), "%d", *((int*)cmd_table[j].data));
+
+ pmsg("%-24s %-12s %-6s ", cmd_table[j].descript,
+ cmd_table[j].config_directive, val);
diff --git a/sys-power/apcupsd/files/apcupsd-snmp-5.7.2.patch b/sys-power/apcupsd/files/apcupsd-snmp-5.7.2.patch
new file mode 100644
index 000000000000..aaa618bbab90
--- /dev/null
+++ b/sys-power/apcupsd/files/apcupsd-snmp-5.7.2.patch
@@ -0,0 +1,104 @@
+--- src/drivers/snmp/snmp.c~ 2007-10-06 15:52:52.000000000 +0100
++++ src/drivers/snmp/snmp.c 2012-08-09 11:22:30.100725543 +0100
+@@ -140,26 +140,26 @@
+
+ if (!strcmp(Sid->DeviceVendor, "APC") ||
+ !strcmp(Sid->DeviceVendor, "APC_NOTRAP")) {
+- Sid->MIB = malloc(sizeof(powernet_mib_t));
+- if (Sid->MIB == NULL) {
++ Sid->mib = malloc(sizeof(powernet_mib_t));
++ if (Sid->mib == NULL) {
+ log_event(ups, LOG_ERR, "Out of memory.");
+ exit(1);
+ }
+
+- memset(Sid->MIB, 0, sizeof(powernet_mib_t));
++ memset(Sid->mib, 0, sizeof(powernet_mib_t));
+
+ /* Run powernet specific init */
+ return powernet_snmp_ups_open(ups);
+ }
+
+ if (!strcmp(Sid->DeviceVendor, "RFC")) {
+- Sid->MIB = malloc(sizeof(ups_mib_t));
+- if (Sid->MIB == NULL) {
++ Sid->mib = malloc(sizeof(ups_mib_t));
++ if (Sid->mib == NULL) {
+ log_event(ups, LOG_ERR, "Out of memory.");
+ exit(1);
+ }
+
+- memset(Sid->MIB, 0, sizeof(ups_mib_t));
++ memset(Sid->mib, 0, sizeof(ups_mib_t));
+ return 1;
+ }
+
+--- src/drivers/snmp/drv_rfc1628.c~ 2012-08-09 11:18:56.001810234 +0100
++++ src/drivers/snmp/drv_rfc1628.c 2012-08-09 11:19:08.845988048 +0100
+@@ -32,7 +32,7 @@
+ struct snmp_ups_internal_data *Sid =
+ (struct snmp_ups_internal_data *)ups->driver_internal_data;
+ struct snmp_session *s = &Sid->session;
+- ups_mib_t *data = (ups_mib_t *)Sid->MIB;
++ ups_mib_t *data = (ups_mib_t *)Sid->mib;
+
+ /*
+ * Check the Ethernet COMMLOST first, then check the
+@@ -76,7 +76,7 @@
+ struct snmp_ups_internal_data *Sid =
+ (struct snmp_ups_internal_data *)ups->driver_internal_data;
+ struct snmp_session *s = &Sid->session;
+- ups_mib_t *data = (ups_mib_t *)Sid->MIB;
++ ups_mib_t *data = (ups_mib_t *)Sid->mib;
+
+ if (rfc_1628_check_alarms(ups) == 0) {
+ return 0;
+@@ -98,7 +98,7 @@
+ struct snmp_ups_internal_data *Sid =
+ (struct snmp_ups_internal_data *)ups->driver_internal_data;
+ struct snmp_session *s = &Sid->session;
+- ups_mib_t *data = (ups_mib_t *)Sid->MIB;
++ ups_mib_t *data = (ups_mib_t *)Sid->mib;
+
+ if (rfc_1628_check_alarms(ups) == 0) {
+ return 0;
+--- src/drivers/snmp/snmp.h~ 2007-10-06 15:52:52.000000000 +0100
++++ src/drivers/snmp/snmp.h 2012-08-09 11:17:43.988802514 +0100
+@@ -79,7 +79,7 @@
+ unsigned short remote_port; /* Remote socket, usually 161 */
+ char *DeviceVendor; /* Vendor (ex. APC|RFC) */
+ char *community; /* Community name */
+- void *MIB; /* Pointer to MIB data */
++ void *mib; /* Pointer to MIB data */
+ struct snmp_session *trap_session; /* snmp session for traps */
+ bool trap_received; /* Have we seen a trap? */
+ };
+--- src/drivers/snmp/drv_powernet.c~ 2010-01-02 21:28:28.000000000 +0000
++++ src/drivers/snmp/drv_powernet.c 2012-08-09 11:20:04.970761477 +0100
+@@ -34,7 +34,7 @@
+ struct snmp_ups_internal_data *Sid =
+ (struct snmp_ups_internal_data *)ups->driver_internal_data;
+ struct snmp_session *s = &Sid->session;
+- powernet_mib_t *data = (powernet_mib_t *)Sid->MIB;
++ powernet_mib_t *data = (powernet_mib_t *)Sid->mib;
+ int ret = 1;
+
+ /*
+@@ -161,7 +161,7 @@
+ struct snmp_ups_internal_data *Sid =
+ (struct snmp_ups_internal_data *)ups->driver_internal_data;
+ struct snmp_session *s = &Sid->session;
+- powernet_mib_t *data = (powernet_mib_t *)Sid->MIB;
++ powernet_mib_t *data = (powernet_mib_t *)Sid->mib;
+
+ if (powernet_check_comm_lost(ups) == 0)
+ return 0;
+@@ -300,7 +300,7 @@
+ struct snmp_ups_internal_data *Sid =
+ (struct snmp_ups_internal_data *)ups->driver_internal_data;
+ struct snmp_session *s = &Sid->session;
+- powernet_mib_t *data = (powernet_mib_t *)Sid->MIB;
++ powernet_mib_t *data = (powernet_mib_t *)Sid->mib;
+
+ if (powernet_check_comm_lost(ups) == 0)
+ return 0;
diff --git a/sys-power/apcupsd/files/apcupsd-tmpfiles.conf b/sys-power/apcupsd/files/apcupsd-tmpfiles.conf
new file mode 100644
index 000000000000..601b5aeab5ef
--- /dev/null
+++ b/sys-power/apcupsd/files/apcupsd-tmpfiles.conf
@@ -0,0 +1,3 @@
+D /run/apcupsd 0755 root root
+r /etc/apcupsd/powerfail
+r /etc/nologin
diff --git a/sys-power/apcupsd/files/apcupsd-udev.rules b/sys-power/apcupsd/files/apcupsd-udev.rules
new file mode 100644
index 000000000000..b2eeb27302d8
--- /dev/null
+++ b/sys-power/apcupsd/files/apcupsd-udev.rules
@@ -0,0 +1,10 @@
+# do not edit this file, it will be overwritten on update
+
+ACTION!="add", GOTO="apcupsd_end"
+SUBSYSTEM!="usb", GOTO="apcupsd_end"
+ENV{ID_VENDOR}=="", IMPORT{program}="usb_id --export %p"
+ENV{ID_VENDOR_ID}!="051d", GOTO="apcupsd_end"
+
+KERNEL=="?*", SYMLINK+="apcups/by-id/$env{ID_BUS}-$env{ID_SERIAL_SHORT}"
+
+LABEL="apcupsd_end"
diff --git a/sys-power/apcupsd/files/apcupsd.conf b/sys-power/apcupsd/files/apcupsd.conf
new file mode 100644
index 000000000000..83201f3c2b14
--- /dev/null
+++ b/sys-power/apcupsd/files/apcupsd.conf
@@ -0,0 +1,329 @@
+## apcupsd.conf v1.1 ##
+#
+# for apcupsd release 3.14.10 (13 September 2011) - gentoo
+#
+# "apcupsd" POSIX config file
+
+#
+# ========= General configuration parameters ============
+#
+
+# UPSNAME xxx
+# Use this to give your UPS a name in log files and such. This
+# is particulary useful if you have multiple UPSes. This does not
+# set the EEPROM. It should be 8 characters or less.
+#UPSNAME
+
+# UPSCABLE <cable>
+# Defines the type of cable connecting the UPS to your computer.
+#
+# Possible generic choices for <cable> are:
+# simple, smart, ether, usb
+#
+# Or a specific cable model number may be used:
+# 940-0119A, 940-0127A, 940-0128A, 940-0020B,
+# 940-0020C, 940-0023A, 940-0024B, 940-0024C,
+# 940-1524C, 940-0024G, 940-0095A, 940-0095B,
+# 940-0095C, M-04-02-2000
+#
+UPSCABLE usb
+
+# To get apcupsd to work, in addition to defining the cable
+# above, you must also define a UPSTYPE, which corresponds to
+# the type of UPS you have (see the Description for more details).
+# You must also specify a DEVICE, sometimes referred to as a port.
+# For USB UPSes, please leave the DEVICE directive blank. For
+# other UPS types, you must specify an appropriate port or address.
+#
+# UPSTYPE DEVICE Description
+# apcsmart /dev/tty** Newer serial character device, appropriate for
+# SmartUPS models using a serial cable (not USB).
+#
+# usb <BLANK> Most new UPSes are USB. A blank DEVICE
+# setting enables autodetection, which is
+# the best choice for most installations.
+#
+# net hostname:port Network link to a master apcupsd through apcupsd's
+# Network Information Server. This is used if the
+# UPS powering your computer is connected to a
+# different computer for monitoring.
+#
+# snmp hostname:port:vendor:community
+# SNMP network link to an SNMP-enabled UPS device.
+# Hostname is the ip address or hostname of the UPS
+# on the network. Vendor can be can be "APC" or
+# "APC_NOTRAP". "APC_NOTRAP" will disable SNMP trap
+# catching; you usually want "APC". Port is usually
+# 161. Community is usually "private".
+#
+# netsnmp hostname:port:vendor:community
+# OBSOLETE
+# Same as SNMP above but requires use of the
+# net-snmp library. Unless you have a specific need
+# for this old driver, you should use 'snmp' instead.
+#
+# dumb /dev/tty** Old serial character device for use with
+# simple-signaling UPSes.
+#
+# pcnet ipaddr:username:passphrase:port
+# PowerChute Network Shutdown protocol which can be
+# used as an alternative to SNMP with the AP9617
+# family of smart slot cards. ipaddr is the IP
+# address of the UPS management card. username and
+# passphrase are the credentials for which the card
+# has been configured. port is the port number on
+# which to listen for messages from the UPS, normally
+# 3052. If this parameter is empty or missing, the
+# default of 3052 will be used.
+#
+UPSTYPE usb
+DEVICE
+
+# POLLTIME <int>
+# Interval (in seconds) at which apcupsd polls the UPS for status. This
+# setting applies both to directly-attached UPSes (UPSTYPE apcsmart, usb,
+# dumb) and networked UPSes (UPSTYPE net, snmp). Lowering this setting
+# will improve apcupsd's responsiveness to certain events at the cost of
+# higher CPU utilization. The default of 60 is appropriate for most
+# situations.
+POLLTIME 30
+
+# LOCKFILE <path to lockfile>
+# Path for device lock file. Not used on Win32.
+LOCKFILE /run/apcupsd
+
+# SCRIPTDIR <path to script directory>
+# Directory in which apccontrol and event scripts are located.
+SCRIPTDIR /etc/apcupsd
+
+# PWRFAILDIR <path to powerfail directory>
+# Directory in which to write the powerfail flag file. This file
+# is created when apcupsd initiates a system shutdown and is
+# checked in the OS halt scripts to determine if a killpower
+# (turning off UPS output power) is required.
+PWRFAILDIR /etc/apcupsd
+
+# NOLOGINDIR <path to nologin directory>
+# Directory in which to write the nologin file. The existence
+# of this flag file tells the OS to disallow new logins.
+NOLOGINDIR /etc
+
+
+#
+# ======== Configuration parameters used during power failures ==========
+#
+
+# The ONBATTERYDELAY is the time in seconds from when a power failure
+# is detected until we react to it with an onbattery event.
+#
+# This means that, apccontrol will be called with the powerout argument
+# immediately when a power failure is detected. However, the
+# onbattery argument is passed to apccontrol only after the
+# ONBATTERYDELAY time. If you don't want to be annoyed by short
+# powerfailures, make sure that apccontrol powerout does nothing
+# i.e. comment out the wall.
+ONBATTERYDELAY 10
+
+#
+# Note: BATTERYLEVEL, MINUTES, and TIMEOUT work in conjunction, so
+# the first that occurs will cause the initation of a shutdown.
+#
+
+# If during a power failure, the remaining battery percentage
+# (as reported by the UPS) is below or equal to BATTERYLEVEL,
+# apcupsd will initiate a system shutdown.
+BATTERYLEVEL 0
+
+# If during a power failure, the remaining runtime in minutes
+# (as calculated internally by the UPS) is below or equal to MINUTES,
+# apcupsd, will initiate a system shutdown.
+MINUTES 0
+
+# If during a power failure, the UPS has run on batteries for TIMEOUT
+# many seconds or longer, apcupsd will initiate a system shutdown.
+# A value of 0 disables this timer.
+#
+# Note, if you have a Smart UPS, you will most likely want to disable
+# this timer by setting it to zero. That way, you UPS will continue
+# on batteries until either the % charge remaing drops to or below BATTERYLEVEL,
+# or the remaining battery runtime drops to or below MINUTES. Of course,
+# if you are testing, setting this to 60 causes a quick system shutdown
+# if you pull the power plug.
+# If you have an older dumb UPS, you will want to set this to less than
+# the time you know you can run on batteries.
+TIMEOUT 0
+
+# Time in seconds between annoying users to signoff prior to
+# system shutdown. 0 disables.
+ANNOY 45
+
+# Initial delay after power failure before warning users to get
+# off the system.
+ANNOYDELAY 90
+
+# The condition which determines when users are prevented from
+# logging in during a power failure.
+# NOLOGON <string> [ disable | timeout | percent | minutes | always ]
+NOLOGON disable
+
+# If KILLDELAY is non-zero, apcupsd will continue running after a
+# shutdown has been requested, and after the specified time in
+# seconds attempt to kill the power. This is for use on systems
+# where apcupsd cannot regain control after a shutdown.
+# KILLDELAY <seconds> 0 disables
+KILLDELAY 0
+
+#
+# ==== Configuration statements for Network Information Server ====
+#
+
+# NETSERVER [ on | off ] on enables, off disables the network
+# information server. If netstatus is on, a network information
+# server process will be started for serving the STATUS and
+# EVENT data over the network (used by CGI programs).
+NETSERVER on
+
+# NISIP <dotted notation ip address>
+# IP address on which NIS server will listen for incoming connections.
+# This is useful if your server is multi-homed (has more than one
+# network interface and IP address). Default value is 0.0.0.0 which
+# means any incoming request will be serviced. Alternatively, you can
+# configure this setting to any specific IP address of your server and
+# NIS will listen for connections only on that interface. Use the
+# loopback address (127.0.0.1) to accept connections only from the
+# local machine.
+NISIP 127.0.0.1
+
+# NISPORT <port> default is 3551 as registered with the IANA
+# port to use for sending STATUS and EVENTS data over the network.
+# It is not used unless NETSERVER is on. If you change this port,
+# you will need to change the corresponding value in the cgi directory
+# and rebuild the cgi programs.
+NISPORT 3551
+
+# If you want the last few EVENTS to be available over the network
+# by the network information server, you must define an EVENTSFILE.
+EVENTSFILE /var/log/apcupsd.events
+
+# EVENTSFILEMAX <kilobytes>
+# By default, the size of the EVENTSFILE will be not be allowed to exceed
+# 10 kilobytes. When the file grows beyond this limit, older EVENTS will
+# be removed from the beginning of the file (first in first out). The
+# parameter EVENTSFILEMAX can be set to a different kilobyte value, or set
+# to zero to allow the EVENTSFILE to grow without limit.
+EVENTSFILEMAX 25
+
+#
+# ========== Configuration statements used if sharing =============
+# a UPS with more than one machine
+
+#
+# Remaining items are for ShareUPS (APC expansion card) ONLY
+#
+
+# UPSCLASS [ standalone | shareslave | sharemaster ]
+# Normally standalone unless you share a UPS using an APC ShareUPS
+# card.
+UPSCLASS standalone
+
+# UPSMODE [ disable | share ]
+# Normally disable unless you share a UPS using an APC ShareUPS card.
+UPSMODE disable
+
+#
+# ===== Configuration statements to control apcupsd system logging ========
+#
+
+# Time interval in seconds between writing the STATUS file; 0 disables
+STATTIME 0
+
+# Location of STATUS file (written to only if STATTIME is non-zero)
+STATFILE /var/log/apcupsd.status
+
+# LOGSTATS [ on | off ] on enables, off disables
+# Note! This generates a lot of output, so if
+# you turn this on, be sure that the
+# file defined in syslog.conf for LOG_NOTICE is a named pipe.
+# You probably do not want this on.
+LOGSTATS off
+
+# Time interval in seconds between writing the DATA records to
+# the log file. 0 disables.
+DATATIME 0
+
+# FACILITY defines the logging facility (class) for logging to syslog.
+# If not specified, it defaults to "daemon". This is useful
+# if you want to separate the data logged by apcupsd from other
+# programs.
+#FACILITY DAEMON
+
+#
+# ========== Configuration statements used in updating the UPS EPROM =========
+#
+
+#
+# These statements are used only by apctest when choosing "Set EEPROM with conf
+# file values" from the EEPROM menu. THESE STATEMENTS HAVE NO EFFECT ON APCUPSD.
+#
+
+# UPS name, max 8 characters
+#UPSNAME UPS_IDEN
+
+# Battery date - 8 characters
+#BATTDATE mm/dd/yy
+
+# Sensitivity to line voltage quality (H cause faster transfer to batteries)
+# SENSITIVITY H M L (default = H)
+#SENSITIVITY H
+
+# UPS delay after power return (seconds)
+# WAKEUP 000 060 180 300 (default = 0)
+#WAKEUP 60
+
+# UPS Grace period after request to power off (seconds)
+# SLEEP 020 180 300 600 (default = 20)
+#SLEEP 180
+
+# Low line voltage causing transfer to batteries
+# The permitted values depend on your model as defined by last letter
+# of FIRMWARE or APCMODEL. Some representative values are:
+# D 106 103 100 097
+# M 177 172 168 182
+# A 092 090 088 086
+# I 208 204 200 196 (default = 0 => not valid)
+#LOTRANSFER 208
+
+# High line voltage causing transfer to batteries
+# The permitted values depend on your model as defined by last letter
+# of FIRMWARE or APCMODEL. Some representative values are:
+# D 127 130 133 136
+# M 229 234 239 224
+# A 108 110 112 114
+# I 253 257 261 265 (default = 0 => not valid)
+#HITRANSFER 253
+
+# Battery charge needed to restore power
+# RETURNCHARGE 00 15 50 90 (default = 15)
+#RETURNCHARGE 15
+
+# Alarm delay
+# 0 = zero delay after pwr fail, T = power fail + 30 sec, L = low battery, N = never
+# BEEPSTATE 0 T L N (default = 0)
+#BEEPSTATE T
+
+# Low battery warning delay in minutes
+# LOWBATT 02 05 07 10 (default = 02)
+#LOWBATT 2
+
+# UPS Output voltage when running on batteries
+# The permitted values depend on your model as defined by last letter
+# of FIRMWARE or APCMODEL. Some representative values are:
+# D 115
+# M 208
+# A 100
+# I 230 240 220 225 (default = 0 => not valid)
+#OUTPUTVOLTS 230
+
+# Self test interval in hours 336=2 weeks, 168=1 week, ON=at power on
+# SELFTEST 336 168 ON OFF (default = 336)
+#SELFTEST 336
diff --git a/sys-power/apcupsd/files/apcupsd.init.2a b/sys-power/apcupsd/files/apcupsd.init.2a
new file mode 100644
index 000000000000..1ecc1b929a21
--- /dev/null
+++ b/sys-power/apcupsd/files/apcupsd.init.2a
@@ -0,0 +1,37 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+INSTANCE="${SVCNAME#*.}"
+if [ -z "${INSTANCE}" ] || [ "${SVCNAME}" = "apcupsd" ]; then
+ INSTANCE="apcupsd"
+fi
+
+depend() {
+ use net
+}
+
+start() {
+ rm -f /etc/apcupsd/powerfail
+
+ export SERVICE="${SVCNAME}"
+
+ ebegin "Starting APC UPS daemon"
+ start-stop-daemon \
+ --start --pidfile "/var/run/${SVCNAME}.pid" \
+ --exec /sbin/apcupsd -- \
+ -f "/etc/apcupsd/${INSTANCE}.conf" \
+ -P "/var/run/${SVCNAME}.pid"
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping APC UPS daemon"
+ start-stop-daemon \
+ --stop --pidfile "/var/run/${SVCNAME}.pid" \
+ --retry TERM/5/TERM/5 \
+ --exec /sbin/apcupsd
+ eend $?
+}
+
diff --git a/sys-power/apcupsd/files/apcupsd.init.3 b/sys-power/apcupsd/files/apcupsd.init.3
new file mode 100644
index 000000000000..7670659a0f2d
--- /dev/null
+++ b/sys-power/apcupsd/files/apcupsd.init.3
@@ -0,0 +1,28 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+INSTANCE="${SVCNAME#*.}"
+if [ -z "${INSTANCE}" -o "${SVCNAME}" = "apcupsd" ]; then
+ INSTANCE="apcupsd"
+fi
+
+name="APC UPS Daemon"
+
+pidfile=/var/run/${SVCNAME}.pid
+
+command=/sbin/apcupsd
+command_args="-f /etc/apcupsd/${INSTANCE}.conf -P ${pidfile}"
+start_stop_daemon_args="--wait 300 --retry TERM/5/TERM/5"
+
+depend() {
+ use net
+ after udev
+}
+
+start_pre() {
+ rm -f /etc/apcupsd/powerfail
+
+ export SERVICE="${SVCNAME}"
+}
diff --git a/sys-power/apcupsd/files/apcupsd.init.4 b/sys-power/apcupsd/files/apcupsd.init.4
new file mode 100755
index 000000000000..d06052036dad
--- /dev/null
+++ b/sys-power/apcupsd/files/apcupsd.init.4
@@ -0,0 +1,49 @@
+#!/sbin/runscript
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+INSTANCE="${SVCNAME#*.}"
+if [ -z "${INSTANCE}" ] || [ "${SVCNAME}" = "apcupsd" ]; then
+ INSTANCE="apcupsd"
+fi
+
+dir="/run/apcupsd"
+
+depend() {
+ use net
+}
+
+start_pre() {
+ checkpath -d -m 0775 -o root:uucp ${dir}
+}
+
+start() {
+ rm -f /etc/apcupsd/powerfail
+
+ export SERVICE="${SVCNAME}"
+
+ if [ ! -d "${dir}" ]; then
+ einfo " Creating ${dir}"
+ /bin/mkdir -p "${dir}"
+ /bin/chown root:uucp "${dir}"
+ fi
+
+ ebegin "Starting APC UPS daemon"
+ start-stop-daemon \
+ --start --pidfile "${dir}/${SVCNAME}.pid" \
+ --exec /sbin/apcupsd -- \
+ -f "/etc/apcupsd/${INSTANCE}.conf" \
+ -P "${dir}/${SVCNAME}.pid"
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping APC UPS daemon"
+ start-stop-daemon \
+ --stop --pidfile "${dir}/${SVCNAME}.pid" \
+ --retry TERM/5/TERM/5 \
+ --exec /sbin/apcupsd
+ eend $?
+}
+
diff --git a/sys-power/apcupsd/files/apcupsd.powerfail.init b/sys-power/apcupsd/files/apcupsd.powerfail.init
new file mode 100644
index 000000000000..e0c798c1da05
--- /dev/null
+++ b/sys-power/apcupsd/files/apcupsd.powerfail.init
@@ -0,0 +1,18 @@
+#!/sbin/runscript
+# Copyright 2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+description='Signal the UPS to kill power in a power failure condition'
+
+depend() {
+ need mount-ro
+}
+
+start() {
+ if [ "$(runlevel | cut -d' ' -f2)" = "0" -a -f /etc/apcupsd/powerfail ] ; then
+ ebegin 'Signaling UPS to kill power'
+ /sbin/apcupsd --killpower
+ eend $?
+ fi
+}
diff --git a/sys-power/apcupsd/files/apcupsd.service b/sys-power/apcupsd/files/apcupsd.service
new file mode 100644
index 000000000000..9cec6e44194a
--- /dev/null
+++ b/sys-power/apcupsd/files/apcupsd.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=APC UPS Monitor
+
+[Service]
+ExecStart=/sbin/apcupsd -b
+
+[Install]
+WantedBy=multi-user.target
diff --git a/sys-power/apcupsd/metadata.xml b/sys-power/apcupsd/metadata.xml
new file mode 100644
index 000000000000..ceee693916c0
--- /dev/null
+++ b/sys-power/apcupsd/metadata.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>mattm@gentoo.org</email>
+ <name>Matthew Marlowe</name>
+ </maintainer>
+ <longdescription>
+Apcupsd can be used for power mangement and controlling most of
+APC's UPS models on Unix and Windows machines. Apcupsd works with
+most of APC's Smart-UPS models as well as most simple signalling
+models such a Back-UPS, and BackUPS-Office. During a power failure,
+apcupsd will inform the users about the power failure and that a
+shutdown may occur. If power is not restored, a system shutdown
+will follow when the battery is exhausted, a timeout (seconds)
+expires, or runtime expires based on internal APC calculations
+determined by power consumption rates.
+</longdescription>
+ <herd>base-system</herd>
+ <upstream>
+ <remote-id type="sourceforge">apcupsd</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-power/athcool/Manifest b/sys-power/athcool/Manifest
new file mode 100644
index 000000000000..da60cad2248d
--- /dev/null
+++ b/sys-power/athcool/Manifest
@@ -0,0 +1 @@
+DIST athcool-0.3.12.tar.gz 18384 SHA256 8a80654cb616064d60e6188fe6d426fe104a439930fceab865930bf1c9ffbbc9
diff --git a/sys-power/athcool/athcool-0.3.12.ebuild b/sys-power/athcool/athcool-0.3.12.ebuild
new file mode 100644
index 000000000000..51f56589f5a1
--- /dev/null
+++ b/sys-power/athcool/athcool-0.3.12.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="small utility to toggle Powersaving mode for AMD Athlon/Duron processors"
+HOMEPAGE="http://members.jcom.home.ne.jp/jacobi/linux/softwares.html#athcool"
+SRC_URI="http://members.jcom.home.ne.jp/jacobi/linux/files/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* x86"
+IUSE=""
+
+DEPEND="sys-apps/pciutils"
+RDEPEND=""
+
+pkg_setup() {
+ tc-export CC
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-0.3.11-build.patch
+}
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+ doinitd "${FILESDIR}"/athcool
+ dodoc README ChangeLog
+}
+
+pkg_postinst() {
+ ewarn "WARNING: Depending on your motherboard and/or hardware components,"
+ ewarn "enabling powersaving mode may cause:"
+ ewarn " * noisy or distorted sound playback"
+ ewarn " * a slowdown in harddisk performance"
+ ewarn " * system locks or unpredictable behavior"
+ ewarn " * file system corruption"
+ ewarn "If you met those problems, you should not use athcool. Please use"
+ ewarn "athcool AT YOUR OWN RISK!"
+}
diff --git a/sys-power/athcool/files/athcool b/sys-power/athcool/files/athcool
new file mode 100755
index 000000000000..c6eddd95bf72
--- /dev/null
+++ b/sys-power/athcool/files/athcool
@@ -0,0 +1,15 @@
+#!/sbin/runscript
+# $Id$
+
+start() {
+ ebegin "Starting ${SVCNAME}"
+ athcool on >/dev/null 2>&1
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ${SVCNAME}"
+ athcool off >/dev/null 2>&1
+ eend $?
+}
+
diff --git a/sys-power/athcool/files/athcool-0.3.11-build.patch b/sys-power/athcool/files/athcool-0.3.11-build.patch
new file mode 100644
index 000000000000..8b8e619dd71f
--- /dev/null
+++ b/sys-power/athcool/files/athcool-0.3.11-build.patch
@@ -0,0 +1,36 @@
+--- Makefile
++++ Makefile
+@@ -14,13 +14,13 @@
+ SRCS = athcool.c scanpci.c
+ OBJS = $(SRCS:.c=.o)
+
+-CC = gcc
++CC ?= gcc
+ RM = rm -f
+-CFLAGS = -O2 -Wall
+-DEFS = -I. -I$(includedir) -DPACKAGE=\"$(PACKAGE)\" -DVERSION=\"$(VERSION)\"
++CFLAGS += -Wall
++DEFS = -I. -DPACKAGE=\"$(PACKAGE)\" -DVERSION=\"$(VERSION)\"
+ #DEFS += -DENABLE_FORCEID=1
+ #DEFS += -DDISABLE_WRITE_REG=1
+-LIBS = -lpci
++LIBS = -lpci -lz
+
+ ### rules ###
+
+@@ -30,13 +30,13 @@
+ all: $(PACKAGE)
+
+ $(PACKAGE): $(OBJS)
+- $(CC) $(CFLAGS) $(OBJS) $(LIBS) -o $@
++ $(CC) $(CFLAGS) $(OBJS) $(LIBS) -o $@ $(LDFLAGS)
+
+ install: install-program install-man # install-script
+
+ install-program:
+ [ -d $(sbindir) ] || install -m 755 -d $(sbindir)
+- install -s $(PACKAGE) $(sbindir)
++ install $(PACKAGE) $(sbindir)
+
+ install-man:
+ [ -d $(mandir)/man8 ] || install -m 755 -d $(mandir)/man8
diff --git a/sys-power/athcool/metadata.xml b/sys-power/athcool/metadata.xml
new file mode 100644
index 000000000000..96a2d586367d
--- /dev/null
+++ b/sys-power/athcool/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>base-system</herd>
+</pkgmetadata>
diff --git a/sys-power/bbswitch/Manifest b/sys-power/bbswitch/Manifest
new file mode 100644
index 000000000000..e2fad107250b
--- /dev/null
+++ b/sys-power/bbswitch/Manifest
@@ -0,0 +1,2 @@
+DIST bbswitch-0.7.tar.gz 20963 SHA256 bc21377c165aa2851b85c6a2e398c94be70a0519ba8241ea92aedcbaad7b4659 SHA512 4ba648012dc0e55210944f56d038ee90b4b61e4a38cdf35b33d9fd4777c93e07c53c43d18764c7c11aefea165a2152b766387d0d3267153983491dec6abe1493 WHIRLPOOL 5e4780c82393105e66d5949ac1470d7613807901d034d59042ccf64e36ce2b2512a78e354763793413fbc966d2181475629e749540b49fa8b161734a7808e95d
+DIST bbswitch-0.8.tar.gz 15800 SHA256 76cabd3f734fb4fe6ebfe3ec9814138d0d6f47d47238521ecbd6a986b60d1477 SHA512 11ab163931feb6c0e202d04c4552b848e999fedea9990390c26b28abdb4a69081ccfb5a22d1e390cc274f1c0cfc9adedc719c5fece14738b17aaa93e28865b7c WHIRLPOOL 4215bb74779d5bfaacd1177f89636a9006fbce369c381e620868e7012092756417f7df732b373341254fad75e08f6de4536921f5478f0032d2961d22d56a3c15
diff --git a/sys-power/bbswitch/bbswitch-0.7.ebuild b/sys-power/bbswitch/bbswitch-0.7.ebuild
new file mode 100644
index 000000000000..b03f0e2af1ba
--- /dev/null
+++ b/sys-power/bbswitch/bbswitch-0.7.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils linux-mod
+
+DESCRIPTION="Toggle discrete NVIDIA Optimus graphics card"
+HOMEPAGE="https://github.com/Bumblebee-Project/bbswitch"
+SRC_URI="https://github.com/Bumblebee-Project/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+SLOT="0"
+LICENSE="GPL-3+"
+KEYWORDS="amd64 x86"
+IUSE=""
+
+DEPEND="virtual/linux-sources
+ sys-kernel/linux-headers"
+RDEPEND=""
+
+MODULE_NAMES="bbswitch(acpi)"
+
+pkg_setup() {
+ linux-mod_pkg_setup
+
+ BUILD_TARGETS="default"
+ BUILD_PARAMS="KVERSION=${KV_FULL}"
+}
+
+src_install() {
+ insinto /etc/modprobe.d
+ newins "${FILESDIR}"/bbswitch.modprobe bbswitch.conf
+ dodoc NEWS
+
+ linux-mod_src_install
+}
diff --git a/sys-power/bbswitch/bbswitch-0.8.ebuild b/sys-power/bbswitch/bbswitch-0.8.ebuild
new file mode 100644
index 000000000000..bedd8989e904
--- /dev/null
+++ b/sys-power/bbswitch/bbswitch-0.8.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils linux-mod
+
+DESCRIPTION="Toggle discrete NVIDIA Optimus graphics card"
+HOMEPAGE="https://github.com/Bumblebee-Project/bbswitch"
+SRC_URI="https://github.com/Bumblebee-Project/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+SLOT="0"
+LICENSE="GPL-3+"
+KEYWORDS="amd64 x86"
+IUSE=""
+
+DEPEND="
+ virtual/linux-sources
+ sys-kernel/linux-headers
+"
+RDEPEND=""
+
+MODULE_NAMES="bbswitch(acpi)"
+
+pkg_setup() {
+ linux-mod_pkg_setup
+
+ BUILD_TARGETS="default"
+ BUILD_PARAMS="KVERSION=${KV_FULL}"
+}
+
+src_install() {
+ insinto /etc/modprobe.d
+ newins "${FILESDIR}"/bbswitch.modprobe bbswitch.conf
+ dodoc NEWS README.md
+
+ linux-mod_src_install
+}
diff --git a/sys-power/bbswitch/files/bbswitch.modprobe b/sys-power/bbswitch/files/bbswitch.modprobe
new file mode 100644
index 000000000000..dd6500c77131
--- /dev/null
+++ b/sys-power/bbswitch/files/bbswitch.modprobe
@@ -0,0 +1 @@
+options bbswitch load_state=-1 unload_state=-1 \ No newline at end of file
diff --git a/sys-power/bbswitch/metadata.xml b/sys-power/bbswitch/metadata.xml
new file mode 100644
index 000000000000..2c9726db7a94
--- /dev/null
+++ b/sys-power/bbswitch/metadata.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>proxy-maintainers</herd>
+ <maintainer>
+ <email>pacho@gentoo.org</email>
+ <name>Pacho Ramos</name>
+ </maintainer>
+ <maintainer>
+ <email>mva@mva.name</email>
+ <name>Vadim A. Misbakh-Soloviov</name>
+ </maintainer>
+ <maintainer>
+ <email>rei4dan@gmail.com</email>
+ <name>My Th</name>
+ </maintainer>
+ <longdescription>
+ Kernel module which automatically detects the required ACPI calls for two
+ kinds of Optimus laptops for safe disabling/enabling the discrete graphics card.
+</longdescription>
+ <upstream>
+ <remote-id type="github">Bumblebee-Project/bbswitch</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-power/cpudyn/Manifest b/sys-power/cpudyn/Manifest
new file mode 100644
index 000000000000..a1084c58983e
--- /dev/null
+++ b/sys-power/cpudyn/Manifest
@@ -0,0 +1 @@
+DIST cpudyn-1.0.1.tgz 32285 SHA256 bc196ad17c04aa4bb21fdf9f6976e658d1d89cf736405a3faec93fd0e14df227
diff --git a/sys-power/cpudyn/cpudyn-1.0.1.ebuild b/sys-power/cpudyn/cpudyn-1.0.1.ebuild
new file mode 100644
index 000000000000..ed980dfc9726
--- /dev/null
+++ b/sys-power/cpudyn/cpudyn-1.0.1.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils
+
+DESCRIPTION="A daemon to control laptop power consumption via cpufreq and disk standby"
+HOMEPAGE="http://mnm.uib.es/~gallir/cpudyn/"
+SRC_URI="http://mnm.uib.es/~gallir/${PN}/download/${P}.tgz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc ppc64 x86"
+IUSE=""
+
+S=${WORKDIR}/${PN}
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"/debian
+ epatch "${FILESDIR}"/${PN}-0.99.0-init_conf_updates.patch
+}
+
+src_compile() {
+ emake LDFLAGS="${LDFLAGS}" cpudynd || die "Compilation failed."
+}
+
+src_install() {
+ dosbin cpudynd || die "dosbin"
+
+ doman cpudynd.8
+ dodoc INSTALL README VERSION changelog
+ dohtml *.html
+
+ newinitd "${FILESDIR}"/cpudyn.init cpudyn
+ newconfd debian/cpudyn.conf cpudyn
+}
+
+pkg_postinst() {
+ einfo "Configuration file is /etc/conf.d/cpudyn."
+}
diff --git a/sys-power/cpudyn/files/cpudyn-0.99.0-init_conf_updates.patch b/sys-power/cpudyn/files/cpudyn-0.99.0-init_conf_updates.patch
new file mode 100644
index 000000000000..fcfb55294d33
--- /dev/null
+++ b/sys-power/cpudyn/files/cpudyn-0.99.0-init_conf_updates.patch
@@ -0,0 +1,29 @@
+--- gentoo/cpudyn.conf.orig 2004-01-08 17:20:39.575230665 +0100
++++ gentoo/cpudyn.conf 2004-01-08 17:20:37.450290151 +0100
+@@ -32,6 +32,12 @@
+
+ THROTTLING_LOW=7
+
++#
++# Count also niced process in CPU usage. Default is no.
++#
++
++#NICE=yes
++
+ ################################################
+ # DISK OPTIONS
+ # (disabled by default)
+@@ -51,4 +57,14 @@
+ # DISKS=/dev/hda,/dev/hdb
+
+
++################################################
++# Special Startup Options
++# (you shouldn't need to change these)
++################################################
++# cpufreq sources for 2.4 kernels
++CPUFREQ_24="/proc/cpufreq"
++# cpufreq sources for 2.5/2.6 kernels
++CPUFREQ_25="/sys/devices/system/cpu/cpu0/cpufreq /sysfs/devices/system/cpu/cpu0/cpufreq"
++# pure acpi cpufreq
++CPUFREQ_ACPI="/proc/acpi/processor/CPU0/throttling"
diff --git a/sys-power/cpudyn/files/cpudyn.init b/sys-power/cpudyn/files/cpudyn.init
new file mode 100644
index 000000000000..877f51f41b7c
--- /dev/null
+++ b/sys-power/cpudyn/files/cpudyn.init
@@ -0,0 +1,102 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+#
+# Based on the Debian init script written by Celso Gonzalez <celso@bulma.net>,
+# and on the cpufreqd Gentoo init script written by Robert Gogolok <robertgogolok@web.de>.
+# Heavily modified by Robin H. Johnson <robbat2@gentoo.org> to ensure correct
+# start only under support conditions
+# More preconditions by Karl Trygve Kalleberg <karltk@gentoo.org>
+#
+
+DAEMON=/usr/sbin/cpudynd
+PIDFILE=/var/run/cpudynd.pid
+
+opts="${opts} min max dynamic"
+
+depend() {
+ need localmount
+}
+
+checkconfig() {
+ local CPUFREQ_FILES="${CPUFREQ_24} ${CPUFREQ_25} ${CPUFREQ_ACPI}"
+ local CPUFREQ_FILE=""
+ for i in ${CPUFREQ_FILES}; do [ -e ${i} ] && CPUFREQ_FILE="${i}" && break ; done
+ if [ -z "${CPUFREQ_FILE}" ]; then
+ eerror "Neither CPUFreq nor ACPI throttling support were found"
+ return 1
+ fi
+ if [ "${CPUFREQ_FILE}" = "${CPUFREQ_ACPI}" ]; then
+ # see if the file says we are supported or not
+ grep 'not supported' ${CPUFREQ_ACPI} 2>&1 >/dev/null
+ retval="$?"
+ if [ $retval -eq 0 ]; then
+ eerror "ACPI throttling support found, but hardware doesn't support it"
+ return 1
+ fi
+ # now check that we can write to the file
+ local acpistate=`grep 'active state' ${CPUFREQ_ACPI} | cut -dT -f2-`
+ echo $acpistate > ${CPUFREQ_ACPI}
+ retval="$?"
+ if [ $retval -ne 0 ]; then
+ eerror "Writing to ACPI throttling file failed"
+ return 1
+ fi
+ fi
+ # CPUFREQ_25 has more than one entry, hence the grep -- karltk
+ if [ ! -z "$(echo ${CPUFREQ_25} | grep ${CPUFREQ_FILE})" ]; then
+ # Silently try to load the governors; shouldn't hurt if they're already there
+ modprobe -q cpufreq_performance
+ modprobe -q cpufreq_powersave
+ modprobe -q cpufreq_userspace
+ modprobe -q cpufreq_ondemand
+ fi
+
+ return 0
+}
+
+
+start() {
+ local CPUDYN_OPTS=""
+ if [ -n "$INTERVAL" ]; then CPUDYN_OPTS="$CPUDYN_OPTS -i $INTERVAL"; fi
+ if [ -n "$CPU_UP" -a -n "$CPU_DOWN" ]; then CPUDYN_OPTS="$CPUDYN_OPTS -p $CPU_UP $CPU_DOWN"; fi
+ if [ -n "$THROTTLING_LOW" ]; then CPUDYN_OPTS="$CPUDYN_OPTS -l $THROTTLING_LOW"; fi
+ if [ -n "$TIMEOUT" ]; then CPUDYN_OPTS="$CPUDYN_OPTS -t $TIMEOUT"; fi
+ if [ -n "$DISKS" ]; then CPUDYN_OPTS="$CPUDYN_OPTS -h $DISKS"; fi
+ if [ "$NICE" = "yes" ]; then CPUDYN_OPTS="$CPUDYN_OPTS -nice"; fi
+
+ ebegin "Starting cpudynd"
+ if checkconfig; then
+ start-stop-daemon --start --quiet --pidfile $PIDFILE \
+ --background --make-pidfile --exec $DAEMON -- $CPUDYN_OPTS
+ eend $?
+ else
+ eend 1
+ fi
+}
+
+stop() {
+ ebegin "Stopping cpudynd"
+ start-stop-daemon --stop --quiet --pidfile $PIDFILE \
+ --exec $DAEMON && rm -f $PIDFILE
+ eend $?
+}
+
+min() {
+ ebegin "Forcing minimal speed"
+ kill -USR2 $(cat ${PIDFILE})
+ eend $?
+}
+max() {
+ ebegin "Forcing maximal speed"
+ kill -USR1 $(cat ${PIDFILE})
+ eend $?
+}
+dynamic() {
+ ebegin "Resetting to default dynamic speed"
+ kill -HUP $(cat ${PIDFILE})
+ eend $?
+}
+
+# vim:ts=4 noexpandtab:
diff --git a/sys-power/cpudyn/metadata.xml b/sys-power/cpudyn/metadata.xml
new file mode 100644
index 000000000000..4538a68724a6
--- /dev/null
+++ b/sys-power/cpudyn/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer><email>maintainer-needed@gentoo.org</email></maintainer>
+</pkgmetadata>
diff --git a/sys-power/cpupower/Manifest b/sys-power/cpupower/Manifest
new file mode 100644
index 000000000000..2696bda85c7d
--- /dev/null
+++ b/sys-power/cpupower/Manifest
@@ -0,0 +1,4 @@
+DIST linux-3.13.tar.xz 77187032 SHA256 4d5e5eee5f276424c32e9591f1b6c971baedc7b49f28ce03d1f48b1e5d6226a2 SHA512 1ba223bb4b885d691a67196d86a8aaf7b4a1c351bf2a762f50f1b0c32da00dd0c28895872a66b49e8d244498d996876609268e64861d28ac4048886ef9f79b87 WHIRLPOOL 2992257a17e85b3eb16fcaf21678fa6dbf31f80c2099fd1ad0ff9852ac1d16122ac8e2c0b46421d8895d4368253a724e439cd625307ee7af7bd1e50cb2c9b62a
+DIST linux-3.14.tar.xz 78399152 SHA256 61558aa490855f42b6340d1a1596be47454909629327c49a5e4e10268065dffa SHA512 5730d83a7a81134c1e77c0bf89e42dee4f8251ad56c1ac2be20c59e26fdfaa7bea55f277e7af156b637f22e1584914a46089af85039177cb43485089c74ac26e WHIRLPOOL 5ad07b78c362ba0b21c50b4abb99407cae06bd08576f3fd8f36047b01409eba096263208020da3dcad4977eefc61d66502276754097bc127635df1d7a5817d41
+DIST linux-3.15.tar.xz 79676484 SHA256 c3927e87be4040fa8aca1b58663dc0776aaf00485604ff88a623be2f3fb07794 SHA512 d5dc477cad4584e56e2e2ef9e0950c2b22e76e5cf5090a896ba099cb7c5e5db1853a4aeb96b199189653dc66d461557e95198e37516a619f7ddc01ba6b308e02 WHIRLPOOL 7f3dfde1a23aab75b7f40770ae2ca77c1b28f845e4abe6296b2aec9b56fe94f7afa76b00eb6cc7475305c31b726ebeb4643107dd48c12ac04c933cf1856b8e77
+DIST linux-3.18.tar.xz 80934708 SHA256 becc413cc9e6d7f5cc52a3ce66d65c3725bc1d1cc1001f4ce6c32b69eb188cbd SHA512 2f0b72466e9bc538a675738aa416573d41bbbd7e3e2ffd5b5b127afde609ebc278cec5a3c37e73479607e957c13f1b4ed9782a3795e0dcc2cf8e550228594009 WHIRLPOOL 81634af631b7d30ccd1f4798f96f44d9aa0ba6609b73f2747eb6aebaf7a99487fb2dbd45767605186182533cb222bfd9236e8dd5e11a04fdb67c211e4e0a91d6
diff --git a/sys-power/cpupower/cpupower-3.13.ebuild b/sys-power/cpupower/cpupower-3.13.ebuild
new file mode 100644
index 000000000000..3d54c4559362
--- /dev/null
+++ b/sys-power/cpupower/cpupower-3.13.ebuild
@@ -0,0 +1,65 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit multilib toolchain-funcs
+
+DESCRIPTION="Shows and sets processor power related values"
+HOMEPAGE="http://www.kernel.org/"
+SRC_URI="mirror://kernel/linux/kernel/v3.x/linux-${PV}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="cpufreq_bench debug nls"
+
+# File collision w/ headers of the deprecated cpufrequtils
+RDEPEND="sys-apps/pciutils
+ !<sys-apps/linux-misc-apps-3.6-r2
+ !sys-power/cpufrequtils"
+DEPEND="${RDEPEND}
+ virtual/os-headers
+ virtual/pkgconfig
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/linux-${PV}/tools/power/${PN}
+
+pkg_setup() {
+ myemakeargs=(
+ DEBUG=$(usex debug true false)
+ V=1
+ CPUFREQ_BENCH=$(usex cpufreq_bench true false)
+ NLS=$(usex nls true false)
+ docdir=/usr/share/doc/${PF}/${PN}
+ mandir=/usr/share/man
+ libdir=/usr/$(get_libdir)
+ AR="$(tc-getAR)"
+ CC="$(tc-getCC)"
+ LD="$(tc-getCC)"
+ STRIP=true
+ LDFLAGS="${LDFLAGS}"
+ OPTIMIZATION="${CFLAGS}"
+ )
+}
+
+src_prepare() {
+ # -Wl,--as-needed compat
+ local libs="-lcpupower -lrt $($(tc-getPKG_CONFIG) --libs-only-l libpci)"
+ sed -i \
+ -e "/$libs/{ s,${libs},,g; s,\$, ${libs},g;}" \
+ -e "s:-O1 -g::" \
+ Makefile || die
+}
+
+src_compile() {
+ emake "${myemakeargs[@]}"
+}
+
+src_install() {
+ emake DESTDIR="${D}" "${myemakeargs[@]}" install
+ dodoc README ToDo
+
+ newconfd "${FILESDIR}"/conf.d-r2 ${PN}
+ newinitd "${FILESDIR}"/init.d-r4 ${PN}
+}
diff --git a/sys-power/cpupower/cpupower-3.14.ebuild b/sys-power/cpupower/cpupower-3.14.ebuild
new file mode 100644
index 000000000000..e8cca45ab222
--- /dev/null
+++ b/sys-power/cpupower/cpupower-3.14.ebuild
@@ -0,0 +1,65 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit multilib toolchain-funcs
+
+DESCRIPTION="Shows and sets processor power related values"
+HOMEPAGE="http://www.kernel.org/"
+SRC_URI="mirror://kernel/linux/kernel/v3.x/linux-${PV}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="cpufreq_bench debug nls"
+
+# File collision w/ headers of the deprecated cpufrequtils
+RDEPEND="sys-apps/pciutils
+ !<sys-apps/linux-misc-apps-3.6-r2
+ !sys-power/cpufrequtils"
+DEPEND="${RDEPEND}
+ virtual/os-headers
+ virtual/pkgconfig
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/linux-${PV}/tools/power/${PN}
+
+pkg_setup() {
+ myemakeargs=(
+ DEBUG=$(usex debug true false)
+ V=1
+ CPUFREQ_BENCH=$(usex cpufreq_bench true false)
+ NLS=$(usex nls true false)
+ docdir=/usr/share/doc/${PF}/${PN}
+ mandir=/usr/share/man
+ libdir=/usr/$(get_libdir)
+ AR="$(tc-getAR)"
+ CC="$(tc-getCC)"
+ LD="$(tc-getCC)"
+ STRIP=true
+ LDFLAGS="${LDFLAGS}"
+ OPTIMIZATION="${CFLAGS}"
+ )
+}
+
+src_prepare() {
+ # -Wl,--as-needed compat
+ local libs="-lcpupower -lrt $($(tc-getPKG_CONFIG) --libs-only-l libpci)"
+ sed -i \
+ -e "/$libs/{ s,${libs},,g; s,\$, ${libs},g;}" \
+ -e "s:-O1 -g::" \
+ Makefile || die
+}
+
+src_compile() {
+ emake "${myemakeargs[@]}"
+}
+
+src_install() {
+ emake DESTDIR="${D}" "${myemakeargs[@]}" install
+ dodoc README ToDo
+
+ newconfd "${FILESDIR}"/conf.d-r2 ${PN}
+ newinitd "${FILESDIR}"/init.d-r4 ${PN}
+}
diff --git a/sys-power/cpupower/cpupower-3.15.ebuild b/sys-power/cpupower/cpupower-3.15.ebuild
new file mode 100644
index 000000000000..0ab1c0645c74
--- /dev/null
+++ b/sys-power/cpupower/cpupower-3.15.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit multilib toolchain-funcs
+
+DESCRIPTION="Shows and sets processor power related values"
+HOMEPAGE="http://www.kernel.org/"
+SRC_URI="mirror://kernel/linux/kernel/v3.x/linux-${PV}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="cpufreq_bench debug nls"
+
+# File collision w/ headers of the deprecated cpufrequtils
+RDEPEND="sys-apps/pciutils
+ !<sys-apps/linux-misc-apps-3.6-r2
+ !sys-power/cpufrequtils"
+DEPEND="${RDEPEND}
+ virtual/os-headers
+ virtual/pkgconfig
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/linux-${PV}/tools/power/${PN}
+
+pkg_setup() {
+ myemakeargs=(
+ DEBUG=$(usex debug true false)
+ V=1
+ CPUFREQ_BENCH=$(usex cpufreq_bench true false)
+ NLS=$(usex nls true false)
+ docdir=/usr/share/doc/${PF}/${PN}
+ mandir=/usr/share/man
+ libdir=/usr/$(get_libdir)
+ AR="$(tc-getAR)"
+ CC="$(tc-getCC)"
+ LD="$(tc-getCC)"
+ STRIP=true
+ LDFLAGS="${LDFLAGS}"
+ OPTIMIZATION="${CFLAGS}"
+ )
+}
+
+src_unpack() {
+ tar -xf "${DISTDIR}"/linux-${PV}.tar.xz \
+ linux-${PV}/tools/power/${PN} \
+ linux-${PV}/Makefile \
+ || die
+}
+
+src_prepare() {
+ # -Wl,--as-needed compat
+ local libs="-lcpupower -lrt $($(tc-getPKG_CONFIG) --libs-only-l libpci)"
+ sed -i \
+ -e "/$libs/{ s,${libs},,g; s,\$, ${libs},g;}" \
+ -e "s:-O1 -g::" \
+ Makefile || die
+}
+
+src_compile() {
+ emake "${myemakeargs[@]}"
+}
+
+src_install() {
+ emake DESTDIR="${D}" "${myemakeargs[@]}" install
+ dodoc README ToDo
+
+ newconfd "${FILESDIR}"/conf.d-r2 ${PN}
+ newinitd "${FILESDIR}"/init.d-r4 ${PN}
+}
diff --git a/sys-power/cpupower/cpupower-3.18.ebuild b/sys-power/cpupower/cpupower-3.18.ebuild
new file mode 100644
index 000000000000..0ab1c0645c74
--- /dev/null
+++ b/sys-power/cpupower/cpupower-3.18.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit multilib toolchain-funcs
+
+DESCRIPTION="Shows and sets processor power related values"
+HOMEPAGE="http://www.kernel.org/"
+SRC_URI="mirror://kernel/linux/kernel/v3.x/linux-${PV}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="cpufreq_bench debug nls"
+
+# File collision w/ headers of the deprecated cpufrequtils
+RDEPEND="sys-apps/pciutils
+ !<sys-apps/linux-misc-apps-3.6-r2
+ !sys-power/cpufrequtils"
+DEPEND="${RDEPEND}
+ virtual/os-headers
+ virtual/pkgconfig
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/linux-${PV}/tools/power/${PN}
+
+pkg_setup() {
+ myemakeargs=(
+ DEBUG=$(usex debug true false)
+ V=1
+ CPUFREQ_BENCH=$(usex cpufreq_bench true false)
+ NLS=$(usex nls true false)
+ docdir=/usr/share/doc/${PF}/${PN}
+ mandir=/usr/share/man
+ libdir=/usr/$(get_libdir)
+ AR="$(tc-getAR)"
+ CC="$(tc-getCC)"
+ LD="$(tc-getCC)"
+ STRIP=true
+ LDFLAGS="${LDFLAGS}"
+ OPTIMIZATION="${CFLAGS}"
+ )
+}
+
+src_unpack() {
+ tar -xf "${DISTDIR}"/linux-${PV}.tar.xz \
+ linux-${PV}/tools/power/${PN} \
+ linux-${PV}/Makefile \
+ || die
+}
+
+src_prepare() {
+ # -Wl,--as-needed compat
+ local libs="-lcpupower -lrt $($(tc-getPKG_CONFIG) --libs-only-l libpci)"
+ sed -i \
+ -e "/$libs/{ s,${libs},,g; s,\$, ${libs},g;}" \
+ -e "s:-O1 -g::" \
+ Makefile || die
+}
+
+src_compile() {
+ emake "${myemakeargs[@]}"
+}
+
+src_install() {
+ emake DESTDIR="${D}" "${myemakeargs[@]}" install
+ dodoc README ToDo
+
+ newconfd "${FILESDIR}"/conf.d-r2 ${PN}
+ newinitd "${FILESDIR}"/init.d-r4 ${PN}
+}
diff --git a/sys-power/cpupower/files/conf.d-r2 b/sys-power/cpupower/files/conf.d-r2
new file mode 100644
index 000000000000..1e67ed04e254
--- /dev/null
+++ b/sys-power/cpupower/files/conf.d-r2
@@ -0,0 +1,36 @@
+# /etc/conf.d/cpupower: config file for /etc/init.d/cpupower
+
+# Options when starting cpufreq (given to the `cpupower` program)
+# Possible options are:
+# -g --governor <GOV> (ie: ondemand, performance, or powersave)
+# -d --min <FREQ> (ie: 1000MHz)
+# -u --max <FREQ> (ie: 2000MHz)
+# -f --freq <FREQ> (requires userspace governor, this *can not* be combined with
+# with any other parameters).
+# Frequencies can be passed in Hz, kHz (default), MHz, GHz, or THz by postfixing the
+# value with the wanted unit name, without any space.
+# (frequency in kHz =^ Hz * 0.001 =^ MHz * 1000 =^ GHz * 1000000).
+
+START_OPTS="--governor ondemand"
+
+# Options when stopping cpufreq (given to the `cpupower` program)
+# This option can be used to change governer on stop. Leaving it empty will ensure
+# the governer remains on the one provided above.
+STOP_OPTS=""
+
+# Extra settings to write to sysfs cpufreq values.
+#
+# up_threshold: threshold for stepping up frequency, where the value represents
+# the percentage of cpu load.
+#
+# down_threshold: threshold for stepping down frequency, where the value
+# represents the percentage of cpu load.
+#
+# sampling_down_factor: determines how frequently the governor polls the cpu, a
+# value greater than 1 improves performance by reducing the polling when the
+# load is high. This tunable has no effect on behavior at lower CPU frequencies.
+#
+# ignore_nice_load: when set to '1' the processes that are run with a 'nice'
+# value will not count in the usage calculation.
+
+#SYSFS_EXTRA="ondemand/ignore_nice_load=1 ondemand/up_threshold=75 ondemand/sampling_down_factor=10"
diff --git a/sys-power/cpupower/files/init.d-r4 b/sys-power/cpupower/files/init.d-r4
new file mode 100644
index 000000000000..e209c05e2bec
--- /dev/null
+++ b/sys-power/cpupower/files/init.d-r4
@@ -0,0 +1,42 @@
+#!/sbin/runscript
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+CPUFREQ_SYSFS=/sys/devices/system/cpu/cpufreq
+
+change() {
+ local c ret=0 opts="$1"
+ if [ -n "$opts" ] ; then
+ ebegin "Running cpupower -c all frequency-set ${opts}"
+ cpupower -c all frequency-set ${opts} >/dev/null 2>&1
+ : $(( ret += $? ))
+ eend ${ret}
+
+ if [ -d ${CPUFREQ_SYSFS} ] && [ -n "${SYSFS_EXTRA}" ] ; then
+ c=1
+ einfo "Setting extra options: ${SYSFS_EXTRA}"
+ if cd ${CPUFREQ_SYSFS} ; then
+ local o v
+ for o in ${SYSFS_EXTRA} ; do
+ v=${o#*=}
+ o=${o%%=*}
+ echo ${v} > ${o} || break
+ done
+ c=0
+ fi
+ eend ${c}
+ : $(( ret += c ))
+ fi
+ fi
+
+ return ${ret}
+}
+
+start() {
+ change "${START_OPTS}"
+}
+
+stop() {
+ change "${STOP_OPTS}"
+}
diff --git a/sys-power/cpupower/metadata.xml b/sys-power/cpupower/metadata.xml
new file mode 100644
index 000000000000..7c289c2b4da5
--- /dev/null
+++ b/sys-power/cpupower/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>kernel-misc</herd>
+ <maintainer>
+ <email>ssuominen@gentoo.org</email>
+ <name>Samuli Suominen</name>
+ </maintainer>
+ <use>
+ <flag name='cpufreq_bench'>Build and install the cpufreq_bench binary</flag>
+ </use>
+</pkgmetadata>
diff --git a/sys-power/cpuspeedy/Manifest b/sys-power/cpuspeedy/Manifest
new file mode 100644
index 000000000000..0158b6572491
--- /dev/null
+++ b/sys-power/cpuspeedy/Manifest
@@ -0,0 +1 @@
+DIST cpuspeedy-0.4.1.tar.gz 17174 SHA256 5e9ff675b7895e2fa7186ec54c154dcdef7ca1153cf1fe5ef0df10fecb5846b0
diff --git a/sys-power/cpuspeedy/cpuspeedy-0.4.1.ebuild b/sys-power/cpuspeedy/cpuspeedy-0.4.1.ebuild
new file mode 100644
index 000000000000..ea031526267c
--- /dev/null
+++ b/sys-power/cpuspeedy/cpuspeedy-0.4.1.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=3
+PYTHON_DEPEND="2"
+inherit python
+
+DESCRIPTION="A simple and easy to use program to control the speed and the voltage of CPUs on the fly"
+HOMEPAGE="http://cpuspeedy.sourceforge.net/"
+SRC_URI="mirror://sourceforge/cpuspeedy/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ppc x86"
+IUSE=""
+
+pkg_setup() {
+ python_set_active_version 2
+ python_pkg_setup
+}
+
+src_prepare() {
+ rm -f Makefile || die
+ python_convert_shebangs -r $(python_get_version) .
+}
+
+src_install() {
+ exeinto "$(python_get_sitedir)"/${PN}
+ doexe src/*.py || die
+
+ dodoc AUTHORS ChangeLog README || die
+ doman doc/*.1 || die
+
+ dosym "$(python_get_sitedir)"/${PN}/${PN}.py /usr/sbin/${PN} || die
+}
+
+pkg_postinst() {
+ python_mod_optimize ${PN}
+}
+
+pkg_postrm() {
+ python_mod_cleanup ${PN}
+}
diff --git a/sys-power/cpuspeedy/metadata.xml b/sys-power/cpuspeedy/metadata.xml
new file mode 100644
index 000000000000..3bf8fc4b9340
--- /dev/null
+++ b/sys-power/cpuspeedy/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>maintainer-needed@gentoo.org</email>
+ </maintainer>
+ <longdescription>
+Cpuspeedy is a simple tool written in Python which allows you to change the clock speed and voltage of the CPUs
+using the Linux's CPUFreq driver
+(copyied off ref url)
+</longdescription>
+ <upstream>
+ <remote-id type="sourceforge">cpuspeedy</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-power/hibernate-script/Manifest b/sys-power/hibernate-script/Manifest
new file mode 100644
index 000000000000..02d806959c94
--- /dev/null
+++ b/sys-power/hibernate-script/Manifest
@@ -0,0 +1,2 @@
+DIST hibernate-script-2.0-patches-4.tar.bz2 4209 SHA256 525260253be33ee6115d733ceef84de86a9161219c8503c106fa75d62e0ff2c3 SHA512 7fadffe0b749b202c3e26795a8fdbf4861649893132816fed4714543b9caab0185d0005ec02c9e9484ba7392a13ed90722e6beeb4ecf96e0d92cc6918a6cb343 WHIRLPOOL 2b5d276ce1843d2627f506902137945ec45f7be313538c5da48367ab4f523dec59aec5eedb2961446b967e67460eaa7f741f7f806485e4c40bac8b55012fd275
+DIST hibernate-script-2.0.tar.gz 84453 SHA256 d04597473a50c6ac072e3a4c22f173a7234a97bc2a39e460e56c5d3d985a6545 SHA512 625efdf8bd8561dd9ab93c09436f2fb93edef2fbb0fb2d259727bacffab0b7bd4a6c99d445131390883be75658f6dd28f329fdaf4f03a7d218c0021223ac1a1e WHIRLPOOL 8dab0108063b0d74d49fd075fdba7c96db7eeb8ebab5054329578b3dfe7adeb0d048db6cedfc238ba374bfa97d689eb8e08eb270ab72d861904487b7dc04dc21
diff --git a/sys-power/hibernate-script/files/hibernate-script-2.0-init.d.patch b/sys-power/hibernate-script/files/hibernate-script-2.0-init.d.patch
new file mode 100644
index 000000000000..bd82587336c1
--- /dev/null
+++ b/sys-power/hibernate-script/files/hibernate-script-2.0-init.d.patch
@@ -0,0 +1,56 @@
+diff -Nru hibernate-script-2.0.vanilla/init.d/hibernate-cleanup.sh hibernate-script-2.0/init.d/hibernate-cleanup.sh
+--- hibernate-script-2.0.vanilla/init.d/hibernate-cleanup.sh 2009-05-01 23:03:41.000000000 +0100
++++ hibernate-script-2.0/init.d/hibernate-cleanup.sh 2009-05-01 23:03:55.000000000 +0100
+@@ -1,4 +1,4 @@
+-#!/bin/sh
++#!/sbin/runscript
+
+ # This script invalidates any stale swsusp and TuxOnIce images. It
+ # searches all swap partitions on your machine, as well as TuxOnIce's
+@@ -91,27 +91,30 @@
+
+
+ msg_status() {
+- echo -n "$1"
++ einfon "$1"
+ }
+
+ msg() {
+- echo "$1"
++ einfo "$1"
+ }
+
+-case "$1" in
+-start)
+- msg_status "Invalidating stale software suspend images... "
++opts="reload"
++
++depend() {
++ after modules
++ before localmount
++}
++
++start() {
++ ebegin "Invalidating stale software suspend images"
+ do_start
+- msg "done."
+- ;;
+-stop)
++ eend $?
++}
++
++stop() {
+ do_stop
+- ;;
+-restart|force-reload)
+- do_reload
+- ;;
+-*)
+- msg "Usage: /etc/init.d/hibernate {start|stop|restart|force-reload}"
+-esac
++}
+
+-exit 0
++reload() {
++ do_reload
++}
diff --git a/sys-power/hibernate-script/hibernate-script-2.0-r6.ebuild b/sys-power/hibernate-script/hibernate-script-2.0-r6.ebuild
new file mode 100644
index 000000000000..5e8cc089a76d
--- /dev/null
+++ b/sys-power/hibernate-script/hibernate-script-2.0-r6.ebuild
@@ -0,0 +1,75 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils
+
+PATCH_VERSION="4"
+
+DESCRIPTION="Hibernate script supporting multiple suspend methods"
+HOMEPAGE="http://www.tuxonice.net/"
+SRC_URI="http://www.tuxonice.net/downloads/all/${P}.tar.gz
+ mirror://gentoo/${P}-patches-${PATCH_VERSION}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86"
+
+IUSE="vim-syntax"
+
+DEPEND=""
+RDEPEND="!<media-gfx/splashutils-1.5.2"
+
+DOCS=( CHANGELOG README SCRIPTLET-API hibernate.vim )
+
+src_prepare() {
+ epatch "${WORKDIR}/${PV}/"*.patch
+}
+
+src_install() {
+ BASE_DIR="${D}" \
+ DISTRIBUTION="gentoo" \
+ PREFIX="/usr" \
+ MAN_DIR="${D}/usr/share/man" \
+ "${S}/install.sh" || die "Install failed"
+
+ # hibernate-ram will default to using ram.conf
+ dosym /usr/sbin/hibernate /usr/sbin/hibernate-ram
+
+ newinitd init.d/hibernate-cleanup.sh hibernate-cleanup
+
+ # other ebuilds can install scriplets to this dir
+ keepdir /etc/hibernate/scriptlets.d/
+
+ if use vim-syntax; then
+ insinto /usr/share/vim/vimfiles/syntax
+ doins hibernate.vim
+ fi
+
+ dodoc ${DOCS[@]}
+
+ insinto /etc/logrotate.d
+ newins "${S}"/logrotate.d-hibernate-script hibernate-script
+ chmod 644 \
+ "${D}/etc/hibernate/"*.conf \
+ "${D}/etc/hibernate/blacklisted-modules" \
+ "${D}/usr/share/hibernate/scriptlets.d/"* \
+ "${D}/usr/share/hibernate/tuxonice-binary-signature.bin" \
+ || die
+}
+
+pkg_postinst() {
+ elog
+ elog "You should run the following command to invalidate suspend"
+ elog "images on a clean boot."
+ elog
+ elog " # rc-update add hibernate-cleanup boot"
+ elog
+ elog "See /usr/share/doc/${PF}/README.* for further details."
+ elog
+ elog "Please note that you will need to manually emerge any utilities"
+ elog "(radeontool, vbetool, ...) enabled in the configuration files,"
+ elog "should you wish to use them."
+}
diff --git a/sys-power/hibernate-script/metadata.xml b/sys-power/hibernate-script/metadata.xml
new file mode 100644
index 000000000000..7f679d64a788
--- /dev/null
+++ b/sys-power/hibernate-script/metadata.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>alonbl@gentoo.org</email>
+ </maintainer>
+</pkgmetadata>
diff --git a/sys-power/iasl/Manifest b/sys-power/iasl/Manifest
new file mode 100644
index 000000000000..513bfb1f33a4
--- /dev/null
+++ b/sys-power/iasl/Manifest
@@ -0,0 +1,8 @@
+DIST acpica-unix-20121018.tar.gz 1272523 SHA256 e4008fb70ebe967994fe1caff84c2b16206011234e55fc4e849a11df76550c24 SHA512 32824579dccb9d5ba39a895a7905d746d61e2b0d19dcb215aba28e7d976e090d798af2361d474ee0b103a47776d00a6f44128a75a13b1bafb02e86364255523a WHIRLPOOL f56ff1c3f96349d0fe271bc66d84c87ba29d98f3313a9f4998b94b4db21510851a8cf2d839910181956b5ef1789a7b4abfdc5479db6e9dcc285716b574b9466c
+DIST acpica-unix-20130117.tar.gz 1269197 SHA256 70c7e6a0a66e58e73efcc99cb37c2ec2bc20e386b49990105d6bda77e8d134fe SHA512 307789a2a153f2aa5fa3b76b1fef9fcf2cc8397ee50238ed7f7946e41f8e93e3115968c13dc376fd9e88ec8bd3268867c1840f01bef2fa05dc2d4136bea4e105 WHIRLPOOL 04b678889f0683c2ab80b592e35a338c3f5ed91e2fe802acdde79d762d8c67ab608c55258a30cf32ade4b2d0f6f9a0c908f5729421c5466124a5bb5949479f83
+DIST acpica-unix-20140828.tar.gz 1423788 SHA256 37984860aac35a8d35c25c4e71f519fd3ea61f2405bb37ad64caeda4543e535a SHA512 ab4cb8ba74c5abf05913b6ef39955698f2bb5c243f723d660bd8f9c397fcf2a959d5ec10326a699c53e05319a428e721f1d65a07249574200af3227676725398 WHIRLPOOL 4e584be596ed10b39acf11613be706a374e84c4e42c9e82eda84649be9ed72f64065e286eefe3a40a6b376d9eef2ab0cd86e26935455ad78ecbde8a24ce1d970
+DIST acpica-unix-20150717.tar.gz 1502551 SHA256 74c906a9b38cd0690d1bb2c53b432367bc6f7573d925b7b3b0b0c6124cf31a10 SHA512 5f5dce50c2133623f80b92a5d2130d8515a82d59eb572a7055217de277d52c4fb4b770e632ef9f8dc9db20c727b758c95d5a877546ad93c375d86016cb56e088 WHIRLPOOL 856983d0f485a6193030d85f879944f7bf625b2a06cdfccdff101d410b8f5d8f8c812adc6f89317004de35ba2f4337bd700f71b32e01914db5decd3dc2ca6fbc
+DIST acpitests-unix-20121018.tar.gz 1978548 SHA256 67bfbbc9a818da1414a859412f9dd5f0ff1220c1dfdbe3116a3a748cc82c57ac SHA512 4c565b9c3af3122f5acfd802e6467124071f45987db0e5d5b9bf87a2d82e433cd6bd1b6faed71dbe6b01694c0f79b390f220515cf287519588ccae71ebafe798 WHIRLPOOL 8169bfdbdb33458d9f671ee935694eddc470e62e5837a7383c3430905e46ff6546e82c1f7e6d0b4dcee2293b1094ab79509c4985bd43f1d5e777c6818cd01532
+DIST acpitests-unix-20130117.tar.gz 1979430 SHA256 917b4ad5b3c2b76cd1e503bffced340f8b62e74c25dcfcbb451d3b4f8832114e SHA512 310cb4bce80f1a9903f7c1317eeb30c7c0886a43a9d237e28cdefd8281a17a39cfaea972caad45a68d94e19a11ad95aef51fef23de8b8bc2771ae27cb7b924a6 WHIRLPOOL a0e7dfbed676710a0884d57564c392477fb168fb30ce488d58f93a03b9e237e61e43cd3821dee85faf72add0ff33d3b92c49a46c731ed86a2651100f2a4e192c
+DIST acpitests-unix-20140828.tar.gz 2008060 SHA256 e576c74bf1bf1c9f7348bf9419e05c8acfece7105abcdc052e66670c7af2cf00 SHA512 7c3d36c9c1054a56f9b473cd0204062d7ac93b66e1f4d448575182ac3fb0a819506701306be406dd7b8385d37c6f77d7bc4dadc57f6743203ac1bee36a975be5 WHIRLPOOL d04f1cc65f3512dcba53440c295ba1dd740d337b1e3b5812c7c2717ac066408b18ff085b77db7d5dba6cb5055e2ba13dfb1323f28d7f7cae01bbc9fc34d5f09a
+DIST acpitests-unix-20150717.tar.gz 2008493 SHA256 dd12ae7b6122caeab6a89f23764ac559555ce461857f08fcabc1ed2f447a5350 SHA512 46b8bead2e5fee307c3eb1ac9a008b5dc598e07d71d66865628aec0d957e724c295066625d291dec20ed6eb13212dd847973481e8ee5fa98eff5a1cd30523922 WHIRLPOOL ff9c4541addfcdbda499823c12e1482849b4a1a2051266157995fdb9da5f16a869edf84a173893daa4b44c13e7e6a1b087e77acc895f8805d63211c0597fda5f
diff --git a/sys-power/iasl/files/iasl-20080701-parallelmake.patch b/sys-power/iasl/files/iasl-20080701-parallelmake.patch
new file mode 100644
index 000000000000..ce51efedbab7
--- /dev/null
+++ b/sys-power/iasl/files/iasl-20080701-parallelmake.patch
@@ -0,0 +1,47 @@
+Index: acpica-unix-20080701.old/compiler/Makefile
+===================================================================
+--- acpica-unix-20080701.old.orig/compiler/Makefile
++++ acpica-unix-20080701.old/compiler/Makefile
+@@ -1,7 +1,7 @@
+
+
+ PROG= iasl
+-SRCS= aslcompilerparse.c aslcompilerlex.c aslanalyze.c aslcodegen.c \
++SRCS= aslcompiler.y.c aslcompilerlex.c aslanalyze.c aslcodegen.c \
+ aslcompile.c aslerror.c aslfiles.c asllength.c \
+ asllisting.c aslload.c asllookup.c aslmain.c aslmap.c aslopcodes.c \
+ asloperands.c aslresource.c aslrestype1.c aslrestype2.c aslstartup.c \
+@@ -89,6 +89,7 @@ SRCS= aslcompilerparse.c aslcompilerlex.
+ ../tables/tbutils.c \
+ ../tables/tbxface.c \
+ ../osunixxf.c
++OBJS = $(patsubst %.c,%.o, $(SRCS))
+
+ NOMAN= YES
+ CFLAGS+= -Wall -O2 -Wstrict-prototypes -D_LINUX -DACPI_ASL_COMPILER -I../include
+@@ -105,17 +106,19 @@ YFLAGS+= -y -pAslCompiler
+ #CFLAGS+= -D_USE_BERKELEY_YACC
+ #.endif
+
+-aslmain : $(patsubst %.c,%.o, $(SRCS))
++aslmain : $(OBJS)
+ $(CC) $(LDFLAGS) $(patsubst %.c,%.o, $(SRCS)) \
+ $(LOADLIBES) $(LDLIBS) -o iasl
+
++$(OBJS): aslcompiler.y.h
++
+ CLEANFILES= y.output y.tab.c y.tab.h aslcompiler.y.h \
+- aslcompilerparse.c aslcompilerlex.c iasl
++ aslcompiler.y.c aslcompilerlex.c iasl
++
++aslcompiler.y.h: aslcompiler.y.c
+
+-aslcompilerparse.c: aslcompiler.y
+- ${YACC} ${YFLAGS} aslcompiler.y
+- cp y.tab.c aslcompilerparse.c
+- cp y.tab.h aslcompiler.y.h
++aslcompiler.y.c: aslcompiler.y
++ ${YACC} ${YFLAGS} aslcompiler.y -o aslcompiler.y.c
+
+ aslcompilerlex.c: aslcompiler.l
+ ${LEX} ${LFLAGS} -PAslCompiler -oaslcompilerlex.c aslcompiler.l
diff --git a/sys-power/iasl/files/iasl-20120816-locale.patch b/sys-power/iasl/files/iasl-20120816-locale.patch
new file mode 100644
index 000000000000..425513342105
--- /dev/null
+++ b/sys-power/iasl/files/iasl-20120816-locale.patch
@@ -0,0 +1,15 @@
+diff -Nuar acpica-unix-20120816.orig/generate/unix/Makefile.config acpica-unix-20120816/generate/unix/Makefile.config
+--- acpica-unix-20120816.orig/generate/unix/Makefile.config 2012-08-16 15:51:15.000000000 +0000
++++ acpica-unix-20120816/generate/unix/Makefile.config 2012-09-07 18:31:41.887229126 +0000
+@@ -161,9 +161,9 @@
+ #YACC= byacc
+ #YFLAGS += -v -d
+ #
+-YACC= bison
++YACC= LC_ALL=C bison
+ YFLAGS += -v -d -y
+
+-LEX= flex
++LEX= LC_ALL=C flex
+ LFLAGS += -i -s
+
diff --git a/sys-power/iasl/files/iasl-20140214-locale.patch b/sys-power/iasl/files/iasl-20140214-locale.patch
new file mode 100644
index 000000000000..53a4d7c5efb1
--- /dev/null
+++ b/sys-power/iasl/files/iasl-20140214-locale.patch
@@ -0,0 +1,14 @@
+--- acpica-unix-20140214/generate/unix/Makefile.config
++++ acpica-unix-20140214/generate/unix/Makefile.config
+@@ -211,9 +211,9 @@
+ #YACC= byacc
+ #YFLAGS +=
+ #
+-YACC= bison
++YACC= LC_ALL=C bison
+ YFLAGS += -y
+
+-LEX= flex
++LEX= LC_ALL=C flex
+ LFLAGS += -i -s
+
diff --git a/sys-power/iasl/files/iasl-20140214-nostrip.patch b/sys-power/iasl/files/iasl-20140214-nostrip.patch
new file mode 100644
index 000000000000..0bb82df38c3c
--- /dev/null
+++ b/sys-power/iasl/files/iasl-20140214-nostrip.patch
@@ -0,0 +1,11 @@
+--- acpica-unix-20140214/generate/unix/Makefile.config
++++ acpica-unix-20140214/generate/unix/Makefile.config
+@@ -52,7 +52,7 @@
+ INSTALLFLAGS ?= -f
+ else
+ INSTALL = install
+-INSTALLFLAGS ?= -m 555 -s
++INSTALLFLAGS ?= -m 555
+ endif
+
+ INSTALLPROG = \
diff --git a/sys-power/iasl/files/iasl-20140828-locale.patch b/sys-power/iasl/files/iasl-20140828-locale.patch
new file mode 100644
index 000000000000..c8e278f7572a
--- /dev/null
+++ b/sys-power/iasl/files/iasl-20140828-locale.patch
@@ -0,0 +1,17 @@
+--- acpica-unix-20140828/generate/unix/Makefile.config
++++ acpica-unix-20140828/generate/unix/Makefile.config
+@@ -225,12 +225,12 @@
+ #YACC= byacc
+ #YFLAGS +=
+ #
+-YACC= bison
++YACC= LC_ALL=C bison
+ YFLAGS += -y
+
+ MACROPROC= m4
+ MFLAGS= -P -I$(ASL_COMPILER)
+
+-LEX= flex
++LEX= LC_ALL=C flex
+ LFLAGS += -i -s
+
diff --git a/sys-power/iasl/iasl-20121018.ebuild b/sys-power/iasl/iasl-20121018.ebuild
new file mode 100644
index 000000000000..803ff8bad9bc
--- /dev/null
+++ b/sys-power/iasl/iasl-20121018.ebuild
@@ -0,0 +1,124 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit toolchain-funcs flag-o-matic eutils
+
+MY_PN=acpica-unix
+MY_P=${MY_PN}-${PV}
+MY_TESTS_P=${MY_PN/ca/tests}-${PV}
+DESCRIPTION="Intel ACPI Source Language (ASL) compiler"
+HOMEPAGE="https://www.acpica.org/downloads/"
+SRC_URI="http://www.acpica.org/sites/acpica/files/${MY_P}.tar.gz
+ test? ( http://www.acpica.org/sites/acpica/files/${MY_TESTS_P}.tar.gz )"
+
+LICENSE="iASL"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="test"
+
+DEPEND="sys-devel/bison
+ sys-devel/flex"
+RDEPEND=""
+
+S=${WORKDIR}/${MY_P}
+
+pkg_setup() {
+ if use test && has test ${FEATURES}; then
+ ewarn 'You have selected USE="test". This will install the test results'
+ ewarn "into /usr/share/${PF}/, compressed as a tarball."
+ ewarn 'The tests themselves will only rarely die, but the test results'
+ ewarn 'are interesting for arch testing. The tests may take quite some'
+ ewarn 'time to complete.'
+ fi
+}
+
+src_prepare() {
+ #epatch "${FILESDIR}/${PN}-20110922-as-needed.patch"
+ epatch "${FILESDIR}/${PN}-20120816-locale.patch"
+ # Upstream has changed the buildsystem a lot, not sure if these are still
+ # needed
+ #epatch "${FILESDIR}/${PN}-20120816-parallelmake-001.patch"
+ #epatch "${FILESDIR}/${PN}-20110922-parallelmake-002.patch"
+ #epatch "${FILESDIR}/${PN}-20110922-parallelmake-003.patch"
+
+ find "${S}" -type f -name 'Makefile*' -print0 | \
+ xargs -0 -I '{}' \
+ sed -r -e 's:-\<Werror\>::g' -i '{}' \
+ || die
+
+ export BITS=64
+}
+
+src_configure() {
+ :
+}
+
+src_compile() {
+ cd acpica/generate/unix
+ emake BITS=${BITS}
+}
+
+src_test() {
+ aslts_test
+ #aapits_test
+ #The aapits test currently fails, missing include probably.
+}
+
+src_install() {
+ cd acpica/generate/unix
+ emake install DESTDIR="${D}" BITS=${BITS}
+ default_src_install
+ #local bin
+ #for bin in $(<"${T}"/binlist) ; do
+ # dobin "${T}"/${bin}
+ #done
+ dodoc "${S}"/changes.txt
+ newdoc "${S}"/source/compiler/readme.txt compiler-readme.txt
+ newdoc "${S}"/generate/unix/readme.txt unix-readme.txt
+ newdoc "${S}"/generate/lint/readme.txt lint-readme.txt
+ newdoc "${S}"/source/compiler/new_table.txt compiler-new_table.txt
+
+ if use test && has test ${FEATURES}; then
+ tb="${T}"/testresults.tar.bz2
+ export ASLTSDIR="$(<"${T}"/asltdir)"
+ ebegin "Creating Test Tarball"
+ tar -cjf "${tb}" -C "${ASLTSDIR}"/tmp/RESULTS . || die "tar failed"
+ eend $?
+ dodir /usr/share/${PF}
+ insinto /usr/share/${PF}
+ doins ${tb} || die "doins testresults.tar.bz2 failed"
+ fi
+
+}
+
+aslts_test() {
+ export ASL="${S}"/generate/unix/bin${BITS}/iasl \
+ acpiexec="${S}"/generate/unix/bin${BITS}/acpiexec \
+ ASLTSDIR="${WORKDIR}/${MY_TESTS_P}"/tests/aslts
+ export PATH="${PATH}:${ASLTSDIR}/bin"
+ echo "$ASLTSDIR" >"${T}"/asltdir
+ cd "${ASLTSDIR}"
+ edos2unix $(find . -type 'f')
+ make install || die "make install aslts test failed"
+ chmod +x $(find bin/ ! -regex 'ERROR_OPCODES|HOW_TO_USE|README' ) || die "chmod bin +x failed"
+
+ #The below Do commands runs the tests twice and then dies if the results aren't
+ #Identical.
+ Do 1 || die "failed Do 1"
+ Do 2 || die "failed Do 2"
+}
+
+aapits_test() {
+ mv "${WORKDIR}/${MY_TESTS_P}/tests/aapits" "${S}/tools/" || die "mv failed"
+ cd "${S}/tools/aapits" || die "cannot find ${S}/tools/aapits"
+ edos2unix $(find . -type 'f')
+ chmod +x $(find bin/ | sed -r -e '/\/[A-Z_]+$/d') || die "chmod bin +x failed"
+ make || die "make in aapits failed"
+ cd asl || die "cd asl failed"
+ make || die "make in asl failed"
+ cd ../bin
+ ./aapitsrun || die "aapitsrun failed"
+}
diff --git a/sys-power/iasl/iasl-20130117-r1.ebuild b/sys-power/iasl/iasl-20130117-r1.ebuild
new file mode 100644
index 000000000000..1a1c29e057d3
--- /dev/null
+++ b/sys-power/iasl/iasl-20130117-r1.ebuild
@@ -0,0 +1,129 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit toolchain-funcs flag-o-matic eutils
+
+MY_PN=acpica-unix
+MY_P=${MY_PN}-${PV}
+MY_TESTS_P=${MY_PN/ca/tests}-${PV}
+DESCRIPTION="Intel ACPI Source Language (ASL) compiler"
+HOMEPAGE="https://www.acpica.org/downloads/"
+SRC_URI="http://www.acpica.org/sites/acpica/files/${MY_P}.tar.gz
+ test? ( http://www.acpica.org/sites/acpica/files/${MY_TESTS_P}.tar.gz )"
+
+LICENSE="iASL"
+SLOT="0"
+KEYWORDS="amd64 ppc x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="test"
+
+DEPEND="sys-devel/bison
+ sys-devel/flex"
+RDEPEND=""
+
+S=${WORKDIR}/${MY_P}
+
+pkg_setup() {
+ if use test && has test ${FEATURES}; then
+ ewarn 'You have selected USE="test". This will install the test results'
+ ewarn "into /usr/share/${PF}/, compressed as a tarball."
+ ewarn 'The tests themselves will only rarely die, but the test results'
+ ewarn 'are interesting for arch testing. The tests may take quite some'
+ ewarn 'time to complete.'
+ fi
+}
+
+src_prepare() {
+ #epatch "${FILESDIR}/${PN}-20110922-as-needed.patch"
+ epatch "${FILESDIR}/${PN}-20120816-locale.patch"
+ # Upstream has changed the buildsystem a lot, not sure if these are still
+ # needed
+ #epatch "${FILESDIR}/${PN}-20120816-parallelmake-001.patch"
+ #epatch "${FILESDIR}/${PN}-20110922-parallelmake-002.patch"
+ #epatch "${FILESDIR}/${PN}-20110922-parallelmake-003.patch"
+
+ find "${S}" -type f -name 'Makefile*' -print0 | \
+ xargs -0 -I '{}' \
+ sed -r -e 's:-\<Werror\>::g' -i '{}' \
+ || die
+
+ # BITS is tied to ARCH - please set appropriately if you add new keywords
+ if [[ $ARCH == @(amd64|amd64-fbsd) ]] ; then
+ export BITS=64
+ else
+ export BITS=32
+ fi
+}
+
+src_configure() {
+ :
+}
+
+src_compile() {
+ cd acpica/generate/unix
+ emake BITS=${BITS}
+}
+
+src_test() {
+ aslts_test
+ #aapits_test
+ #The aapits test currently fails, missing include probably.
+}
+
+src_install() {
+ cd acpica/generate/unix
+ emake install DESTDIR="${D}" BITS=${BITS}
+ default_src_install
+ #local bin
+ #for bin in $(<"${T}"/binlist) ; do
+ # dobin "${T}"/${bin}
+ #done
+ dodoc "${S}"/changes.txt
+ newdoc "${S}"/source/compiler/readme.txt compiler-readme.txt
+ newdoc "${S}"/generate/unix/readme.txt unix-readme.txt
+ newdoc "${S}"/generate/lint/readme.txt lint-readme.txt
+ newdoc "${S}"/source/compiler/new_table.txt compiler-new_table.txt
+
+ if use test && has test ${FEATURES}; then
+ tb="${T}"/testresults.tar.bz2
+ export ASLTSDIR="$(<"${T}"/asltdir)"
+ ebegin "Creating Test Tarball"
+ tar -cjf "${tb}" -C "${ASLTSDIR}"/tmp/RESULTS . || die "tar failed"
+ eend $?
+ dodir /usr/share/${PF}
+ insinto /usr/share/${PF}
+ doins ${tb} || die "doins testresults.tar.bz2 failed"
+ fi
+
+}
+
+aslts_test() {
+ export ASL="${S}"/generate/unix/bin${BITS}/iasl \
+ acpiexec="${S}"/generate/unix/bin${BITS}/acpiexec \
+ ASLTSDIR="${WORKDIR}/${MY_TESTS_P}"/tests/aslts
+ export PATH="${PATH}:${ASLTSDIR}/bin"
+ echo "$ASLTSDIR" >"${T}"/asltdir
+ cd "${ASLTSDIR}"
+ edos2unix $(find . -type 'f')
+ make install || die "make install aslts test failed"
+ chmod +x $(find bin/ ! -regex 'ERROR_OPCODES|HOW_TO_USE|README' ) || die "chmod bin +x failed"
+
+ #The below Do commands runs the tests twice and then dies if the results aren't
+ #Identical.
+ Do 1 || die "failed Do 1"
+ Do 2 || die "failed Do 2"
+}
+
+aapits_test() {
+ mv "${WORKDIR}/${MY_TESTS_P}/tests/aapits" "${S}/tools/" || die "mv failed"
+ cd "${S}/tools/aapits" || die "cannot find ${S}/tools/aapits"
+ edos2unix $(find . -type 'f')
+ chmod +x $(find bin/ | sed -r -e '/\/[A-Z_]+$/d') || die "chmod bin +x failed"
+ make || die "make in aapits failed"
+ cd asl || die "cd asl failed"
+ make || die "make in asl failed"
+ cd ../bin
+ ./aapitsrun || die "aapitsrun failed"
+}
diff --git a/sys-power/iasl/iasl-20140828.ebuild b/sys-power/iasl/iasl-20140828.ebuild
new file mode 100644
index 000000000000..5f8b142b5378
--- /dev/null
+++ b/sys-power/iasl/iasl-20140828.ebuild
@@ -0,0 +1,124 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit toolchain-funcs flag-o-matic eutils
+
+MY_PN=acpica-unix
+MY_P=${MY_PN}-${PV}
+MY_TESTS_P=${MY_PN/ca/tests}-${PV}
+DESCRIPTION="Intel ACPI Source Language (ASL) compiler"
+HOMEPAGE="https://www.acpica.org/downloads/"
+SRC_URI="http://www.acpica.org/sites/acpica/files/${MY_P}.tar.gz
+ test? ( http://www.acpica.org/sites/acpica/files/${MY_TESTS_P}.tar.gz )"
+
+LICENSE="iASL"
+SLOT="0"
+KEYWORDS="amd64 ~ppc x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="test"
+
+DEPEND="sys-devel/bison
+ sys-devel/flex"
+RDEPEND=""
+
+S=${WORKDIR}/${MY_P}
+
+pkg_setup() {
+ if use test && has test ${FEATURES}; then
+ ewarn 'You have selected USE="test". This will install the test results'
+ ewarn "into /usr/share/${PF}/, compressed as a tarball."
+ ewarn 'The tests themselves will only rarely die, but the test results'
+ ewarn 'are interesting for arch testing. The tests may take quite some'
+ ewarn 'time to complete.'
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-20140828-locale.patch" \
+ "${FILESDIR}/${PN}-20140214-nostrip.patch"
+
+ find "${S}" -type f -name 'Makefile*' -print0 | \
+ xargs -0 -I '{}' \
+ sed -r -e 's:-\<Werror\>::g' -i '{}' \
+ || die
+
+ # BITS is tied to ARCH - please set appropriately if you add new keywords
+ if [[ $ARCH == @(amd64|amd64-fbsd) ]] ; then
+ export BITS=64
+ else
+ export BITS=32
+ fi
+}
+
+src_configure() {
+ :
+}
+
+src_compile() {
+ cd acpica/generate/unix
+ emake BITS=${BITS}
+}
+
+src_test() {
+ aslts_test
+ #aapits_test
+ #The aapits test currently fails, missing include probably.
+}
+
+src_install() {
+ cd acpica/generate/unix
+ emake install DESTDIR="${D}" BITS=${BITS}
+ default_src_install
+ #local bin
+ #for bin in $(<"${T}"/binlist) ; do
+ # dobin "${T}"/${bin}
+ #done
+ dodoc "${S}"/changes.txt
+ newdoc "${S}"/source/compiler/readme.txt compiler-readme.txt
+ newdoc "${S}"/generate/unix/readme.txt unix-readme.txt
+ newdoc "${S}"/generate/lint/readme.txt lint-readme.txt
+ newdoc "${S}"/source/compiler/new_table.txt compiler-new_table.txt
+
+ if use test && has test ${FEATURES}; then
+ tb="${T}"/testresults.tar.bz2
+ export ASLTSDIR="$(<"${T}"/asltdir)"
+ ebegin "Creating Test Tarball"
+ tar -cjf "${tb}" -C "${ASLTSDIR}"/tmp/RESULTS . || die "tar failed"
+ eend $?
+ dodir /usr/share/${PF}
+ insinto /usr/share/${PF}
+ doins ${tb}
+ fi
+
+}
+
+aslts_test() {
+ export ASL="${S}"/generate/unix/bin/iasl \
+ acpiexec="${S}"/generate/unix/bin/acpiexec \
+ ASLTSDIR="${WORKDIR}/${MY_TESTS_P}"/tests/aslts
+ export PATH="${PATH}:${ASLTSDIR}/bin"
+ echo "$ASLTSDIR" >"${T}"/asltdir
+ cd "${ASLTSDIR}"
+ edos2unix $(find . -type 'f')
+ make install || die "make install aslts test failed"
+ chmod +x $(find bin/ ! -regex 'ERROR_OPCODES|HOW_TO_USE|README' ) || die "chmod bin +x failed"
+
+ #The below Do commands runs the tests twice and then dies if the results aren't
+ #Identical.
+ Do 1 || die "failed Do 1"
+ Do 2 || die "failed Do 2"
+}
+
+aapits_test() {
+ mv "${WORKDIR}/${MY_TESTS_P}/tests/aapits" "${S}/tools/" || die "mv failed"
+ cd "${S}/tools/aapits" || die "cannot find ${S}/tools/aapits"
+ edos2unix $(find . -type 'f')
+ chmod +x $(find bin/ | sed -r -e '/\/[A-Z_]+$/d') || die "chmod bin +x failed"
+ make || die "make in aapits failed"
+ cd asl || die "cd asl failed"
+ make || die "make in asl failed"
+ cd ../bin
+ ./aapitsrun || die "aapitsrun failed"
+}
diff --git a/sys-power/iasl/iasl-20150717.ebuild b/sys-power/iasl/iasl-20150717.ebuild
new file mode 100644
index 000000000000..81b1212fb991
--- /dev/null
+++ b/sys-power/iasl/iasl-20150717.ebuild
@@ -0,0 +1,124 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit toolchain-funcs flag-o-matic eutils
+
+MY_PN=acpica-unix
+MY_P=${MY_PN}-${PV}
+MY_TESTS_P=${MY_PN/ca/tests}-${PV}
+DESCRIPTION="Intel ACPI Source Language (ASL) compiler"
+HOMEPAGE="https://www.acpica.org/downloads/"
+SRC_URI="http://www.acpica.org/sites/acpica/files/${MY_P}.tar.gz
+ test? ( http://www.acpica.org/sites/acpica/files/${MY_TESTS_P}.tar.gz )"
+
+LICENSE="iASL"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="test"
+
+DEPEND="sys-devel/bison
+ sys-devel/flex"
+RDEPEND=""
+
+S=${WORKDIR}/${MY_P}
+
+pkg_setup() {
+ if use test && has test ${FEATURES}; then
+ ewarn 'You have selected USE="test". This will install the test results'
+ ewarn "into /usr/share/${PF}/, compressed as a tarball."
+ ewarn 'The tests themselves will only rarely die, but the test results'
+ ewarn 'are interesting for arch testing. The tests may take quite some'
+ ewarn 'time to complete.'
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-20140828-locale.patch" \
+ "${FILESDIR}/${PN}-20140214-nostrip.patch"
+
+ find "${S}" -type f -name 'Makefile*' -print0 | \
+ xargs -0 -I '{}' \
+ sed -r -e 's:-\<Werror\>::g' -i '{}' \
+ || die
+
+ # BITS is tied to ARCH - please set appropriately if you add new keywords
+ if [[ $ARCH == @(amd64|amd64-fbsd) ]] ; then
+ export BITS=64
+ else
+ export BITS=32
+ fi
+}
+
+src_configure() {
+ :
+}
+
+src_compile() {
+ cd acpica/generate/unix
+ emake BITS=${BITS}
+}
+
+src_test() {
+ aslts_test
+ #aapits_test
+ #The aapits test currently fails, missing include probably.
+}
+
+src_install() {
+ cd acpica/generate/unix
+ emake install DESTDIR="${D}" BITS=${BITS}
+ default_src_install
+ #local bin
+ #for bin in $(<"${T}"/binlist) ; do
+ # dobin "${T}"/${bin}
+ #done
+ dodoc "${S}"/changes.txt
+ newdoc "${S}"/source/compiler/readme.txt compiler-readme.txt
+ newdoc "${S}"/generate/unix/readme.txt unix-readme.txt
+ newdoc "${S}"/generate/lint/readme.txt lint-readme.txt
+ newdoc "${S}"/source/compiler/new_table.txt compiler-new_table.txt
+
+ if use test && has test ${FEATURES}; then
+ tb="${T}"/testresults.tar.bz2
+ export ASLTSDIR="$(<"${T}"/asltdir)"
+ ebegin "Creating Test Tarball"
+ tar -cjf "${tb}" -C "${ASLTSDIR}"/tmp/RESULTS . || die "tar failed"
+ eend $?
+ dodir /usr/share/${PF}
+ insinto /usr/share/${PF}
+ doins ${tb}
+ fi
+
+}
+
+aslts_test() {
+ export ASL="${S}"/generate/unix/bin/iasl \
+ acpiexec="${S}"/generate/unix/bin/acpiexec \
+ ASLTSDIR="${WORKDIR}/${MY_TESTS_P}"/tests/aslts
+ export PATH="${PATH}:${ASLTSDIR}/bin"
+ echo "$ASLTSDIR" >"${T}"/asltdir
+ cd "${ASLTSDIR}"
+ edos2unix $(find . -type 'f')
+ make install || die "make install aslts test failed"
+ chmod +x $(find bin/ ! -regex 'ERROR_OPCODES|HOW_TO_USE|README' ) || die "chmod bin +x failed"
+
+ #The below Do commands runs the tests twice and then dies if the results aren't
+ #Identical.
+ Do 1 || die "failed Do 1"
+ Do 2 || die "failed Do 2"
+}
+
+aapits_test() {
+ mv "${WORKDIR}/${MY_TESTS_P}/tests/aapits" "${S}/tools/" || die "mv failed"
+ cd "${S}/tools/aapits" || die "cannot find ${S}/tools/aapits"
+ edos2unix $(find . -type 'f')
+ chmod +x $(find bin/ | sed -r -e '/\/[A-Z_]+$/d') || die "chmod bin +x failed"
+ make || die "make in aapits failed"
+ cd asl || die "cd asl failed"
+ make || die "make in asl failed"
+ cd ../bin
+ ./aapitsrun || die "aapitsrun failed"
+}
diff --git a/sys-power/iasl/metadata.xml b/sys-power/iasl/metadata.xml
new file mode 100644
index 000000000000..bcbf77ce0ecd
--- /dev/null
+++ b/sys-power/iasl/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>robbat2@gentoo.org</email>
+ </maintainer>
+ <maintainer>
+ <email>polynomial-c@gentoo.org</email>
+ <name>Lars Wendler</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/sys-power/metadata.xml b/sys-power/metadata.xml
new file mode 100644
index 000000000000..c4863318d020
--- /dev/null
+++ b/sys-power/metadata.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE catmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<catmetadata>
+ <longdescription lang="en">
+ The sys-power category contains software which handles power management,
+ including CPU frequency scaling tools.
+ </longdescription>
+ <longdescription lang="es">
+ La categoría sys-power contiene programas que manejan el control del
+ rendimiento incluyendo herramientas para cambio de frecuencia de algunos
+ microprocesadores.
+ </longdescription>
+ <longdescription lang="de">
+ Die Kategorie sys-power enthält Software für das Powermanagement, wie
+ beispielsweise Programme zur Änderung der CPU-Frequenz.
+ </longdescription>
+ <longdescription lang="ja">
+ sys-powerカテゴリには電源管理を管理する(例えば、CPU基準化)が含まれます。
+ </longdescription>
+ <longdescription lang="nl">
+ De sys-power categorie bevat programma's voor energiebeheer, bijvoorbeeld
+ voor het aanpassen van de CPU-kloksnelheid.
+ </longdescription>
+ <longdescription lang="vi">
+ Nhóm sys-power chứa các phần mềm quản lý năng lượng,
+ bao gồm các công cụ quản lý tần số CPU.
+ </longdescription>
+ <longdescription lang="it">
+ La categoria sys-power contiene programmi per la gestione del risparmio energetico,
+ incluso il software per la variazione della frequenza della CPU.
+ </longdescription>
+ <longdescription lang="pt">
+ A categoria sys-power contém programas que lidam com
+ gerenciamento de energia, incluindo ferramentas de variação de
+ freqüência de microprocessadores.
+ </longdescription>
+ <longdescription lang="pl">
+ Kategoria sys-power zawiera oprogramowanie związane z zarządzaniem
+ energią, włączając w to programy służące do skalowania częstotliwości
+ procesora.
+ </longdescription>
+</catmetadata>
+
diff --git a/sys-power/ncpufreqd/Manifest b/sys-power/ncpufreqd/Manifest
new file mode 100644
index 000000000000..b790a159b0b3
--- /dev/null
+++ b/sys-power/ncpufreqd/Manifest
@@ -0,0 +1 @@
+DIST ncpufreqd-2.4.tar.xz 9552 SHA256 4f388c9b509e7a7c7b38ddcfbb8ee2ebc940027d5401a6acf2d3440f139c6d32 SHA512 9532604ac4245157152a3990e13225aae335e8b1bb22eca2299a30eee76d9305511ac2176fefb469d8aa573f32a3f46adb6b75e799498bc9577e1616cd5fc362 WHIRLPOOL 15674764c5b8a57f1585a6d78fb8b5e45999beba5059b5729291a89dd42799f99f846bf535409a6b96065cb5c3201601704cf042a7841a929395713d522d1cfe
diff --git a/sys-power/ncpufreqd/metadata.xml b/sys-power/ncpufreqd/metadata.xml
new file mode 100644
index 000000000000..b32295f316e6
--- /dev/null
+++ b/sys-power/ncpufreqd/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>maintainer-needed@gentoo.org</email>
+ </maintainer>
+ <upstream>
+ <remote-id type="bitbucket">nelchael/ncpufreqd</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-power/ncpufreqd/ncpufreqd-2.4.ebuild b/sys-power/ncpufreqd/ncpufreqd-2.4.ebuild
new file mode 100644
index 000000000000..6bbd46975cd4
--- /dev/null
+++ b/sys-power/ncpufreqd/ncpufreqd-2.4.ebuild
@@ -0,0 +1,28 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit cmake-utils
+
+DESCRIPTION="Daemon controlling CPU speed and temperature"
+HOMEPAGE="https://bitbucket.org/nelchael/ncpufreqd"
+SRC_URI="http://dev.gentoo.org/~mgorny/dist/${P}.tar.xz"
+LICENSE="ZLIB"
+
+SLOT="0"
+KEYWORDS="amd64 x86"
+
+IUSE=""
+
+DEPEND="virtual/logger
+ app-arch/xz-utils"
+RDEPEND="${DEPEND}"
+
+src_install() {
+ cmake-utils_src_install
+
+ doinitd gentoo-init.d/ncpufreqd
+ dodoc AUTHORS ChangeLog README
+}
diff --git a/sys-power/nut/Manifest b/sys-power/nut/Manifest
new file mode 100644
index 000000000000..54a5d07049c7
--- /dev/null
+++ b/sys-power/nut/Manifest
@@ -0,0 +1,2 @@
+DIST nut-2.6.5.tar.gz 2038832 SHA256 618df71cf1ca6e3700d1d3c282773a2dec85f9f20324c0d3234c824e97feb93f SHA512 f1c76e6280057dc558d53451e7de2bdc7f37a0f175b1c52c27e7dcb83deeb78f6885007ad188a7a3a19e411eba87e03eb2246310bd7a5a5bb6fa3ad2bebd49d8 WHIRLPOOL 2b189f77d18d26303c60f2c084796075b0a50b8aa9cbefc3ba9a83f037450ffc3ecdb289367435e784a6bbe8569f768a97130a1ccdf123e53f13e0cf8813fb9a
+DIST nut-2.7.2.tar.gz 2223307 SHA256 4d5365359b059d96dfcb77458f361a114d26c84f1297ffcd0c6c166f7200376d SHA512 7d6b44e8f2d03544d9825274f4f3039911e335eb51620ded3dc08d51aeb096281c2ec848831815c54eecd4f2a25bdb1e6e5f479422e5291f03c3055da7ba52e6 WHIRLPOOL 6e7c45ef09fc2e86f0b79787043a9bf9954b5ef57fb16f9d453734680ff947abd8fb6665c5da4dac09850f5ab6a414039aa067803ecdeb2efd8537b8909f1ff9
diff --git a/sys-power/nut/files/lighttpd_nut.conf-2.2.0 b/sys-power/nut/files/lighttpd_nut.conf-2.2.0
new file mode 100644
index 000000000000..5912e1c9a509
--- /dev/null
+++ b/sys-power/nut/files/lighttpd_nut.conf-2.2.0
@@ -0,0 +1,23 @@
+###############################################################################
+# Lighttpd configuration for using NUT under Gentoo Linux.
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+###############################################################################
+
+# Simple copy this to /etc/lighttpd/ and include it in your lighttpd.conf.
+# It will make NUT available at http://$HOST/nut/
+
+server.modules += ("mod_cgi")
+
+# If you want to limit it to some host, uncomment the host check and modify it to your needs.
+# $HTTP["host"] == "www2.example.org" {
+alias.url += ( "/nut/" => "/usr/share/nut/cgi/" )
+$HTTP["url"] =~ "^/nut/" {
+ dir-listing.activate = "disable"
+ cgi.assign = ( ".cgi" => "" )
+ index-file.names = ( "upsstats.cgi" )
+}
+# }
+
+# vim: set ft=conf foldmethod=marker et :
diff --git a/sys-power/nut/files/nut-2.2.2-init.d-upsd b/sys-power/nut/files/nut-2.2.2-init.d-upsd
new file mode 100755
index 000000000000..5d945fe3fa44
--- /dev/null
+++ b/sys-power/nut/files/nut-2.2.2-init.d-upsd
@@ -0,0 +1,38 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+extra_started_commands="reload"
+
+pidfile=/var/lib/nut/upsd.pid
+bin=/usr/sbin/upsd
+
+depend() {
+ need net
+ before upsmon
+ after upsdrv
+}
+
+start() {
+ ebegin "Starting upsd"
+ # clean up first
+ pkill -u root,nut -x ${bin}
+ sleep 1s
+ rm -f ${pidfile}
+ # now start up
+ start-stop-daemon --start --quiet --exec ${bin}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping upsd"
+ start-stop-daemon --stop --quiet --pidfile ${pidfile}
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading upsd"
+ start-stop-daemon --stop --signal HUP --oknodo --quiet --pidfile ${pidfile}
+ eend $?
+}
diff --git a/sys-power/nut/files/nut-2.2.2-init.d-upsdrv b/sys-power/nut/files/nut-2.2.2-init.d-upsdrv
new file mode 100755
index 000000000000..d6ac3785e7c2
--- /dev/null
+++ b/sys-power/nut/files/nut-2.2.2-init.d-upsdrv
@@ -0,0 +1,44 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+extra_commands="stopall startall"
+
+UPSNAME=${SVCNAME#*.}
+msgtext="drivers"
+[ "${UPSNAME}" == "${SVCNAME}" ] && UPSNAME=''
+[ -n "$UPSNAME" ] && msgtext="driver for $UPSNAME"
+
+depend() {
+ before upsd
+ [ "${UPSNAME}" != '' ] && provide upsdrv
+}
+
+start() {
+ _dostart "$UPSNAME" "$msgtext"
+}
+stop() {
+ _dostop "$UPSNAME" "$msgtext"
+}
+
+startall() {
+ _dostart "" "$msgtext"
+}
+stopall() {
+ _dostop "" "$msgtext"
+}
+
+_dostart() {
+ ebegin "Starting UPS $msgtext"
+ /usr/sbin/upsdrvctl start $UPSNAME
+ eend $? "Failed to start UPS $msgtext!"
+}
+
+_dostop() {
+ # The pidfile names depend on the actual UPS name
+ # Not in our control at all
+ ebegin "Stopping UPS $msgtext"
+ /usr/sbin/upsdrvctl stop $UPSNAME
+ eend $? "Failed to stop UPS $msgtext!"
+}
diff --git a/sys-power/nut/files/nut-2.2.2-init.d-upsmon b/sys-power/nut/files/nut-2.2.2-init.d-upsmon
new file mode 100755
index 000000000000..4f122cec7d3e
--- /dev/null
+++ b/sys-power/nut/files/nut-2.2.2-init.d-upsmon
@@ -0,0 +1,30 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+extra_started_commands="reload"
+
+pidfile=/var/run/upsmon.pid
+bin=/usr/sbin/upsmon
+
+depend() {
+ need net
+}
+
+start() {
+ ebegin "Starting upsmon"
+ start-stop-daemon --start --quiet --exec ${bin}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping upsmon"
+ start-stop-daemon --stop --quiet --pidfile ${pidfile}
+ eend $?
+}
+reload() {
+ ebegin "Reloading upsd"
+ start-stop-daemon --stop --signal HUP --oknodo --quiet --pidfile ${pidfile}
+ eend $?
+}
diff --git a/sys-power/nut/files/nut-2.4.1-no-libdummy.patch b/sys-power/nut/files/nut-2.4.1-no-libdummy.patch
new file mode 100644
index 000000000000..31a8e73e54f1
--- /dev/null
+++ b/sys-power/nut/files/nut-2.4.1-no-libdummy.patch
@@ -0,0 +1,18 @@
+diff -Nuar nut-2.4.1.orig/drivers/Makefile.am nut-2.4.1/drivers/Makefile.am
+--- nut-2.4.1.orig/drivers/Makefile.am 2008-07-04 20:12:38.201211819 -0700
++++ nut-2.4.1/drivers/Makefile.am 2008-07-04 20:12:59.829462787 -0700
+@@ -211,10 +211,12 @@
+ upscode2.h victronups.h powerpanel.h powerp-bin.h powerp-txt.h \
+ upshandler.h netxml-ups.h mge-xml.h
+
++EXTRA_LIBRARIES =
++
+ # Define a dummy library so that Automake builds rules for the
+ # corresponding object files. This library is not actually built,
+-EXTRA_LIBRARIES = libdummy.a
+-libdummy_a_SOURCES = main.c dstate.c serial.c
++#EXTRA_LIBRARIES += libdummy.a
++#libdummy_a_SOURCES = main.c dstate.c serial.c
+
+ # the nuthalmain library combines the code for main-hal.c and
+ # dstate-hal.c. It is necessary for Automake-technical reasons,
diff --git a/sys-power/nut/files/nut-2.4.3-lowspeed-buffer-size.patch b/sys-power/nut/files/nut-2.4.3-lowspeed-buffer-size.patch
new file mode 100644
index 000000000000..e9a4da8fab2d
--- /dev/null
+++ b/sys-power/nut/files/nut-2.4.3-lowspeed-buffer-size.patch
@@ -0,0 +1,21 @@
+http://bugs.gentoo.org/show_bug.cgi?id=318937
+http://boxster.ghz.cc/projects/nut/changeset/2407
+
+Index: /trunk/drivers/libhid.c
+===================================================================
+--- /trunk/drivers/libhid.c (revision 2336)
++++ /trunk/drivers/libhid.c (revision 2407)
+@@ -142,5 +142,5 @@
+ int id = pData->ReportID;
+ int r;
+- unsigned char buf[SMALLBUF];
++ unsigned char buf[8]; /* Maximum size for low-speed USB devices */
+
+ if (rbuf->ts[id] + age > time(NULL)) {
+@@ -470,5 +470,5 @@
+ int HIDGetEvents(hid_dev_handle_t udev, HIDData_t **event, int eventsize)
+ {
+- unsigned char buf[SMALLBUF];
++ unsigned char buf[8]; /* Maximum size for low-speed USB devices */
+ int itemCount = 0;
+ int buflen, r, i;
diff --git a/sys-power/nut/files/nut-2.6.2-lowspeed-buffer-size.patch b/sys-power/nut/files/nut-2.6.2-lowspeed-buffer-size.patch
new file mode 100644
index 000000000000..9806d07e53ba
--- /dev/null
+++ b/sys-power/nut/files/nut-2.6.2-lowspeed-buffer-size.patch
@@ -0,0 +1,16 @@
+http://bugs.gentoo.org/show_bug.cgi?id=318937
+http://boxster.ghz.cc/projects/nut/changeset/2407
+
+Respun from nut-2.4.3-lowspeed-buffer-size.patch
+
+Index: /trunk/drivers/libhid.c
+===================================================================
+--- /trunk/drivers/libhid.c (revision 2336)
++++ /trunk/drivers/libhid.c (revision 2407)
+@@ -142,5 +142,5 @@
+ int id = pData->ReportID;
+ int r;
+- unsigned char buf[SMALLBUF];
++ unsigned char buf[8]; /* Maximum size for low-speed USB devices */
+
+ if (rbuf->ts[id] + age > time(NULL)) {
diff --git a/sys-power/nut/files/nut-2.6.3-CVE-2012-2944.patch b/sys-power/nut/files/nut-2.6.3-CVE-2012-2944.patch
new file mode 100644
index 000000000000..9debd3b9da3f
--- /dev/null
+++ b/sys-power/nut/files/nut-2.6.3-CVE-2012-2944.patch
@@ -0,0 +1,21 @@
+Origin: http://trac.networkupstools.org/projects/nut/changeset/3633
+Description: Fix CVE-2012-2944: upsd can be remotely crashed
+
+Index: nut-2.6.3/common/parseconf.c
+===================================================================
+--- nut-2.6.3.orig/common/parseconf.c 2011-10-04 02:06:25.000000000 -0500
++++ nut-2.6.3/common/parseconf.c 2012-05-30 13:29:41.000000000 -0500
+@@ -171,6 +171,13 @@
+
+ wbuflen = strlen(ctx->wordbuf);
+
++ /* CVE-2012-2944: only allow the subset Ascii charset from Space to ~ */
++ if ((ctx->ch < 0x20) || (ctx->ch > 0x7f)) {
++ fprintf(stderr, "addchar: discarding invalid character (0x%02x)!\n",
++ ctx->ch);
++ return;
++ }
++
+ if (ctx->wordlen_limit != 0) {
+ if (wbuflen >= ctx->wordlen_limit) {
+
diff --git a/sys-power/nut/files/nut-2.6.5-freeipmi_fru.patch b/sys-power/nut/files/nut-2.6.5-freeipmi_fru.patch
new file mode 100644
index 000000000000..96ac91d0a48c
--- /dev/null
+++ b/sys-power/nut/files/nut-2.6.5-freeipmi_fru.patch
@@ -0,0 +1,448 @@
+Update to 1.2.x ipmi_fru declarations.
+
+Starting with the 1.2.1 release, all of the ipmi_fru_parse* declarations (both
+lowercase & uppercase) were renamed to ipmi_fru*. This is a simple search &
+replace of all instances. Upstream should probably have a backwards compatible
+version that supports both variants of the names.
+
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+
+diff -Nuar nut-2.6.5.orig/drivers/nut-libfreeipmi.c nut-2.6.5/drivers/nut-libfreeipmi.c
+--- nut-2.6.5.orig/drivers/nut-libfreeipmi.c 2012-07-31 17:38:59.000000000 +0000
++++ nut-2.6.5/drivers/nut-libfreeipmi.c 2013-08-12 17:55:03.132363518 +0000
+@@ -57,7 +57,7 @@
+
+ /* FreeIPMI contexts and configuration*/
+ ipmi_ctx_t ipmi_ctx = NULL;
+-ipmi_fru_parse_ctx_t fru_parse_ctx = NULL;
++ipmi_fru_ctx_t fru_parse_ctx = NULL;
+ ipmi_monitoring_ctx_t mon_ctx = NULL;
+ struct ipmi_monitoring_ipmi_config ipmi_config;
+ /* SDR management API has changed with 1.1.X and later */
+@@ -78,7 +78,7 @@
+
+ /* Support functions */
+ static const char* libfreeipmi_getfield (uint8_t language_code,
+- ipmi_fru_parse_field_t *field);
++ ipmi_fru_field_t *field);
+
+ static void libfreeipmi_cleanup();
+
+@@ -97,7 +97,7 @@
+ int nut_ipmi_open(int ipmi_id, IPMIDevice_t *ipmi_dev)
+ {
+ int ret = -1;
+- uint8_t areabuf[IPMI_FRU_PARSE_AREA_SIZE_MAX+1];
++ uint8_t areabuf[IPMI_FRU_AREA_SIZE_MAX+1];
+ unsigned int area_type = 0;
+ unsigned int area_length = 0;
+
+@@ -134,26 +134,26 @@
+ upsdebugx(1, "FreeIPMI initialized...");
+
+ /* Parse FRU information */
+- if (!(fru_parse_ctx = ipmi_fru_parse_ctx_create (ipmi_ctx)))
++ if (!(fru_parse_ctx = ipmi_fru_ctx_create (ipmi_ctx)))
+ {
+ libfreeipmi_cleanup();
+- fatal_with_errno(EXIT_FAILURE, "ipmi_fru_parse_ctx_create()");
++ fatal_with_errno(EXIT_FAILURE, "ipmi_fru_ctx_create()");
+ }
+
+ /* lots of motherboards calculate checksums incorrectly */
+- if (ipmi_fru_parse_ctx_set_flags (fru_parse_ctx, IPMI_FRU_PARSE_FLAGS_SKIP_CHECKSUM_CHECKS) < 0)
++ if (ipmi_fru_ctx_set_flags (fru_parse_ctx, IPMI_FRU_FLAGS_SKIP_CHECKSUM_CHECKS) < 0)
+ {
+ libfreeipmi_cleanup();
+- fatalx(EXIT_FAILURE, "ipmi_fru_parse_ctx_set_flags: %s\n",
+- ipmi_fru_parse_ctx_strerror (ipmi_fru_parse_ctx_errnum (fru_parse_ctx)));
++ fatalx(EXIT_FAILURE, "ipmi_fru_ctx_set_flags: %s\n",
++ ipmi_fru_ctx_strerror (ipmi_fru_ctx_errnum (fru_parse_ctx)));
+ }
+
+ /* Now open the requested (local) PSU */
+- if (ipmi_fru_parse_open_device_id (fru_parse_ctx, ipmi_id) < 0)
++ if (ipmi_fru_open_device_id (fru_parse_ctx, ipmi_id) < 0)
+ {
+ libfreeipmi_cleanup();
+- fatalx(EXIT_FAILURE, "ipmi_fru_parse_open_device_id: %s\n",
+- ipmi_fru_parse_ctx_errormsg (fru_parse_ctx));
++ fatalx(EXIT_FAILURE, "ipmi_fru_open_device_id: %s\n",
++ ipmi_fru_ctx_errormsg (fru_parse_ctx));
+ }
+
+ /* Set IPMI identifier */
+@@ -164,19 +164,19 @@
+ /* clear fields */
+ area_type = 0;
+ area_length = 0;
+- memset (areabuf, '\0', IPMI_FRU_PARSE_AREA_SIZE_MAX + 1);
++ memset (areabuf, '\0', IPMI_FRU_AREA_SIZE_MAX + 1);
+
+ /* parse FRU buffer */
+- if (ipmi_fru_parse_read_data_area (fru_parse_ctx,
++ if (ipmi_fru_read_data_area (fru_parse_ctx,
+ &area_type,
+ &area_length,
+ areabuf,
+- IPMI_FRU_PARSE_AREA_SIZE_MAX) < 0)
++ IPMI_FRU_AREA_SIZE_MAX) < 0)
+ {
+ libfreeipmi_cleanup();
+ fatal_with_errno(EXIT_FAILURE,
+- "ipmi_fru_parse_open_device_id: %s\n",
+- ipmi_fru_parse_ctx_errormsg (fru_parse_ctx));
++ "ipmi_fru_open_device_id: %s\n",
++ ipmi_fru_ctx_errormsg (fru_parse_ctx));
+ }
+
+ if (area_length)
+@@ -184,7 +184,7 @@
+ switch (area_type)
+ {
+ /* get generic board information */
+- case IPMI_FRU_PARSE_AREA_TYPE_BOARD_INFO_AREA:
++ case IPMI_FRU_AREA_TYPE_BOARD_INFO_AREA:
+
+ if(libfreeipmi_get_board_info (areabuf, area_length,
+ ipmi_dev) < 0)
+@@ -193,7 +193,7 @@
+ }
+ break;
+ /* get specific PSU information */
+- case IPMI_FRU_PARSE_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION:
++ case IPMI_FRU_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION:
+
+ if(libfreeipmi_get_psu_info (areabuf, area_length, ipmi_dev) < 0)
+ {
+@@ -205,13 +205,13 @@
+ break;
+ }
+ }
+- } while ((ret = ipmi_fru_parse_next (fru_parse_ctx)) == 1);
++ } while ((ret = ipmi_fru_next (fru_parse_ctx)) == 1);
+
+ /* check for errors */
+ if (ret < 0) {
+ libfreeipmi_cleanup();
+- fatal_with_errno(EXIT_FAILURE, "ipmi_fru_parse_next: %s",
+- ipmi_fru_parse_ctx_errormsg (fru_parse_ctx));
++ fatal_with_errno(EXIT_FAILURE, "ipmi_fru_next: %s",
++ ipmi_fru_ctx_errormsg (fru_parse_ctx));
+ }
+ else {
+ /* Get all related sensors information */
+@@ -232,25 +232,25 @@
+ }
+
+ static const char* libfreeipmi_getfield (uint8_t language_code,
+- ipmi_fru_parse_field_t *field)
++ ipmi_fru_field_t *field)
+ {
+- static char strbuf[IPMI_FRU_PARSE_AREA_STRING_MAX + 1];
+- unsigned int strbuflen = IPMI_FRU_PARSE_AREA_STRING_MAX;
++ static char strbuf[IPMI_FRU_AREA_STRING_MAX + 1];
++ unsigned int strbuflen = IPMI_FRU_AREA_STRING_MAX;
+
+ if (!field->type_length_field_length)
+ return NULL;
+
+- memset (strbuf, '\0', IPMI_FRU_PARSE_AREA_STRING_MAX + 1);
++ memset (strbuf, '\0', IPMI_FRU_AREA_STRING_MAX + 1);
+
+- if (ipmi_fru_parse_type_length_field_to_string (fru_parse_ctx,
++ if (ipmi_fru_type_length_field_to_string (fru_parse_ctx,
+ field->type_length_field,
+ field->type_length_field_length,
+ language_code,
+ strbuf,
+ &strbuflen) < 0)
+ {
+- upsdebugx (2, "ipmi_fru_parse_type_length_field_to_string: %s",
+- ipmi_fru_parse_ctx_errormsg (fru_parse_ctx));
++ upsdebugx (2, "ipmi_fru_type_length_field_to_string: %s",
++ ipmi_fru_ctx_errormsg (fru_parse_ctx));
+ return NULL;
+ }
+
+@@ -280,8 +280,8 @@
+ {
+ /* cleanup */
+ if (fru_parse_ctx) {
+- ipmi_fru_parse_close_device_id (fru_parse_ctx);
+- ipmi_fru_parse_ctx_destroy (fru_parse_ctx);
++ ipmi_fru_close_device_id (fru_parse_ctx);
++ ipmi_fru_ctx_destroy (fru_parse_ctx);
+ }
+
+ #ifdef HAVE_FREEIPMI_11X_12X
+@@ -342,7 +342,7 @@
+
+ upsdebugx(1, "entering libfreeipmi_get_psu_info()");
+
+- if (ipmi_fru_parse_multirecord_power_supply_information (fru_parse_ctx,
++ if (ipmi_fru_multirecord_power_supply_information (fru_parse_ctx,
+ areabuf,
+ area_length,
+ &overall_capacity,
+@@ -368,8 +368,8 @@
+ &total_combined_wattage,
+ &predictive_fail_tachometer_lower_threshold) < 0)
+ {
+- fatalx(EXIT_FAILURE, "ipmi_fru_parse_multirecord_power_supply_information: %s",
+- ipmi_fru_parse_ctx_errormsg (fru_parse_ctx));
++ fatalx(EXIT_FAILURE, "ipmi_fru_multirecord_power_supply_information: %s",
++ ipmi_fru_ctx_errormsg (fru_parse_ctx));
+ }
+
+ ipmi_dev->overall_capacity = overall_capacity;
+@@ -392,12 +392,12 @@
+ {
+ uint8_t language_code;
+ uint32_t mfg_date_time;
+- ipmi_fru_parse_field_t board_manufacturer;
+- ipmi_fru_parse_field_t board_product_name;
+- ipmi_fru_parse_field_t board_serial_number;
+- ipmi_fru_parse_field_t board_part_number;
+- ipmi_fru_parse_field_t board_fru_file_id;
+- ipmi_fru_parse_field_t board_custom_fields[IPMI_FRU_CUSTOM_FIELDS];
++ ipmi_fru_field_t board_manufacturer;
++ ipmi_fru_field_t board_product_name;
++ ipmi_fru_field_t board_serial_number;
++ ipmi_fru_field_t board_part_number;
++ ipmi_fru_field_t board_fru_file_id;
++ ipmi_fru_field_t board_custom_fields[IPMI_FRU_CUSTOM_FIELDS];
+ const char *string = NULL;
+ time_t timetmp;
+ struct tm mfg_date_time_tm;
+@@ -406,15 +406,15 @@
+ upsdebugx(1, "entering libfreeipmi_get_board_info()");
+
+ /* clear fields */
+- memset (&board_manufacturer, '\0', sizeof (ipmi_fru_parse_field_t));
+- memset (&board_product_name, '\0', sizeof (ipmi_fru_parse_field_t));
+- memset (&board_serial_number, '\0', sizeof (ipmi_fru_parse_field_t));
+- memset (&board_fru_file_id, '\0', sizeof (ipmi_fru_parse_field_t));
++ memset (&board_manufacturer, '\0', sizeof (ipmi_fru_field_t));
++ memset (&board_product_name, '\0', sizeof (ipmi_fru_field_t));
++ memset (&board_serial_number, '\0', sizeof (ipmi_fru_field_t));
++ memset (&board_fru_file_id, '\0', sizeof (ipmi_fru_field_t));
+ memset (&board_custom_fields[0], '\0',
+- sizeof (ipmi_fru_parse_field_t) * IPMI_FRU_CUSTOM_FIELDS);
++ sizeof (ipmi_fru_field_t) * IPMI_FRU_CUSTOM_FIELDS);
+
+ /* parse FRU buffer */
+- if (ipmi_fru_parse_board_info_area (fru_parse_ctx,
++ if (ipmi_fru_board_info_area (fru_parse_ctx,
+ areabuf,
+ area_length,
+ &language_code,
+@@ -428,8 +428,8 @@
+ IPMI_FRU_CUSTOM_FIELDS) < 0)
+ {
+ libfreeipmi_cleanup();
+- fatalx(EXIT_FAILURE, "ipmi_fru_parse_board_info_area: %s",
+- ipmi_fru_parse_ctx_errormsg (fru_parse_ctx));
++ fatalx(EXIT_FAILURE, "ipmi_fru_board_info_area: %s",
++ ipmi_fru_ctx_errormsg (fru_parse_ctx));
+ }
+
+
+diff -Nuar nut-2.6.5.orig/m4/nut_check_libfreeipmi.m4 nut-2.6.5/m4/nut_check_libfreeipmi.m4
+--- nut-2.6.5.orig/m4/nut_check_libfreeipmi.m4 2012-07-31 17:38:56.000000000 +0000
++++ nut-2.6.5/m4/nut_check_libfreeipmi.m4 2013-08-12 17:55:03.132363518 +0000
+@@ -66,7 +66,7 @@
+ dnl when version cannot be tested (prior to 1.0.5, with no pkg-config)
+ dnl we have to check for some specific functions
+ AC_SEARCH_LIBS([ipmi_ctx_find_inband], [freeipmi], [], [nut_have_freeipmi=no])
+- AC_SEARCH_LIBS([ipmi_fru_parse_ctx_create], [freeipmi], [], [nut_have_freeipmi=no])
++ AC_SEARCH_LIBS([ipmi_fru_ctx_create], [freeipmi], [], [nut_have_freeipmi=no])
+
+ AC_SEARCH_LIBS([ipmi_monitoring_init], [ipmimonitoring], [nut_have_freeipmi_monitoring=yes], [nut_have_freeipmi_monitoring=no])
+ AC_SEARCH_LIBS([ipmi_monitoring_sensor_read_record_id], [ipmimonitoring], [], [nut_have_freeipmi_monitoring=no])
+diff -Nuar nut-2.6.5.orig/tools/nut-scanner/scan_ipmi.c nut-2.6.5/tools/nut-scanner/scan_ipmi.c
+--- nut-2.6.5.orig/tools/nut-scanner/scan_ipmi.c 2012-07-31 17:38:58.000000000 +0000
++++ nut-2.6.5/tools/nut-scanner/scan_ipmi.c 2013-08-12 17:55:03.132363518 +0000
+@@ -34,24 +34,24 @@
+ static lt_dlhandle dl_handle = NULL;
+ static const char *dl_error = NULL;
+
+-static int (*nut_ipmi_fru_parse_close_device_id) (ipmi_fru_parse_ctx_t ctx);
+-static void (*nut_ipmi_fru_parse_ctx_destroy) (ipmi_fru_parse_ctx_t ctx);
++static int (*nut_ipmi_fru_close_device_id) (ipmi_fru_ctx_t ctx);
++static void (*nut_ipmi_fru_ctx_destroy) (ipmi_fru_ctx_t ctx);
+ #ifdef HAVE_FREEIPMI_11X_12X
+ static void (*nut_ipmi_sdr_ctx_destroy) (ipmi_sdr_ctx_t ctx);
+ #else /* HAVE_FREEIPMI_11X_12X */
+ static void (*nut_ipmi_sdr_cache_ctx_destroy) (ipmi_sdr_cache_ctx_t ctx);
+ static void (*nut_ipmi_sdr_parse_ctx_destroy) (ipmi_sdr_parse_ctx_t ctx);
+ #endif /* HAVE_FREEIPMI_11X_12X */
+-static ipmi_fru_parse_ctx_t (*nut_ipmi_fru_parse_ctx_create) (ipmi_ctx_t ipmi_ctx);
+-static int (*nut_ipmi_fru_parse_ctx_set_flags) (ipmi_fru_parse_ctx_t ctx, unsigned int flags);
+-static int (*nut_ipmi_fru_parse_open_device_id) (ipmi_fru_parse_ctx_t ctx, uint8_t fru_device_id);
+-static char * (*nut_ipmi_fru_parse_ctx_errormsg) (ipmi_fru_parse_ctx_t ctx);
+-static int (*nut_ipmi_fru_parse_read_data_area) (ipmi_fru_parse_ctx_t ctx,
++static ipmi_fru_ctx_t (*nut_ipmi_fru_ctx_create) (ipmi_ctx_t ipmi_ctx);
++static int (*nut_ipmi_fru_ctx_set_flags) (ipmi_fru_ctx_t ctx, unsigned int flags);
++static int (*nut_ipmi_fru_open_device_id) (ipmi_fru_ctx_t ctx, uint8_t fru_device_id);
++static char * (*nut_ipmi_fru_ctx_errormsg) (ipmi_fru_ctx_t ctx);
++static int (*nut_ipmi_fru_read_data_area) (ipmi_fru_ctx_t ctx,
+ unsigned int *area_type,
+ unsigned int *area_length,
+ void *areabuf,
+ unsigned int areabuflen);
+-static int (*nut_ipmi_fru_parse_next) (ipmi_fru_parse_ctx_t ctx);
++static int (*nut_ipmi_fru_next) (ipmi_fru_ctx_t ctx);
+ static ipmi_ctx_t (*nut_ipmi_ctx_create) (void);
+ static int (*nut_ipmi_ctx_find_inband) (ipmi_ctx_t ctx,
+ ipmi_driver_type_t *driver_type,
+@@ -92,12 +92,12 @@
+ /* Clear any existing error */
+ lt_dlerror();
+
+- *(void **) (&nut_ipmi_fru_parse_close_device_id) = lt_dlsym(dl_handle, "ipmi_fru_parse_close_device_id");
++ *(void **) (&nut_ipmi_fru_close_device_id) = lt_dlsym(dl_handle, "ipmi_fru_close_device_id");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+
+- *(void **) (&nut_ipmi_fru_parse_ctx_destroy) = lt_dlsym(dl_handle, "ipmi_fru_parse_ctx_destroy");
++ *(void **) (&nut_ipmi_fru_ctx_destroy) = lt_dlsym(dl_handle, "ipmi_fru_ctx_destroy");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+@@ -122,32 +122,32 @@
+ }
+ #endif /* HAVE_FREEIPMI_11X_12X */
+
+- *(void **) (&nut_ipmi_fru_parse_ctx_create) = lt_dlsym(dl_handle, "ipmi_fru_parse_ctx_create");
++ *(void **) (&nut_ipmi_fru_ctx_create) = lt_dlsym(dl_handle, "ipmi_fru_ctx_create");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+
+- *(void **) (&nut_ipmi_fru_parse_ctx_set_flags) = lt_dlsym(dl_handle, "ipmi_fru_parse_ctx_set_flags");
++ *(void **) (&nut_ipmi_fru_ctx_set_flags) = lt_dlsym(dl_handle, "ipmi_fru_ctx_set_flags");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+
+- *(void **) (&nut_ipmi_fru_parse_open_device_id) = lt_dlsym(dl_handle, "ipmi_fru_parse_open_device_id");
++ *(void **) (&nut_ipmi_fru_open_device_id) = lt_dlsym(dl_handle, "ipmi_fru_open_device_id");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+
+- *(void **) (&nut_ipmi_fru_parse_ctx_errormsg) = lt_dlsym(dl_handle, "ipmi_fru_parse_ctx_errormsg");
++ *(void **) (&nut_ipmi_fru_ctx_errormsg) = lt_dlsym(dl_handle, "ipmi_fru_ctx_errormsg");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+
+- *(void **) (&nut_ipmi_fru_parse_read_data_area) = lt_dlsym(dl_handle, "ipmi_fru_parse_read_data_area");
++ *(void **) (&nut_ipmi_fru_read_data_area) = lt_dlsym(dl_handle, "ipmi_fru_read_data_area");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+
+- *(void **) (&nut_ipmi_fru_parse_next) = lt_dlsym(dl_handle, "ipmi_fru_parse_next");
++ *(void **) (&nut_ipmi_fru_next) = lt_dlsym(dl_handle, "ipmi_fru_next");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+@@ -188,17 +188,17 @@
+
+ /* Cleanup IPMI contexts */
+ #ifdef HAVE_FREEIPMI_11X_12X
+-static void nut_freeipmi_cleanup(ipmi_fru_parse_ctx_t fru_parse_ctx,
++static void nut_freeipmi_cleanup(ipmi_fru_ctx_t fru_parse_ctx,
+ ipmi_sdr_ctx_t sdr_ctx)
+ #else /* HAVE_FREEIPMI_11X_12X */
+-static void nut_freeipmi_cleanup(ipmi_fru_parse_ctx_t fru_parse_ctx,
++static void nut_freeipmi_cleanup(ipmi_fru_ctx_t fru_parse_ctx,
+ ipmi_sdr_cache_ctx_t sdr_cache_ctx,
+ ipmi_sdr_parse_ctx_t sdr_parse_ctx)
+ #endif /* HAVE_FREEIPMI_11X_12X */
+ {
+ if (fru_parse_ctx) {
+- (*nut_ipmi_fru_parse_close_device_id) (fru_parse_ctx);
+- (*nut_ipmi_fru_parse_ctx_destroy) (fru_parse_ctx);
++ (*nut_ipmi_fru_close_device_id) (fru_parse_ctx);
++ (*nut_ipmi_fru_ctx_destroy) (fru_parse_ctx);
+ }
+
+ #ifdef HAVE_FREEIPMI_11X_12X
+@@ -226,8 +226,8 @@
+ int ret = -1;
+ unsigned int area_type = 0;
+ unsigned int area_length = 0;
+- uint8_t areabuf[IPMI_FRU_PARSE_AREA_SIZE_MAX+1];
+- ipmi_fru_parse_ctx_t fru_parse_ctx = NULL;
++ uint8_t areabuf[IPMI_FRU_AREA_SIZE_MAX+1];
++ ipmi_fru_ctx_t fru_parse_ctx = NULL;
+ #ifdef HAVE_FREEIPMI_11X_12X
+ ipmi_sdr_ctx_t sdr_ctx = NULL;
+ #else /* HAVE_FREEIPMI_11X_12X */
+@@ -236,14 +236,14 @@
+ #endif /* HAVE_FREEIPMI_11X_12X */
+
+ /* Parse FRU information */
+- if (!(fru_parse_ctx = (*nut_ipmi_fru_parse_ctx_create) (ipmi_ctx)))
++ if (!(fru_parse_ctx = (*nut_ipmi_fru_ctx_create) (ipmi_ctx)))
+ {
+- fprintf(stderr, "ipmi_fru_parse_ctx_create()\n");
++ fprintf(stderr, "ipmi_fru_ctx_create()\n");
+ return 0;
+ }
+
+ /* lots of motherboards calculate checksums incorrectly */
+- if ((*nut_ipmi_fru_parse_ctx_set_flags) (fru_parse_ctx, IPMI_FRU_PARSE_FLAGS_SKIP_CHECKSUM_CHECKS) < 0)
++ if ((*nut_ipmi_fru_ctx_set_flags) (fru_parse_ctx, IPMI_FRU_FLAGS_SKIP_CHECKSUM_CHECKS) < 0)
+ {
+ #ifdef HAVE_FREEIPMI_11X_12X
+ nut_freeipmi_cleanup(fru_parse_ctx, sdr_ctx);
+@@ -253,7 +253,7 @@
+ return 0;
+ }
+
+- if ((*nut_ipmi_fru_parse_open_device_id) (fru_parse_ctx, ipmi_id) < 0)
++ if ((*nut_ipmi_fru_open_device_id) (fru_parse_ctx, ipmi_id) < 0)
+ {
+ #ifdef HAVE_FREEIPMI_11X_12X
+ nut_freeipmi_cleanup(fru_parse_ctx, sdr_ctx);
+@@ -268,14 +268,14 @@
+ /* clear fields */
+ area_type = 0;
+ area_length = 0;
+- memset (areabuf, '\0', IPMI_FRU_PARSE_AREA_SIZE_MAX + 1);
++ memset (areabuf, '\0', IPMI_FRU_AREA_SIZE_MAX + 1);
+
+ /* parse FRU buffer */
+- if ((*nut_ipmi_fru_parse_read_data_area) (fru_parse_ctx,
++ if ((*nut_ipmi_fru_read_data_area) (fru_parse_ctx,
+ &area_type,
+ &area_length,
+ areabuf,
+- IPMI_FRU_PARSE_AREA_SIZE_MAX) < 0)
++ IPMI_FRU_AREA_SIZE_MAX) < 0)
+ {
+ #ifdef HAVE_FREEIPMI_11X_12X
+ nut_freeipmi_cleanup(fru_parse_ctx, sdr_ctx);
+@@ -287,7 +287,7 @@
+
+ if (area_length)
+ {
+- if (area_type == IPMI_FRU_PARSE_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION)
++ if (area_type == IPMI_FRU_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION)
+ {
+ /* Found a POWER_SUPPLY record */
+ #ifdef HAVE_FREEIPMI_11X_12X
+@@ -298,7 +298,7 @@
+ return 1;
+ }
+ }
+- } while ((ret = (*nut_ipmi_fru_parse_next) (fru_parse_ctx)) == 1);
++ } while ((ret = (*nut_ipmi_fru_next) (fru_parse_ctx)) == 1);
+
+ /* No need for further errors checking */
+ #ifdef HAVE_FREEIPMI_11X_12X
diff --git a/sys-power/nut/files/nut-2.6.5-init.d-upsd b/sys-power/nut/files/nut-2.6.5-init.d-upsd
new file mode 100755
index 000000000000..320831c0dafe
--- /dev/null
+++ b/sys-power/nut/files/nut-2.6.5-init.d-upsd
@@ -0,0 +1,38 @@
+#!/sbin/runscript
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+extra_started_commands="reload"
+
+pidfile=/var/lib/nut/upsd.pid
+bin=/usr/sbin/upsd
+
+depend() {
+ use net
+ before upsmon
+ after upsdrv
+}
+
+start() {
+ ebegin "Starting upsd"
+ # clean up first
+ pkill -u root,nut -x ${bin}
+ sleep 1s
+ rm -f ${pidfile}
+ # now start up
+ start-stop-daemon --start --quiet --exec ${bin}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping upsd"
+ start-stop-daemon --stop --quiet --pidfile ${pidfile}
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading upsd"
+ start-stop-daemon --stop --signal HUP --oknodo --quiet --pidfile ${pidfile}
+ eend $?
+}
diff --git a/sys-power/nut/files/nut-2.6.5-init.d-upslog b/sys-power/nut/files/nut-2.6.5-init.d-upslog
new file mode 100644
index 000000000000..a5313be2a987
--- /dev/null
+++ b/sys-power/nut/files/nut-2.6.5-init.d-upslog
@@ -0,0 +1,31 @@
+#!/sbin/runscript
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+extra_started_commands="reload"
+
+pidfile=/var/run/upslog.pid
+bin=/usr/bin/upslog
+
+depend() {
+ use upsdrv
+ after upsdrv
+}
+
+start() {
+ ebegin "Starting upslog"
+ start-stop-daemon --start --quiet --exec ${bin}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping upslog"
+ start-stop-daemon --stop --quiet --pidfile ${pidfile}
+ eend $?
+}
+reload() {
+ ebegin "Reloading upslog"
+ start-stop-daemon --stop --signal HUP --oknodo --quiet --pidfile ${pidfile}
+ eend $?
+}
diff --git a/sys-power/nut/files/nut-2.6.5-init.d-upsmon b/sys-power/nut/files/nut-2.6.5-init.d-upsmon
new file mode 100755
index 000000000000..f36a4261aadf
--- /dev/null
+++ b/sys-power/nut/files/nut-2.6.5-init.d-upsmon
@@ -0,0 +1,30 @@
+#!/sbin/runscript
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+extra_started_commands="reload"
+
+pidfile=/var/run/upsmon.pid
+bin=/usr/sbin/upsmon
+
+depend() {
+ use net
+}
+
+start() {
+ ebegin "Starting upsmon"
+ start-stop-daemon --start --quiet --exec ${bin}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping upsmon"
+ start-stop-daemon --stop --quiet --pidfile ${pidfile}
+ eend $?
+}
+reload() {
+ ebegin "Reloading upsmon"
+ start-stop-daemon --stop --signal HUP --oknodo --quiet --pidfile ${pidfile}
+ eend $?
+}
diff --git a/sys-power/nut/files/nut-2.7.1-fix-scanning.patch b/sys-power/nut/files/nut-2.7.1-fix-scanning.patch
new file mode 100644
index 000000000000..6ef5e681ba96
--- /dev/null
+++ b/sys-power/nut/files/nut-2.7.1-fix-scanning.patch
@@ -0,0 +1,72 @@
+Search for correct libusb in testing.
+
+There may be many libusb libraries on a system, and we need to iterate until we
+find the correct one.
+
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+
+diff -Nuar --exclude .libs --exclude '*.o' --exclude core nut-2.7.1.orig/tools/nut-scanner/scan_usb.c nut-2.7.1/tools/nut-scanner/scan_usb.c
+--- nut-2.7.1.orig/tools/nut-scanner/scan_usb.c 2014-01-04 18:38:22.496816444 -0800
++++ nut-2.7.1/tools/nut-scanner/scan_usb.c 2014-01-04 19:05:04.598647935 -0800
+@@ -28,7 +28,7 @@
+ #include <ltdl.h>
+
+ /* dynamic link library stuff */
+-static char * libname = "libusb";
++static char * libname = "libusb-0.1";
+ static lt_dlhandle dl_handle = NULL;
+ static const char *dl_error = NULL;
+ static int (*nut_usb_close)(usb_dev_handle *dev);
+@@ -41,6 +41,8 @@
+ static usb_dev_handle * (*nut_usb_open)(struct usb_device *dev);
+ static int (*nut_usb_find_devices)(void);
+
++int nutscan_test_usb_library(const char*,void*);
++
+ /* return 0 on error */
+ int nutscan_load_usb_library()
+ {
+@@ -58,6 +60,22 @@
+ return 0;
+ }
+
++ int ret = lt_dlforeachfile(NULL, nutscan_test_usb_library, libname);
++ if(ret == 0) {
++ dl_handle = (void *)1;
++ lt_dlexit();
++ }
++
++ return ret;
++}
++
++int nutscan_test_usb_library(const char *filename, void* data) {
++ char prefix[64];
++ char *libname = (char*) data;
++ sprintf(prefix, "/%s", libname);
++ if(strstr(filename, prefix) == NULL)
++ return 0;
++
+- dl_handle = lt_dlopenext(libname);
++ dl_handle = lt_dlopenext(filename);
+ if (!dl_handle) {
+ dl_error = lt_dlerror();
+ goto err;
+@@ -100,16 +118,15 @@
+ goto err;
+ }
+
+ *(void **)(&nut_usb_find_devices) = lt_dlsym(dl_handle,"usb_find_devices");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+
++ fprintf(stderr, "Loaded USB library (%s from %s) : USB search enabled.\n", libname, filename);
+ return 1;
+ err:
+- fprintf(stderr, "Cannot load USB library (%s) : %s. USB search disabled.\n", libname, dl_error);
+- dl_handle = (void *)1;
+- lt_dlexit();
++ fprintf(stderr, "Cannot load USB library (%s from %s) : %s. USB search disabled.\n", libname, filename, dl_error);
+ return 0;
+ }
+ /* end of dynamic link library stuff */
diff --git a/sys-power/nut/files/nut-2.7.1-snmpusb-order.patch b/sys-power/nut/files/nut-2.7.1-snmpusb-order.patch
new file mode 100644
index 000000000000..e62b6571d2ce
--- /dev/null
+++ b/sys-power/nut/files/nut-2.7.1-snmpusb-order.patch
@@ -0,0 +1,37 @@
+The code that generates the SNMP and USB headers to compile against does not
+have a deterministic order, leading to different results at times.
+
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+
+diff -Nuar --exclude .libs --exclude '*.o' --exclude core nut-2.7.1.orig/tools/nut-snmpinfo.py nut-2.7.1/tools/nut-snmpinfo.py
+--- nut-2.7.1.orig/tools/nut-snmpinfo.py 2014-01-04 19:08:19.117150636 -0800
++++ nut-2.7.1/tools/nut-snmpinfo.py 2013-07-26 12:41:11.000000000 -0700
+@@ -78,7 +78,9 @@
+ output_file.write( "/* SNMP IDs device table */\n" )
+ output_file.write( "static snmp_device_id_t snmp_device_table[] = {\n" )
+
+-for filename in glob.glob('../drivers/*-mib.c'):
++mibs = glob.glob('../drivers/*-mib.c')
++mibs.sort()
++for filename in mibs:
+ list_of_line = open(filename,'r').read().split(';')
+ for line in list_of_line:
+ if "mib2nut_info_t" in line:
+diff -Nuar --exclude .libs --exclude '*.o' --exclude core nut-2.7.1.orig/tools/nut-usbinfo.pl nut-2.7.1/tools/nut-usbinfo.pl
+--- nut-2.7.1.orig/tools/nut-usbinfo.pl 2014-01-04 19:12:45.595949760 -0800
++++ nut-2.7.1/tools/nut-usbinfo.pl 2013-11-17 11:27:38.000000000 -0800
+@@ -75,7 +75,12 @@
+
+ ################# MAIN #################
+
+-find(\&find_usbdevs,$scanPath);
++find({
++ wanted => \&find_usbdevs,
++ follow => 1,
++ preprocess => sub { return sort @_ },
++ },
++ $scanPath);
+ &gen_usb_files;
+
+ ################# SUB METHOD #################
+
diff --git a/sys-power/nut/files/nut-2.7.2/nut-2.7.2-no-libdummy.patch b/sys-power/nut/files/nut-2.7.2/nut-2.7.2-no-libdummy.patch
new file mode 100644
index 000000000000..ca0d8be028f5
--- /dev/null
+++ b/sys-power/nut/files/nut-2.7.2/nut-2.7.2-no-libdummy.patch
@@ -0,0 +1,13 @@
+diff --git a/drivers/Makefile.am b/drivers/Makefile.am
+index 99614ca..42b3611 100644
+--- a/drivers/Makefile.am
++++ b/drivers/Makefile.am
+@@ -267,5 +267,6 @@ dist_noinst_HEADERS = apc-mib.h apc-hid.h baytech-mib.h bcmxcp.h \
+
+ # Define a dummy library so that Automake builds rules for the
+ # corresponding object files. This library is not actually built,
+-EXTRA_LIBRARIES = libdummy.a
+-libdummy_a_SOURCES = main.c dstate.c serial.c
++EXTRA_LIBRARIES =
++#EXTRA_LIBRARIES = libdummy.a
++#libdummy_a_SOURCES = main.c dstate.c serial.c
diff --git a/sys-power/nut/files/nut.powerfail.initd b/sys-power/nut/files/nut.powerfail.initd
new file mode 100644
index 000000000000..352d9661be58
--- /dev/null
+++ b/sys-power/nut/files/nut.powerfail.initd
@@ -0,0 +1,49 @@
+#!/sbin/runscript
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+description='Signal the UPS to kill power in a power failure condition'
+
+depend() {
+ # This is only for baselayout2
+ if [ -f /etc/init.d/sysfs ]; then
+ keyword -jail -lxc -openvz -prefix -uml -vserver -xenu -timeout
+ need mount-ro
+ fi
+}
+
+start() {
+ if [ ! -f /etc/init.d/sysfs ]; then
+ eerror "The $SVCNAME init-script is written for baselayout-2!"
+ eerror "Please do not use it with baselayout-1!".
+ return 1
+ fi
+ local UPS_CTL UPS_POWERDOWN
+
+ if [ -f /etc/killpower -o -f /etc/nut/killpower ]; then
+ UPS_CTL=/sbin/upsdrvctl
+ UPS_POWERDOWN="${UPS_CTL} shutdown"
+ elif [ -f /etc/apcupsd/powerfail ]; then
+ UPS_CTL=/sbin/apcupsd
+ UPS_POWERDOWN="${UPS_CTL} --killpower"
+ else
+ ewarn "UPS powerfail script scheduled, but no poweroff commands found."
+ return 0
+ fi
+
+ if [ -f "${UPS_CTL}" -a -x "${UPS_CTL}" ]; then
+ ebegin 'Signaling UPS to kill power'
+ ${UPS_POWERDOWN}
+ eend $?
+
+ ebegin 'Halt system and wait for the UPS to kill our power'
+ /sbin/halt -id
+ # If the sleep gets hit, something is wrong...
+ # do NOT restart the system.
+ while [ 1 ]; do sleep 60; done
+ else
+ ewarn "UPS powerfail script scheduled, and flags found, but ${UPS_CTL} missing."
+ fi
+}
+
diff --git a/sys-power/nut/metadata.xml b/sys-power/nut/metadata.xml
new file mode 100644
index 000000000000..25533caa4df4
--- /dev/null
+++ b/sys-power/nut/metadata.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>robbat2@gentoo.org</email>
+ <name>Robin H. Johnson</name>
+ </maintainer>
+ <maintainer>
+ <email>prometheanfire@gentoo.org</email>
+ </maintainer>
+ <use>
+ <flag name="ipmi">Support IPMI-based UPSes.</flag>
+ <flag name="ups_drivers_al175">Driver for Eltek UPS models with AL175 alarm module</flag>
+ <flag name="ups_drivers_bcmxcp">Driver for UPSes supporting the serial BCM/XCP protocol</flag>
+ <flag name="ups_drivers_belkin">Driver for Belkin serial UPS equipment</flag>
+ <flag name="ups_drivers_belkinunv">Driver for Belkin "Universal UPS" and compatible</flag>
+ <flag name="ups_drivers_bestfcom">Driver for Best Power Fortress/Ferrups</flag>
+ <flag name="ups_drivers_bestfortress">Driver for old Best Fortress UPS equipment</flag>
+ <flag name="ups_drivers_bestuferrups">Driver for Best Power Micro-Ferrups</flag>
+ <flag name="ups_drivers_bestups">Driver for Best Power / SOLA (Phoenixtec protocol) UPS equipment</flag>
+ <flag name="ups_drivers_dummy-ups">Driver for multi-purpose UPS emulation</flag>
+ <flag name="ups_drivers_etapro">Driver for ETA UPS equipment</flag>
+ <flag name="ups_drivers_everups">Driver for Ever UPS models</flag>
+ <flag name="ups_drivers_gamatronic">Driver for Gamatronic UPS equipment</flag>
+ <flag name="ups_drivers_genericups">Driver for contact-closure UPS equipment</flag>
+ <flag name="ups_drivers_isbmex">Driver for ISBMEX UPS equipment</flag>
+ <flag name="ups_drivers_liebert">Driver for Liebert contact-closure UPS equipment</flag>
+ <flag name="ups_drivers_liebert-esp2">Driver for Liebert UPS, using the ESP-II serial protocol</flag>
+ <flag name="ups_drivers_masterguard">Driver for Masterguard UPS equipment</flag>
+ <flag name="ups_drivers_metasys">Driver for Meta System UPS equipment</flag>
+ <flag name="ups_drivers_mge-utalk">Driver for MGE UPS SYSTEMS UTalk protocol equipment</flag>
+ <flag name="ups_drivers_microdowell">Driver for Microdowell Enterprise UPS series</flag>
+ <flag name="ups_drivers_mge-shut">Driver for SHUT Protocol UPS equipment</flag>
+ <flag name="ups_drivers_oldmge-shut">Driver for SHUT Protocol UPS equipment (older implementation)</flag>
+ <flag name="ups_drivers_oneac">Driver for Oneac UPS equipment</flag>
+ <flag name="ups_drivers_optiups">Driver for Opti-UPS (Viewsonic) UPS and Zinto D (ONLINE-USV) equipment</flag>
+ <flag name="ups_drivers_powercom">UPS driver for serial Powercom/Trust/Advice UPS equipment</flag>
+ <flag name="ups_drivers_rhino">Driver for Brazilian Microsol RHINO UPS equipment</flag>
+ <flag name="ups_drivers_safenet">Driver for SafeNet compatible UPS equipment</flag>
+ <flag name="ups_drivers_solis">Driver for Brazilian Microsol SOLIS UPS equipment</flag>
+ <flag name="ups_drivers_tripplite">Driver for Tripp-Lite SmartPro UPS equipment</flag>
+ <flag name="ups_drivers_tripplitesu">Driver for Tripp-Lite SmartOnline (SU) UPS equipment</flag>
+ <flag name="ups_drivers_upscode2">Driver for UPScode II compatible UPS equipment</flag>
+ <flag name="ups_drivers_victronups">Driver for IMV/Victron UPS unit Match, Match Lite, NetUps</flag>
+ <flag name="ups_drivers_powerpanel">Driver for PowerPanel Plus compatible UPS equipment</flag>
+ <flag name="ups_drivers_blazer_ser">Driver for Megatec/Q1 protocol serial based UPS equipment</flag>
+ <flag name="ups_drivers_clone">Fake driver to clone outlets for device grouping</flag>
+ <flag name="ups_drivers_clone-outlet">Fake driver to clone outlets for device grouping</flag>
+ <flag name="ups_drivers_ivtscd">driver for the IVT Solar Controller Device</flag>
+ <flag name="ups_drivers_apcsmart">Driver for American Power Conversion Smart Protocol UPS equipment</flag>
+ <flag name="ups_drivers_apcsmart-old">Driver for American Power Conversion Smart Protocol UPS equipment</flag>
+ <flag name="ups_drivers_apcupsd-ups">Driver for apcupsd client access</flag>
+ <flag name="ups_drivers_riello_ser">Driver for Riello UPS Protocol UPS equipment</flag>
+ <flag name="ups_drivers_nutdrv_qx">Driver for Q* protocol serial and USB based UPS equipment</flag>
+ <flag name="ups_drivers_usbhid-ups">Driver for USB/HID UPS equipment</flag>
+ <flag name="ups_drivers_bcmxcp_usb">Experimental driver for UPSes supporting the BCM/XCP protocol over USB</flag>
+ <flag name="ups_drivers_tripplite_usb">Driver for older Tripp Lite USB UPSes (not PDC HID)</flag>
+ <flag name="ups_drivers_blazer_usb">Driver for Megatec/Q1 protocol USB based UPS equipment</flag>
+ <flag name="ups_drivers_richcomm_usb">Driver UPS equipment using Richcomm dry-contact to USB solution</flag>
+ <flag name="ups_drivers_riello_usb">Driver for Riello UPS Protocol UPS equipment via USB</flag>
+ <flag name="ups_drivers_nutdrv_qx">Driver for Q* protocol serial and USB based UPS equipment</flag>
+ <flag name="ups_drivers_netxml-ups">Driver for Eaton / MGE Network Management Card / Proxy (XML/HTTP Protocol) equipment</flag>
+ <flag name="ups_drivers_snmp-ups">Multi-MIB Driver for SNMP UPS equipment</flag>
+ <flag name="ups_drivers_nut-ipmipsu">Driver for IPMI Power Supply Units (PSU)</flag>
+ </use>
+</pkgmetadata>
diff --git a/sys-power/nut/nut-2.6.5-r1.ebuild b/sys-power/nut/nut-2.6.5-r1.ebuild
new file mode 100644
index 000000000000..e78486b0d5d6
--- /dev/null
+++ b/sys-power/nut/nut-2.6.5-r1.ebuild
@@ -0,0 +1,232 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit autotools bash-completion-r1 eutils fixheadtails multilib user systemd
+
+MY_P=${P/_/-}
+
+DESCRIPTION="Network-UPS Tools"
+HOMEPAGE="http://www.networkupstools.org/"
+# Nut mirrors are presently broken
+SRC_URI="http://random.networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz
+ http://www.networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~arm ppc ppc64 x86 ~x86-fbsd"
+IUSE="avahi cgi ipmi snmp usb selinux ssl tcpd xml"
+
+CDEPEND="avahi? ( net-dns/avahi )
+ cgi? ( >=media-libs/gd-2[png] )
+ snmp? ( net-analyzer/net-snmp )
+ usb? ( virtual/libusb:0 )
+ ssl? ( >=dev-libs/openssl-1 )
+ tcpd? ( sys-apps/tcp-wrappers )
+ xml? ( >=net-libs/neon-0.25.0 )
+ ipmi? ( sys-libs/freeipmi )
+ virtual/udev"
+DEPEND="$CDEPEND
+ >=sys-apps/sed-4
+ virtual/pkgconfig"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-nut )
+"
+
+S=${WORKDIR}/${MY_P}
+
+# public files should be 644 root:root
+NUT_PUBLIC_FILES="/etc/nut/{ups,upssched}.conf"
+# private files should be 640 root:nut - readable by nut, writeable by root,
+NUT_PRIVATE_FILES="/etc/nut/{upsd.conf,upsd.users,upsmon.conf}"
+# public files should be 644 root:root, only installed if USE=cgi
+NUT_CGI_FILES="/etc/nut/{{hosts,upsset}.conf,upsstats{,-single}.html}"
+
+pkg_setup() {
+ enewgroup nut 84
+ enewuser nut 84 -1 /var/lib/nut nut,uucp
+ # As of udev-104, NUT must be in uucp and NOT in tty.
+ gpasswd -d nut tty 2>/dev/null
+ gpasswd -a nut uucp 2>/dev/null
+ # in some cases on old systems it wasn't in the nut group either!
+ gpasswd -a nut nut 2>/dev/null
+ warningmsg ewarn
+}
+
+src_prepare() {
+ ht_fix_file configure.in
+
+ epatch "${FILESDIR}"/${PN}-2.4.1-no-libdummy.patch
+ epatch "${FILESDIR}"/${PN}-2.6.2-lowspeed-buffer-size.patch
+ #epatch "${FILESDIR}"/${PN}-2.6.3-CVE-2012-2944.patch
+ epatch "${FILESDIR}"/${PN}-2.6.5-freeipmi_fru.patch
+
+ sed -e "s:GD_LIBS.*=.*-L/usr/X11R6/lib \(.*\) -lXpm -lX11:GD_LIBS=\"\1:" \
+ -e '/systemdsystemunitdir=.*echo.*sed.*libdir/s,^,#,g' \
+ -i configure.in || die
+
+ sed -e "s:52.nut-usbups.rules:70-nut-usbups.rules:" \
+ -i scripts/udev/Makefile.am || die
+
+ rm -f ltmain.sh m4/lt* m4/libtool.m4
+
+ sed -i \
+ -e 's:@LIBSSL_LDFLAGS@:@LIBSSL_LIBS@:' \
+ lib/libupsclient{.pc,-config}.in || die #361685
+
+ eautoreconf
+}
+
+src_configure() {
+ local myconf
+
+ if [ -n "${NUT_DRIVERS}" ]; then
+ myconf="${myconf} --with-drivers=${NUT_DRIVERS// /,}"
+ fi
+
+ use cgi && myconf="${myconf} --with-cgipath=/usr/share/nut/cgi"
+
+ # TODO: USE flag for sys-power/powerman
+ econf \
+ --sysconfdir=/etc/nut \
+ --datarootdir=/usr/share/nut \
+ --datadir=/usr/share/nut \
+ --disable-static \
+ --with-statepath=/var/lib/nut \
+ --with-drvpath=/$(get_libdir)/nut \
+ --with-htmlpath=/usr/share/nut/html \
+ --with-user=nut \
+ --with-group=nut \
+ --with-logfacility=LOG_DAEMON \
+ --with-dev \
+ --with-serial \
+ --without-hal \
+ --without-powerman \
+ $(use_with avahi) \
+ $(use_with cgi) \
+ $(use_with ipmi) \
+ $(use_with ipmi freeipmi) \
+ $(use_with snmp) \
+ $(use_with ssl) \
+ $(use_with tcpd wrap) \
+ $(use_with usb) \
+ $(use_with xml neon) \
+ $(systemd_with_unitdir) \
+ ${myconf}
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+
+ find "${D}" -name '*.la' -exec rm -f {} +
+
+ dodir /sbin
+ dosym /$(get_libdir)/nut/upsdrvctl /sbin/upsdrvctl
+ # This needs to exist for the scripts
+ dosym /$(get_libdir)/nut/upsdrvctl /usr/sbin/upsdrvctl
+
+ if use cgi; then
+ elog "CGI monitoring scripts are installed in /usr/share/nut/cgi."
+ elog "copy them to your web server's ScriptPath to activate (this is a"
+ elog "change from the old location)."
+ elog "If you use lighttpd, see lighttpd_nut.conf in the documentation."
+ fi
+
+ # this must be done after all of the install phases
+ for i in "${D}"/etc/nut/*.sample ; do
+ mv "${i}" "${i/.sample/}"
+ done
+
+ dodoc AUTHORS ChangeLog docs/*.txt MAINTAINERS NEWS README TODO UPGRADING || die
+
+ newdoc lib/README README.lib || die
+ newdoc "${FILESDIR}"/lighttpd_nut.conf-2.2.0 lighttpd_nut.conf || die
+
+ docinto cables
+ dodoc docs/cables/* || die
+
+ newinitd "${FILESDIR}"/nut-2.6.5-init.d-upsd upsd || die
+ newinitd "${FILESDIR}"/nut-2.2.2-init.d-upsdrv upsdrv || die
+ newinitd "${FILESDIR}"/nut-2.6.5-init.d-upsmon upsmon || die
+ newinitd "${FILESDIR}"/nut-2.6.5-init.d-upslog upslog || die
+ newinitd "${FILESDIR}"/nut.powerfail.initd nut.powerfail || die
+
+ keepdir /var/lib/nut
+
+ einfo "Setting up permissions on files and directories"
+ fperms 0700 /var/lib/nut
+ fowners nut:nut /var/lib/nut
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval fperms 0640 ${NUT_PRIVATE_FILES}
+ eval fowners root:nut ${NUT_PRIVATE_FILES}
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval fperms 0644 ${NUT_PUBLIC_FILES}
+ eval fowners root:root ${NUT_PUBLIC_FILES}
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ if use cgi; then
+ eval fperms 0644 ${NUT_CGI_FILES}
+ eval fowners root:root ${NUT_CGI_FILES}
+ fi
+
+ # this is installed for 2.4 and fbsd guys
+ if ! has_version virtual/udev; then
+ einfo "Installing non-udev hotplug support"
+ insinto /etc/hotplug/usb
+ insopts -m 755
+ doins scripts/hotplug/nut-usbups.hotplug
+ fi
+
+ dobashcomp "${S}"/scripts/misc/nut.bash_completion
+}
+
+pkg_postinst() {
+ # this is to ensure that everybody that installed old versions still has
+ # correct permissions
+
+ chown nut:nut "${ROOT}"/var/lib/nut 2>/dev/null
+ chmod 0700 "${ROOT}"/var/lib/nut 2>/dev/null
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval chown root:nut "${ROOT}"${NUT_PRIVATE_FILES} 2>/dev/null
+ eval chmod 0640 "${ROOT}"${NUT_PRIVATE_FILES} 2>/dev/null
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval chown root:root "${ROOT}"${NUT_PUBLIC_FILES} 2>/dev/null
+ eval chmod 0644 "${ROOT}"${NUT_PUBLIC_FILES} 2>/dev/null
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ if use cgi; then
+ eval chown root:root "${ROOT}"${NUT_CGI_FILES} 2>/dev/null
+ eval chmod 0644 "${ROOT}"${NUT_CGI_FILES} 2>/dev/null
+ fi
+
+ warningmsg elog
+}
+
+warningmsg() {
+ msgfunc="$1"
+ [ -z "$msgfunc" ] && die "msgfunc not specified in call to warningmsg!"
+ ${msgfunc} "Please note that NUT now runs under the 'nut' user."
+ ${msgfunc} "NUT is in the uucp group for access to RS-232 UPS."
+ ${msgfunc} "However if you use a USB UPS you may need to look at the udev or"
+ ${msgfunc} "hotplug rules that are installed, and alter them suitably."
+ ${msgfunc} ''
+ ${msgfunc} "You are strongly advised to read the UPGRADING file provided by upstream."
+ ${msgfunc} ''
+ ${msgfunc} "Please note that upsdrv is NOT automatically started by upsd anymore."
+ ${msgfunc} "If you have multiple UPS units, you can use their NUT names to"
+ ${msgfunc} "have a service per UPS:"
+ ${msgfunc} "ln -s /etc/init.d/upsdrv /etc/init.d/upsdrv.\$UPSNAME"
+ ${msgfunc} ''
+ ${msgfunc} 'If you want apcupsd to power off your UPS when it'
+ ${msgfunc} 'shuts down your system in a power failure, you must'
+ ${msgfunc} 'add nut.powerfail to your shutdown runlevel:'
+ ${msgfunc} ''
+ ${msgfunc} 'rc-update add nut.powerfail shutdown'
+ ${msgfunc} ''
+
+}
diff --git a/sys-power/nut/nut-2.7.2-r2.ebuild b/sys-power/nut/nut-2.7.2-r2.ebuild
new file mode 100644
index 000000000000..37f570a3eff1
--- /dev/null
+++ b/sys-power/nut/nut-2.7.2-r2.ebuild
@@ -0,0 +1,275 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit autotools bash-completion-r1 eutils fixheadtails multilib user systemd flag-o-matic toolchain-funcs
+
+MY_P=${P/_/-}
+
+DESCRIPTION="Network-UPS Tools"
+HOMEPAGE="http://www.networkupstools.org/"
+# Nut mirrors are presently broken
+SRC_URI="http://random.networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz
+ http://www.networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~x86-fbsd"
+
+IUSE="avahi cgi ipmi snmp +usb selinux ssl tcpd xml"
+CDEPEND="avahi? ( net-dns/avahi )
+ cgi? ( >=media-libs/gd-2[png] )
+ snmp? ( net-analyzer/net-snmp )
+ usb? ( virtual/libusb:0 )
+ ssl? ( >=dev-libs/openssl-1 )
+ tcpd? ( sys-apps/tcp-wrappers )
+ xml? ( >=net-libs/neon-0.25.0 )
+ ipmi? ( sys-libs/freeipmi )
+ virtual/udev"
+DEPEND="$CDEPEND
+ >=sys-apps/sed-4
+ virtual/pkgconfig"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-nut )
+"
+
+S=${WORKDIR}/${MY_P}
+
+# Bug #480664 requested UPS_DRIVERS_IUSE for more flexibility in building this package
+SERIAL_DRIVERLIST="al175 bcmxcp belkin belkinunv bestfcom bestfortress bestuferrups bestups dummy-ups etapro everups gamatronic genericups isbmex liebert liebert-esp2 masterguard metasys oldmge-shut mge-utalk microdowell mge-shut oneac optiups powercom rhino safenet solis tripplite tripplitesu upscode2 victronups powerpanel blazer_ser clone clone-outlet ivtscd apcsmart apcsmart-old apcupsd-ups riello_ser nutdrv_qx"
+SNMP_DRIVERLIST="snmp-ups"
+USB_LIBUSB_DRIVERLIST="usbhid-ups bcmxcp_usb tripplite_usb blazer_usb richcomm_usb riello_usb nutdrv_qx"
+USB_DRIVERLIST=${USB_LIBUSB_DRIVERLIST}
+#HAL_DRIVERLIST="usbhid-ups bcmxcp_usb tripplite_usb blazer_usb riello_usb nutdrv_qx"
+NEONXML_DRIVERLIST="netxml-ups"
+IPMI_DRIVERLIST="nut-ipmipsu"
+# Now we build from it:
+for name in ${SERIAL_DRIVERLIST} ; do
+ IUSE_UPS_DRIVERS="${IUSE_UPS_DRIVERS} +ups_drivers_${name}"
+done
+for name in ${USB_DRIVERLIST} ; do
+ IUSE_UPS_DRIVERS="${IUSE_UPS_DRIVERS} +ups_drivers_${name}"
+ REQUIRED_USE="${REQUIRED_USE} ups_drivers_${name}? ( usb )"
+done
+for name in ${NEONXML_DRIVERLIST}; do
+ IUSE_UPS_DRIVERS="${IUSE_UPS_DRIVERS} ups_drivers_${name}"
+ REQUIRED_USE="${REQUIRED_USE} ups_drivers_${name}? ( xml )"
+done
+for name in ${SNMP_DRIVERLIST} ; do
+ IUSE_UPS_DRIVERS="${IUSE_UPS_DRIVERS} ups_drivers_${name}"
+ REQUIRED_USE="${REQUIRED_USE} ups_drivers_${name}? ( snmp )"
+done
+for name in ${IPMI_DRIVERLIST} ; do
+ IUSE_UPS_DRIVERS="${IUSE_UPS_DRIVERS} ups_drivers_${name}"
+ REQUIRED_USE="${REQUIRED_USE} ups_drivers_${name}? ( ipmi )"
+done
+IUSE="${IUSE} ${IUSE_UPS_DRIVERS}"
+
+# public files should be 644 root:root
+NUT_PUBLIC_FILES="/etc/nut/{ups,upssched}.conf"
+# private files should be 640 root:nut - readable by nut, writeable by root,
+NUT_PRIVATE_FILES="/etc/nut/{upsd.conf,upsd.users,upsmon.conf}"
+# public files should be 644 root:root, only installed if USE=cgi
+NUT_CGI_FILES="/etc/nut/{{hosts,upsset}.conf,upsstats{,-single}.html}"
+
+pkg_setup() {
+ enewgroup nut 84
+ enewuser nut 84 -1 /var/lib/nut nut,uucp
+ # As of udev-104, NUT must be in uucp and NOT in tty.
+ gpasswd -d nut tty 2>/dev/null
+ gpasswd -a nut uucp 2>/dev/null
+ # in some cases on old systems it wasn't in the nut group either!
+ gpasswd -a nut nut 2>/dev/null
+ warningmsg ewarn
+}
+
+src_prepare() {
+ #ht_fix_file configure.in
+
+ epatch "${FILESDIR}/nut-2.7.2/nut-2.7.2-no-libdummy.patch"
+ epatch "${FILESDIR}"/${PN}-2.6.2-lowspeed-buffer-size.patch
+ #epatch "${FILESDIR}"/${PN}-2.6.3-CVE-2012-2944.patch
+ #epatch "${FILESDIR}"/${PN}-2.6.5-freeipmi_fru.patch
+ epatch "${FILESDIR}"/${PN}-2.7.1-fix-scanning.patch
+ epatch "${FILESDIR}"/${PN}-2.7.1-snmpusb-order.patch
+
+ sed -e "s:GD_LIBS.*=.*-L/usr/X11R6/lib \(.*\) -lXpm -lX11:GD_LIBS=\"\1:" \
+ -e '/systemdsystemunitdir=.*echo.*sed.*libdir/s,^,#,g' \
+ -i configure.ac || die
+
+ sed -e "s:52.nut-usbups.rules:70-nut-usbups.rules:" \
+ -i scripts/udev/Makefile.am || die
+
+ rm -f ltmain.sh m4/lt* m4/libtool.m4
+
+ sed -i \
+ -e 's:@LIBSSL_LDFLAGS@:@LIBSSL_LIBS@:' \
+ lib/libupsclient{.pc,-config}.in || die #361685
+
+ # This file appears twice in the install list, and if both install rules
+ # trigger simultaneously during parallel-make, it fails.
+ sed -i \
+ -e '/nodist_sysconf_DATA/s,upsmon.conf.sample,,g' \
+ conf/Makefile.am || die
+
+ eautoreconf
+}
+
+src_configure() {
+ local myconf
+ append-flags -fno-lto
+ tc-export CC
+ tc-export CXX
+ tc-export AR
+
+ local UPS_DRIVERS=""
+ for u in $USE ; do
+ u2=${u#ups_drivers_}
+ [[ "${u}" != "${u2}" ]] && UPS_DRIVERS="${UPS_DRIVERS} ${u2}"
+ done
+ UPS_DRIVERS="${UPS_DRIVERS# }" UPS_DRIVERS="${UPS_DRIVERS% }"
+ myconf="${myconf} --with-drivers=${UPS_DRIVERS// /,}"
+
+ use cgi && myconf="${myconf} --with-cgipath=/usr/share/nut/cgi"
+
+ # TODO: USE flag for sys-power/powerman
+ econf \
+ --sysconfdir=/etc/nut \
+ --datarootdir=/usr/share/nut \
+ --datadir=/usr/share/nut \
+ --disable-static \
+ --with-statepath=/var/lib/nut \
+ --with-drvpath=/$(get_libdir)/nut \
+ --with-htmlpath=/usr/share/nut/html \
+ --with-user=nut \
+ --with-group=nut \
+ --with-logfacility=LOG_DAEMON \
+ --with-dev \
+ --with-serial \
+ --without-powerman \
+ $(use_with avahi) \
+ $(use_with cgi) \
+ $(use_with ipmi) \
+ $(use_with ipmi freeipmi) \
+ $(use_with snmp) \
+ $(use_with ssl) \
+ $(use_with tcpd wrap) \
+ $(use_with usb) \
+ $(use_with xml neon) \
+ $(systemd_with_unitdir) \
+ ${myconf}
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+
+ find "${D}" -name '*.la' -exec rm -f {} +
+
+ dodir /sbin
+ dosym /usr/sbin/upsdrvctl /sbin/upsdrvctl
+
+ if use cgi; then
+ elog "CGI monitoring scripts are installed in /usr/share/nut/cgi."
+ elog "copy them to your web server's ScriptPath to activate (this is a"
+ elog "change from the old location)."
+ elog "If you use lighttpd, see lighttpd_nut.conf in the documentation."
+ fi
+
+ # this must be done after all of the install phases
+ for i in "${D}"/etc/nut/*.sample ; do
+ mv "${i}" "${i/.sample/}"
+ done
+
+ dodoc AUTHORS ChangeLog docs/*.txt MAINTAINERS NEWS README TODO UPGRADING || die
+
+ newdoc lib/README README.lib || die
+ newdoc "${FILESDIR}"/lighttpd_nut.conf-2.2.0 lighttpd_nut.conf || die
+
+ docinto cables
+ dodoc docs/cables/* || die
+
+ newinitd "${FILESDIR}"/nut-2.6.5-init.d-upsd upsd || die
+ newinitd "${FILESDIR}"/nut-2.2.2-init.d-upsdrv upsdrv || die
+ newinitd "${FILESDIR}"/nut-2.6.5-init.d-upsmon upsmon || die
+ newinitd "${FILESDIR}"/nut-2.6.5-init.d-upslog upslog || die
+ newinitd "${FILESDIR}"/nut.powerfail.initd nut.powerfail || die
+
+ keepdir /var/lib/nut
+
+ einfo "Setting up permissions on files and directories"
+ fperms 0700 /var/lib/nut
+ fowners nut:nut /var/lib/nut
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval fperms 0640 ${NUT_PRIVATE_FILES}
+ eval fowners root:nut ${NUT_PRIVATE_FILES}
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval fperms 0644 ${NUT_PUBLIC_FILES}
+ eval fowners root:root ${NUT_PUBLIC_FILES}
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ if use cgi; then
+ eval fperms 0644 ${NUT_CGI_FILES}
+ eval fowners root:root ${NUT_CGI_FILES}
+ fi
+
+ # this is installed for 2.4 and fbsd guys
+ if ! has_version virtual/udev; then
+ einfo "Installing non-udev hotplug support"
+ insinto /etc/hotplug/usb
+ insopts -m 755
+ doins scripts/hotplug/nut-usbups.hotplug
+ fi
+
+ dobashcomp "${S}"/scripts/misc/nut.bash_completion
+}
+
+pkg_postinst() {
+ # this is to ensure that everybody that installed old versions still has
+ # correct permissions
+
+ chown nut:nut "${ROOT}"/var/lib/nut 2>/dev/null
+ chmod 0700 "${ROOT}"/var/lib/nut 2>/dev/null
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval chown root:nut "${ROOT}"${NUT_PRIVATE_FILES} 2>/dev/null
+ eval chmod 0640 "${ROOT}"${NUT_PRIVATE_FILES} 2>/dev/null
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval chown root:root "${ROOT}"${NUT_PUBLIC_FILES} 2>/dev/null
+ eval chmod 0644 "${ROOT}"${NUT_PUBLIC_FILES} 2>/dev/null
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ if use cgi; then
+ eval chown root:root "${ROOT}"${NUT_CGI_FILES} 2>/dev/null
+ eval chmod 0644 "${ROOT}"${NUT_CGI_FILES} 2>/dev/null
+ fi
+
+ warningmsg elog
+}
+
+warningmsg() {
+ msgfunc="$1"
+ [ -z "$msgfunc" ] && die "msgfunc not specified in call to warningmsg!"
+ ${msgfunc} "Please note that NUT now runs under the 'nut' user."
+ ${msgfunc} "NUT is in the uucp group for access to RS-232 UPS."
+ ${msgfunc} "However if you use a USB UPS you may need to look at the udev or"
+ ${msgfunc} "hotplug rules that are installed, and alter them suitably."
+ ${msgfunc} ''
+ ${msgfunc} "You are strongly advised to read the UPGRADING file provided by upstream."
+ ${msgfunc} ''
+ ${msgfunc} "Please note that upsdrv is NOT automatically started by upsd anymore."
+ ${msgfunc} "If you have multiple UPS units, you can use their NUT names to"
+ ${msgfunc} "have a service per UPS:"
+ ${msgfunc} "ln -s /etc/init.d/upsdrv /etc/init.d/upsdrv.\$UPSNAME"
+ ${msgfunc} ''
+ ${msgfunc} 'If you want apcupsd to power off your UPS when it'
+ ${msgfunc} 'shuts down your system in a power failure, you must'
+ ${msgfunc} 'add nut.powerfail to your shutdown runlevel:'
+ ${msgfunc} ''
+ ${msgfunc} 'rc-update add nut.powerfail shutdown'
+ ${msgfunc} ''
+
+}
diff --git a/sys-power/nvclock/Manifest b/sys-power/nvclock/Manifest
new file mode 100644
index 000000000000..8497c5b83694
--- /dev/null
+++ b/sys-power/nvclock/Manifest
@@ -0,0 +1 @@
+DIST nvclock-0.8_p20110102.tar.bz2 285043 SHA256 d2a753908ef665caa996b71efd3081501e4b0fb45fa827add685cbc85d5d3745 SHA512 01bf7faed83acdf2390e1f410b2f8b697ff647b15562a6960a99666ec5121b532cbf4380137c9ee24221ccafff641bcdef4748dcad7ac92fb25fa15e735dd140 WHIRLPOOL e0d42a293add54b2d74e94fb54e0b20d29041b741476c63dc29a28ce10efc717a68d7bc82f4fb38f57a998526db4510d0b419e2617261765c8b38bb45ba24c43
diff --git a/sys-power/nvclock/files/nvclock-0.8_p20110102-buffers.patch b/sys-power/nvclock/files/nvclock-0.8_p20110102-buffers.patch
new file mode 100644
index 000000000000..f64cb9b8456d
--- /dev/null
+++ b/sys-power/nvclock/files/nvclock-0.8_p20110102-buffers.patch
@@ -0,0 +1,202 @@
+https://bugs.gentoo.org/364667
+
+clean up random buffer overflows in the code
+
+--- a/src/backend/back_linux.c
++++ b/src/backend/back_linux.c
+@@ -42,7 +42,9 @@ static int probe_devices();
+ static int check_driver()
+ {
+ FILE *proc;
+- char buffer[80];
++ char *buffer = NULL;
++ size_t len;
++ int ret = 0;
+
+ proc = fopen("/proc/modules", "r");
+
+@@ -50,9 +52,9 @@ static int check_driver()
+ if(proc == NULL)
+ return 0;
+
+- while(fgets(buffer, 80, proc) != NULL)
++ while(getline(&buffer, &len, proc) != -1)
+ {
+- char name[80];
++ char name[100];
+ int size;
+ int used;
+
+@@ -64,26 +66,23 @@ static int check_driver()
+ {
+ if(strcmp(name, "NVdriver") == 0)
+ {
+- fclose(proc);
+ if(used)
+- return 1;
+-
+- return 0;
++ ret = 1;
++ break;
+ }
+
+ if(strcmp(name, "nvidia") == 0)
+ {
+- fclose(proc);
+ if(used)
+- return 2;
+-
+- return 0;
++ ret = 2;
++ break;
+ }
+ }
+ }
++ free(buffer);
+ fclose(proc);
+
+- return 0;
++ return ret;
+ }
+
+ int init_nvclock()
+@@ -114,7 +113,8 @@ static int probe_devices()
+ {
+ int dev, irq, reg_addr, i=0;
+ unsigned short devbusfn;
+- char buf[256];
++ char *buf = NULL;
++ size_t len;
+ FILE *proc;
+
+ proc = fopen("/proc/bus/pci/devices", "r");
+@@ -124,7 +124,7 @@ static int probe_devices()
+ return 0;
+ }
+
+- while(fgets(buf, sizeof(buf)-1, proc))
++ while(getline(&buf, &len, proc) != -1)
+ {
+ if(sscanf(buf,"%hx %x %x %x",&devbusfn, &dev, &irq, &reg_addr) != 4) continue;
+
+@@ -181,6 +181,7 @@ static int probe_devices()
+ i++;
+ }
+ }
++ free(buf);
+ fclose(proc);
+
+ if(i==0)
+--- a/src/backend/config.c
++++ b/src/backend/config.c
+@@ -286,8 +286,9 @@ int open_config()
+ {
+ if(mkdir(nvclock.path, 0755))
+ {
+- char buf[80];
+- sprintf(buf, "Can't create '%s'. Do you have sufficient permissions?\n", nvclock.path);
++ char buf[1024];
++ snprintf(buf, sizeof(buf), "Can't create path (do you have sufficient permissions?): %s", nvclock.path);
++ buf[sizeof(buf) - 1] = '\0';
+ set_error_str(buf);
+ return 0;
+ }
+@@ -297,8 +298,9 @@ int open_config()
+ /* Check if .nvclock really is a directory. For some users it was a file and this led to a segfault. */
+ if(!S_ISDIR(stat_buf.st_mode))
+ {
+- char buf[80];
+- sprintf(buf, "Can't open '%s'. Is it really a directory?\n", nvclock.path);
++ char buf[1024];
++ snprintf(buf, sizeof(buf), "Can't open path (Is it really a directory?): %s", nvclock.path);
++ buf[sizeof(buf) - 1] = '\0';
+ set_error_str(buf);
+ return 0;
+ }
+--- a/src/backend/error.c
++++ b/src/backend/error.c
+@@ -41,23 +41,19 @@ void set_error_str(const char *str)
+ }
+
+
+-char *get_error(char *buf, int size)
++const char *get_error(void)
+ {
+ switch(nvclock.nv_errno)
+ {
+ case NV_ERR_NO_DEVICES_FOUND:
+- strcpy(buf, "No nvidia cards found in your system!");
+- break;
++ return "No nvidia cards found in your system!";
+ case NV_ERR_NO_DRIVERS_FOUND:
+- strcpy(buf, "You don't have enough permissions to run NVClock! Retry as root or install the Nvidia drivers.");
+- break;
++ return "You don't have enough permissions to run NVClock! Retry as root or install the Nvidia drivers.";
+ case NV_ERR_NOT_ENOUGH_PERMISSIONS:
+- strcpy(buf, "You don't have enough permissions to run NVClock! Retry as root.");
+- break;
++ return "You don't have enough permissions to run NVClock! Retry as root.";
+ case NV_ERR_OTHER:
+- strcpy(buf, nvclock.nv_err_str);
+- break;
++ return nvclock.nv_err_str;
+ }
+
+- return buf;
++ return "unknown";
+ }
+--- a/src/backend/nvclock.h
++++ b/src/backend/nvclock.h
+@@ -335,7 +335,7 @@ cfg_entry* lookup_entry(cfg_entry **cfg, char *section, char *name);
+ void destroy(cfg_entry **cfg);
+
+ /* error handling */
+-char *get_error(char *buf, int size);
++const char *get_error(void);
+ void set_error(int code);
+ void set_error_str(const char *err);
+
+--- a/src/gtk/main.c
++++ b/src/gtk/main.c
+@@ -264,8 +264,7 @@ int main (int argc, char *argv[])
+ */
+ if(!init_nvclock())
+ {
+- char buf[80];
+- GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s", get_error(buf, 80));
++ GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s", get_error());
+ gtk_dialog_run(GTK_DIALOG(dialog));
+ g_signal_connect_swapped(GTK_OBJECT(dialog), "response", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(dialog));
+ gtk_widget_destroy(dialog);
+--- a/src/nvclock.c
++++ b/src/nvclock.c
+@@ -604,8 +604,7 @@ int main(int argc, char *argv[])
+
+ if(!init_nvclock())
+ {
+- char buf[80];
+- fprintf(stderr, "Error: %s\n", get_error(buf, 80));
++ fprintf(stderr, "Error: %s\n", get_error());
+ return 0;
+ }
+
+@@ -851,8 +850,7 @@ int main(int argc, char *argv[])
+ {
+ if(!set_card(i))
+ {
+- char buf[80];
+- fprintf(stderr, "Error: %s\n", get_error(buf, 80));
++ fprintf(stderr, "Error: %s\n", get_error());
+ return 0;
+ }
+
+@@ -887,8 +885,7 @@ int main(int argc, char *argv[])
+ /* set the card object to the requested card */
+ if(!set_card(card_number))
+ {
+- char buf[80];
+- fprintf(stderr, "Error: %s\n", get_error(buf, 80));
++ fprintf(stderr, "Error: %s\n", get_error());
+ return 0;
+ }
+
diff --git a/sys-power/nvclock/files/nvclock-0.8_p20110102-desktop.patch b/sys-power/nvclock/files/nvclock-0.8_p20110102-desktop.patch
new file mode 100644
index 000000000000..034208ff817a
--- /dev/null
+++ b/sys-power/nvclock/files/nvclock-0.8_p20110102-desktop.patch
@@ -0,0 +1,18 @@
+fix qa warning:
+
+/usr/share/applications/nvclock.desktop: error: (will be fatal in the future):
+value "nvclock.png" for key "Icon" in group "Desktop Entry" is an icon name
+with an extension, but there should be no extension as described in the Icon
+Theme Specification if the value is not an absolute path
+
+--- a/nvclock.desktop
++++ b/nvclock.desktop
+@@ -3,7 +3,7 @@ Encoding=UTF-8
+ Name=NVCLOCK
+ Comment=Overclock and Monitor NVIDIA cards
+ Exec=nvclock_gtk
+-Icon=nvclock.png
++Icon=nvclock
+ Terminal=false
+ Type=Application
+ Categories=System;
diff --git a/sys-power/nvclock/files/nvclock-0.8_p20110102-r1-make.patch b/sys-power/nvclock/files/nvclock-0.8_p20110102-r1-make.patch
new file mode 100644
index 000000000000..e45e2a6aa341
--- /dev/null
+++ b/sys-power/nvclock/files/nvclock-0.8_p20110102-r1-make.patch
@@ -0,0 +1,94 @@
+- Fix building with --as-needed
+- Fix parallel make by defining two new targets
+- Fix one spelling error
+- Respect CFLAGS, LDFLAGS
+- Link GTK frontend against -lX11 since it uses XOpenDisplay all the time
+
+--- a/configure.in
++++ b/configure.in
+@@ -141,7 +141,7 @@
+ if [test "$HAVE_NVCONTROL" = "yes"]; then
+ echo "- NV-CONTROL support enabled"
+ else
+- echo "- NV-CONROL support disabled"
++ echo "- NV-CONTROL support disabled"
+ fi
+ if [test "$HAVE_GTK2" = "yes"]; then
+ echo "- GTK2 GUI enabled"
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -16,7 +16,7 @@
+ ifeq ($(HAVE_NVCONTROL), yes)
+ DEPS=$(libbackend) $(libnvcontrol)
+ INCLUDES=@X11_CFLAGS@ -I./backend -I./nvcontrol -I..
+- LIBS=@X11_LIBS@ -L./backend -lbackend -L./nvcontrol -lnvcontrol
++ LIBS=-L./backend -lbackend -L./nvcontrol -lnvcontrol @X11_LIBS@
+ else
+ DEPS=$(libbackend)
+ INCLUDES=-I./backend -I./nvcontrol -I..
+@@ -30,12 +30,17 @@
+
+ all: all-recursive nvclock smartdimmer
+
++$(libbackend):
++ $(MAKE) -C backend
++
++$(libnvcontrol):
++ $(MAKE) -C nvcontrol
+
+ nvclock: $(DEPS) $(LIB) nvclock.c
+- $(CC) $(CFLAGS) -o nvclock $(nvclock_SOURCES) $(INCLUDES) $(LIBS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o nvclock $(nvclock_SOURCES) $(INCLUDES) $(LIBS)
+
+ smartdimmer: $(DEPS) $(LIB) smartdimmer.c
+- $(CC) $(CFLAGS) -o smartdimmer $(smartdimmer_SOURCES) $(INCLUDES) $(LIBS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o smartdimmer $(smartdimmer_SOURCES) $(INCLUDES) $(LIBS)
+
+
+ clean: clean-recursive clean-app
+--- a/src/gtk/Makefile.in
++++ b/src/gtk/Makefile.in
+@@ -27,6 +27,7 @@
+ LIBS=@GTK_LIBS@ -L../backend -lbackend
+ OBJECTS=banner.o hw.o main.o settings.o
+ endif
++LIBS += -lX11
+
+
+ .PHONY: clean distclean install
+@@ -33,7 +33,7 @@
+ all: $(PROGRAM)
+
+ nvclock_gtk: $(DEPS) $(OBJECTS)
+- $(CC) $(CFLAGS) -o nvclock_gtk $(OBJECTS) $(libbackend) $(LIBS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o nvclock_gtk $(OBJECTS) $(libbackend) $(LIBS)
+
+ clean:
+ rm -f nvclock_gtk *.core *.o *.exe
+--- a/src/qt/Makefile.in
++++ b/src/qt/Makefile.in
+@@ -31,7 +31,7 @@
+ all: $(PROGRAM)
+
+ nvclock_qt: $(DEPS) qt_nvclock.moc qt_xfree.moc $(OBJECTS)
+- $(CXX) $(CXXFLAGS) -o nvclock_qt $(CXXFLAGS) $(OBJECTS) $(LIBS)
++ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o nvclock_qt $(OBJECTS) $(LIBS)
+
+ clean:
+ rm -f nvclock_qt *.core *.moc *.o
+--- a/src/backend/Makefile.in
++++ b/src/backend/Makefile.in
+@@ -1,11 +1,11 @@
+-CC=@CC@ -O0
++CC=@CC@
+ AR=ar
+ RANLIB=@RANLIB@
+
+ system=@system@
+ HAVE_NVCONTROL=@HAVE_NVCONTROL@
+ OBJECTS=backend.o bios.o config.o error.o nv30.o nv40.o nv50.o info.o overclock.o utils.o i2c.o xf86i2c.o adt7473.o f75375.o lm99.o w83781d.o w83l785r.o libc_wrapper.o
+-CFLAGS=@X11_CFLAGS@ -I../.. -I../nvcontrol
++CFLAGS=@CFLAGS@ @X11_CFLAGS@ -I../.. -I../nvcontrol
+
+ ifeq ($(system), FreeBSD)
+ OBJECTS+=back_bsd.o
diff --git a/sys-power/nvclock/files/nvclock-0.8_p20110102-usleep.patch b/sys-power/nvclock/files/nvclock-0.8_p20110102-usleep.patch
new file mode 100644
index 000000000000..93c3f288864b
--- /dev/null
+++ b/sys-power/nvclock/files/nvclock-0.8_p20110102-usleep.patch
@@ -0,0 +1,14 @@
+fix warning:
+libc_wrapper.c:54: warning: implicit declaration of function usleep
+
+--- a/src/backend/libc_wrapper.c
++++ b/src/backend/libc_wrapper.c
+@@ -27,6 +27,8 @@
+
++#define _BSD_SOURCE
+ #include <stdio.h>
+ #include "xfree.h"
++#include "config.h"
+
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
diff --git a/sys-power/nvclock/files/nvclock_confd b/sys-power/nvclock/files/nvclock_confd
new file mode 100644
index 000000000000..ff7f15bdd746
--- /dev/null
+++ b/sys-power/nvclock/files/nvclock_confd
@@ -0,0 +1,9 @@
+# Config file for /etc/init.d/nvclock
+
+# Set the core clock speed after -n and the memory clock speed after -m
+# Check your current speeds by running 'nvclock -s' at the command line
+# so you don't overclock too much and burn out the card
+# Test out your overclocking before adding this to the bootup!
+
+CLOCKOPTS="-s"
+#CLOCKOPTS="-n <corespeed> -m <memspeed>"
diff --git a/sys-power/nvclock/files/nvclock_initd b/sys-power/nvclock/files/nvclock_initd
new file mode 100644
index 000000000000..bcab3b581b23
--- /dev/null
+++ b/sys-power/nvclock/files/nvclock_initd
@@ -0,0 +1,12 @@
+#!/sbin/runscript
+
+depend() {
+ need xdm
+}
+
+start() {
+ ebegin "Setting nvidia card overclock speed"
+ nvclock ${CLOCKOPTS} >/dev/null
+ eend $?
+}
+
diff --git a/sys-power/nvclock/metadata.xml b/sys-power/nvclock/metadata.xml
new file mode 100644
index 000000000000..eb475ca95015
--- /dev/null
+++ b/sys-power/nvclock/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+ <email>bircoph@gentoo.org</email>
+ <name>Andrew Savchenko</name>
+</maintainer>
+<use>
+ <flag name="gtk">Install the GTK+ based graphical interface</flag>
+ <flag name="nvcontrol">Add NVCONTROL support for OpenGL options</flag>
+</use>
+</pkgmetadata>
diff --git a/sys-power/nvclock/nvclock-0.8_p20110102-r2.ebuild b/sys-power/nvclock/nvclock-0.8_p20110102-r2.ebuild
new file mode 100644
index 000000000000..b9e7d5978e5c
--- /dev/null
+++ b/sys-power/nvclock/nvclock-0.8_p20110102-r2.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit autotools eutils
+
+DESCRIPTION="NVIDIA Overclocking Utility"
+HOMEPAGE="http://www.linuxhardware.org/nvclock/"
+SRC_URI="mirror://gentoo/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86"
+IUSE="gtk nvcontrol"
+
+RDEPEND="
+ gtk? (
+ x11-libs/gtk+:2
+ x11-libs/libX11
+ )
+ nvcontrol? ( x11-libs/libX11 x11-libs/libXext )
+"
+DEPEND="${RDEPEND}"
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/${P}-r1-make.patch \
+ "${FILESDIR}"/${P}-usleep.patch \
+ "${FILESDIR}"/${P}-desktop.patch \
+ "${FILESDIR}"/${P}-buffers.patch
+ eautoreconf
+}
+
+src_configure() {
+ sed -i \
+ -e "/^AR=ar/s:=.*:=$(tc-getAR):" \
+ src/*/Makefile.in || die
+
+ # Qt support would mean Qt 3.
+ econf \
+ --docdir=/usr/share/doc/${PF} \
+ --disable-qt \
+ $(use_enable gtk) \
+ $(use_enable nvcontrol)
+}
+
+src_compile() {
+ emake -C src/ nvclock smartdimmer
+ use gtk && emake -C src/gtk/
+}
+
+src_install() {
+ mkdir -p "${D}"/usr/bin || die
+
+ default
+
+ newinitd "${FILESDIR}"/nvclock_initd nvclock
+ newconfd "${FILESDIR}"/nvclock_confd nvclock
+}
+
+pkg_postinst() {
+ elog "To enable card overclocking at startup, edit your /etc/conf.d/nvclock"
+ elog "accordingly and then run: rc-update add nvclock default"
+}
diff --git a/sys-power/nvram-reboot/Manifest b/sys-power/nvram-reboot/Manifest
new file mode 100644
index 000000000000..5f60417ba4b3
--- /dev/null
+++ b/sys-power/nvram-reboot/Manifest
@@ -0,0 +1 @@
+DIST reboot-2004.10.03.tar.bz2 425622 SHA256 775dc675849a2eb7f4b01608bb4dfc2c55eab72ac7373c82adda1c4ba296f47f SHA512 b85a7372369f3ba9e36af1b96ccbf31ba1febcc3ebf31a8684332d370ea85428a3bfc4855c7df10f9b92a3c57b704fabbe5069a792cd8aaa1b45511f88c41906 WHIRLPOOL 5aedfcb448831d094268de243cbe533c45baa7d95c449cd4d6662bebe61665058370a1755716d2376f5c065e34100d5f6b9d94fcac8aac34b9b5e7195090d5ee
diff --git a/sys-power/nvram-reboot/metadata.xml b/sys-power/nvram-reboot/metadata.xml
new file mode 100644
index 000000000000..8037d8508d62
--- /dev/null
+++ b/sys-power/nvram-reboot/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>base-system</herd>
+ <upstream>
+ <remote-id type="sourceforge">nvram-wakeup</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-power/nvram-reboot/nvram-reboot-2004.10.03.ebuild b/sys-power/nvram-reboot/nvram-reboot-2004.10.03.ebuild
new file mode 100644
index 000000000000..fcf658c83203
--- /dev/null
+++ b/sys-power/nvram-reboot/nvram-reboot-2004.10.03.ebuild
@@ -0,0 +1,26 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit mount-boot
+
+MY_P="${P/nvram-/}"
+DESCRIPTION="PowerOff Boot-Images for nvram-wakeup (not needed for GRUB)"
+HOMEPAGE="http://sourceforge.net/projects/nvram-wakeup/"
+SRC_URI="mirror://sourceforge/nvram-wakeup/${MY_P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+IUSE=""
+
+DEPEND=""
+
+S="${WORKDIR}/${MY_P}"
+
+src_install() {
+ insinto /boot/nvram-wakeup
+ doins apm-poweroff.bin bzImage.2.4.20.poweroff dioden-poweroff \
+ || die "doins"
+ dodoc *.patch *.diff *.txt config.*
+}
diff --git a/sys-power/nvram-wakeup/Manifest b/sys-power/nvram-wakeup/Manifest
new file mode 100644
index 000000000000..081a12738057
--- /dev/null
+++ b/sys-power/nvram-wakeup/Manifest
@@ -0,0 +1,2 @@
+DIST nvram-wakup-1.0.tar.gz 1068875 SHA256 831af412fdf8c75a31e470398a08da97266b2dd064daaf94e45833bd4428349b
+DIST nvram-wakup-1.1.tar.gz 1070097 SHA256 b5f6a86ec7ad1c25d22f7dd0bf3261c2766e6302f0f6f80a963ceb3eb3b74811 SHA512 a47c6831e004e25f43adbc25aa46aca457602c681693621e3acda12f1f775aa1c5fa30ec9a09d71945ef2de8a2dbe97f9c1c7e09b1ae3464c368c9b8fc0f11e0 WHIRLPOOL 468f3be815aa3e4cee60f66f5cc48aebfb3aa1343fc7ee7ab899fd72c12b9fb2595dbb7ed04bf65734d9d363e766b26bf19e307049424b997fbd2ca36bb72801
diff --git a/sys-power/nvram-wakeup/files/nvram-wakeup-0.97-nonls.patch b/sys-power/nvram-wakeup/files/nvram-wakeup-0.97-nonls.patch
new file mode 100644
index 000000000000..108d02eddd29
--- /dev/null
+++ b/sys-power/nvram-wakeup/files/nvram-wakeup-0.97-nonls.patch
@@ -0,0 +1,18 @@
+--- nvram-wakeup-0.97/Makefile
++++ nvram-wakeup-0.97/Makefile
+@@ -41,3 +41,3 @@
+
+-all: $(BINS) $(GTTXT)
++all: $(BINS)
+ size $(BINS)
+@@ -88,3 +88,2 @@
+ @$(INSTALL) -vd $(DOCDIR)
+- @$(INSTALL) -vd $(GTTXTDIR)
+ @$(INSTALL) -vm 755 $(PROG_SH) $(BINDIR)
+@@ -94,3 +93,2 @@
+ @$(INSTALL) -vm 644 $(DOC) $(DOCDIR)
+- @$(INSTALL) -vm 755 $(GTTXT) $(GTTXTDIR)
+
+@@ -110,2 +108 @@
+ cd $(DOCDIR); rm -f $(DOC)
+- cd $(GTTXTDIR); rm -f $(GTTXT)
diff --git a/sys-power/nvram-wakeup/metadata.xml b/sys-power/nvram-wakeup/metadata.xml
new file mode 100644
index 000000000000..8037d8508d62
--- /dev/null
+++ b/sys-power/nvram-wakeup/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>base-system</herd>
+ <upstream>
+ <remote-id type="sourceforge">nvram-wakeup</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-power/nvram-wakeup/nvram-wakeup-1.0.ebuild b/sys-power/nvram-wakeup/nvram-wakeup-1.0.ebuild
new file mode 100644
index 000000000000..55d387ccf501
--- /dev/null
+++ b/sys-power/nvram-wakeup/nvram-wakeup-1.0.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit flag-o-matic eutils
+
+MY_P=${P%_p*}
+[[ ${PV} == *_p* ]] && REV=${P#*_p} || unset REV
+MY_P=${MY_P/e}
+DESCRIPTION="read and write the WakeUp time in the BIOS"
+HOMEPAGE="http://sourceforge.net/projects/nvram-wakeup"
+SRC_URI="mirror://sourceforge/nvram-wakeup/${MY_P}.tar.gz
+ ${REV+http://nvram-wakeup.svn.sourceforge.net/viewvc/*checkout*/nvram-wakeup/trunk/nvram-wakeup/nvram-wakeup-mb.c?revision=${REV}}"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="nls"
+[[ -n ${REV} ]] && RESTRICT="mirror" #168114
+
+DEPEND="nls? ( sys-devel/gettext )"
+RDEPEND=""
+
+S=${WORKDIR}/${MY_P}
+
+src_unpack() {
+ unpack ${MY_P}.tar.gz
+ if [[ -n ${REV} ]] ; then
+ cp "${DISTDIR}"/nvram-wakeup-mb.c?revision=${REV} "${S}"/nvram-wakeup-mb.c || die
+ fi
+ cd "${S}"
+ use nls || epatch "${FILESDIR}"/${PN}-0.97-nonls.patch
+ # Need to be careful with CFLAGS since this could eat your bios
+ strip-flags
+ sed -i \
+ -e '/^CFLAGS/s:= -O2 :+= $(CPPFLAGS) :' \
+ Makefile || die "setting CFLAGS"
+}
+
+src_install() {
+ emake \
+ prefix="${D}"/usr \
+ MANDIR="${D}"/usr/share/man \
+ DOCDIR="${D}"/usr/share/doc/${PF} \
+ install || die
+
+ dodoc "${D}"/usr/bin/vdrshutdown
+ rm -f "${D}"/usr/bin/vdrshutdown
+ dodoc set_timer
+
+ rm -f "${D}"/usr/sbin/time
+ rm -f "${D}"/usr/share/man/man*/time.8*
+
+ prepalldocs
+}
+
+pkg_postinst() {
+ echo
+ ewarn "WARNING:"
+ ewarn "This program writes into the NVRAM (used by BIOS to store the CMOS"
+ ewarn "settings). This is DANGEROUS. Do it at your own risk. Neither the"
+ ewarn "author of this program (nvram-wakeup) nor anyone else can be made"
+ ewarn "responsible to any damage made by this program in any way."
+ ewarn "(The worst case happened to me is that on reboot the BIOS noticed the"
+ ewarn "illegal contents of the nvram and set everything to default values."
+ ewarn "But this doesn't mean that you can't destroy even your whole computer.)"
+ echo
+ ewarn " YOU HAVE BEEN WARNED, HAVE A NICE DAY"
+ echo
+}
diff --git a/sys-power/nvram-wakeup/nvram-wakeup-1.1.ebuild b/sys-power/nvram-wakeup/nvram-wakeup-1.1.ebuild
new file mode 100644
index 000000000000..488798d69b10
--- /dev/null
+++ b/sys-power/nvram-wakeup/nvram-wakeup-1.1.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit flag-o-matic eutils
+
+MY_P=${P%_p*}
+[[ ${PV} == *_p* ]] && REV=${P#*_p} || unset REV
+MY_P=${MY_P/e}
+DESCRIPTION="read and write the WakeUp time in the BIOS"
+HOMEPAGE="http://sourceforge.net/projects/nvram-wakeup"
+SRC_URI="mirror://sourceforge/nvram-wakeup/${MY_P}.tar.gz
+ ${REV+http://nvram-wakeup.svn.sourceforge.net/viewvc/*checkout*/nvram-wakeup/trunk/nvram-wakeup/nvram-wakeup-mb.c?revision=${REV}}"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="nls"
+[[ -n ${REV} ]] && RESTRICT="mirror" #168114
+
+DEPEND="nls? ( sys-devel/gettext )"
+RDEPEND=""
+
+S=${WORKDIR}/${MY_P}
+
+src_unpack() {
+ unpack ${MY_P}.tar.gz
+ if [[ -n ${REV} ]] ; then
+ cp "${DISTDIR}"/nvram-wakeup-mb.c?revision=${REV} "${S}"/nvram-wakeup-mb.c || die
+ fi
+}
+
+src_prepare() {
+ use nls || epatch "${FILESDIR}"/${PN}-0.97-nonls.patch
+ # Need to be careful with CFLAGS since this could eat your bios
+ strip-flags
+ # GTTXT mode fix: https://sourceforge.net/tracker/?func=detail&aid=3599718&group_id=35022&atid=412757
+ sed -i \
+ -e '/^CFLAGS/s:= -O2 :+= $(CPPFLAGS) :' \
+ -e '/GTTXT/s:755:644:' \
+ Makefile || die
+}
+
+src_install() {
+ emake \
+ prefix="${D}"/usr \
+ MANDIR="${D}"/usr/share/man \
+ DOCDIR="${D}"/usr/share/doc/${PF} \
+ install
+
+ dodoc "${D}"/usr/bin/vdrshutdown
+ rm "${D}"/usr/bin/vdrshutdown || die
+ dodoc set_timer
+
+ rm "${D}"/usr/sbin/time || die
+ rm "${D}"/usr/share/man/man*/time.8* || die
+}
+
+pkg_postinst() {
+ echo
+ ewarn "WARNING:"
+ ewarn "This program writes into the NVRAM (used by BIOS to store the CMOS"
+ ewarn "settings). This is DANGEROUS. Do it at your own risk. Neither the"
+ ewarn "author of this program (nvram-wakeup) nor anyone else can be made"
+ ewarn "responsible to any damage made by this program in any way."
+ ewarn "(The worst case happened to me is that on reboot the BIOS noticed the"
+ ewarn "illegal contents of the nvram and set everything to default values."
+ ewarn "But this doesn't mean that you can't destroy even your whole computer.)"
+ echo
+ ewarn " YOU HAVE BEEN WARNED, HAVE A NICE DAY"
+ echo
+}
diff --git a/sys-power/phc-intel/Manifest b/sys-power/phc-intel/Manifest
new file mode 100644
index 000000000000..0d39c094a59b
--- /dev/null
+++ b/sys-power/phc-intel/Manifest
@@ -0,0 +1,3 @@
+DIST phc-intel-pack-rev15.1.tar.bz2 97762 SHA256 5154295f2cfc0e263510d71041a2d1d9a0d2e7a0c67730c9f80ba1011bbde8a4 SHA512 e0163f315343bb34dde57cb806d99b6ea6586b54827142a49532d862cbe02689d581e221ebd6466d1992107e4d98456989402ba4172e85b9e9f24405f27d28f1 WHIRLPOOL 5c02326541d0773cff668919d0d4809f3b79fd3bff6149c62d136760d440e5338b2a9e00a236f25bcb6dead4a65f74e4f1d3763a38bb996ddef315664758b621
+DIST phc-intel-pack-rev16.tar.bz2 100320 SHA256 545de96d22aee47cfe5b6292a0f55797cbc18aa03ca050831d8ff964be1896ca SHA512 bfe502e67f68ec7b4dbae77f0e2b57876928c6d5047697842c397a1d622978c270b85d0c5f83d22ca74a48942da60ab2b78e405ba866f55ee937f5b530f5165e WHIRLPOOL 0a693ee1a31047c7f3ba404ec7906045a54c94b48963da1274f24ee9f8f9ddb0f8fcc6e8c5a9b096594bd3b26f32de9058e60ca21d429d2c9bb7993944b32f6e
+DIST phc-intel-pack-rev17.tar.bz2 100565 SHA256 97e8659423ff9ce5e7f77e5e4049b100677a37b05a341d294aba286de1bbaeb9 SHA512 0db84ae3e366ff95577ee89b2e1cb22778fdba76783aa2606b6b5925e46c6e5daf80a7365eba6f3f806a017daa98d7b20828c644a3967f180c612e7c92a94871 WHIRLPOOL 795c73daeda3b42306560d799cd7d180e9f0888dc11ec36b2236a1ee000754780c0f299ebaec0ca4e1a73ca1326f0957d46823fb7500db28bd8b0946b24ec522
diff --git a/sys-power/phc-intel/files/phc-intel-0.3.2-rev12-trailing-space-misc.patch b/sys-power/phc-intel/files/phc-intel-0.3.2-rev12-trailing-space-misc.patch
new file mode 100644
index 000000000000..d20fb73a4fd6
--- /dev/null
+++ b/sys-power/phc-intel/files/phc-intel-0.3.2-rev12-trailing-space-misc.patch
@@ -0,0 +1,1179 @@
+Remove trailing white spaces from /proc output.
+
+Signed-off-by: Michael Weber <xmw@gentoo.org>
+--- phc-intel-pack-rev11/inc/2.6.27/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev11/inc/2.6.27/linux-phc-0.3.2.patch
+@@ -73,7 +73,7 @@
+
+ return 0;
+ }
+-@@ -757,12 +769,477 @@
++@@ -757,12 +769,482 @@
+ data->resume = 1;
+
+ return 0;
+@@ -156,6 +156,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -185,6 +186,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -211,6 +213,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -239,6 +242,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -270,6 +274,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+--- phc-intel-pack-rev11/inc/2.6.27.57/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev11/inc/2.6.27.57/linux-phc-0.3.2.patch
+@@ -74,7 +74,7 @@
+
+ return 0;
+ }
+-@@ -758,12 +770,477 @@
++@@ -758,12 +770,482 @@
+ data->resume = 1;
+
+ return 0;
+@@ -157,6 +157,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -186,6 +187,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -212,6 +214,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -240,6 +243,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -271,6 +275,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+--- phc-intel-pack-rev11/inc/2.6.28/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev11/inc/2.6.28/linux-phc-0.3.2.patch
+@@ -73,7 +73,7 @@
+
+ return 0;
+ }
+-@@ -758,12 +770,477 @@
++@@ -758,12 +770,482 @@
+ data->resume = 1;
+
+ return 0;
+@@ -156,6 +156,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -185,6 +186,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -211,6 +213,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -239,6 +242,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -270,6 +274,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+--- phc-intel-pack-rev11/inc/2.6.29/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev11/inc/2.6.29/linux-phc-0.3.2.patch
+@@ -73,7 +73,7 @@
+
+ return 0;
+ }
+-@@ -778,12 +790,477 @@
++@@ -778,12 +790,482 @@
+ data->resume = 1;
+
+ return 0;
+@@ -156,6 +156,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -185,6 +186,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -211,6 +213,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -239,6 +242,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -270,6 +274,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+--- phc-intel-pack-rev11/inc/2.6.29.2/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev11/inc/2.6.29.2/linux-phc-0.3.2.patch
+@@ -73,7 +73,7 @@
+
+ return 0;
+ }
+-@@ -790,12 +802,477 @@
++@@ -790,12 +802,482 @@
+ data->resume = 1;
+
+ return 0;
+@@ -156,6 +156,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -185,6 +186,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -211,6 +213,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -239,6 +242,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -270,6 +274,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+--- phc-intel-pack-rev11/inc/2.6.30/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev11/inc/2.6.30/linux-phc-0.3.2.patch
+@@ -72,7 +72,7 @@
+
+ return 0;
+ }
+-@@ -797,12 +809,474 @@
++@@ -797,12 +809,479 @@
+ data->resume = 1;
+
+ return 0;
+@@ -152,6 +152,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -181,6 +182,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -207,6 +209,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -235,6 +238,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -266,6 +270,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+--- phc-intel-pack-rev11/inc/2.6.31/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev11/inc/2.6.31/linux-phc-0.3.2.patch
+@@ -73,7 +73,7 @@
+
+ return 0;
+ }
+-@@ -793,12 +805,474 @@
++@@ -793,12 +805,479 @@
+ data->resume = 1;
+
+ return 0;
+@@ -153,6 +153,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -182,6 +183,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -208,6 +210,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -236,6 +239,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -267,6 +271,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+--- phc-intel-pack-rev11/inc/2.6.32/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev11/inc/2.6.32/linux-phc-0.3.2.patch
+@@ -72,7 +72,7 @@
+
+ return 0;
+ }
+-@@ -756,12 +768,474 @@
++@@ -756,12 +768,479 @@
+ data->resume = 1;
+
+ return 0;
+@@ -153,6 +153,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -182,6 +183,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -208,6 +210,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -236,6 +239,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -267,6 +271,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+--- phc-intel-pack-rev11/inc/2.6.32.27/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev11/inc/2.6.32.27/linux-phc-0.3.2.patch
+@@ -73,7 +73,7 @@
+
+ return 0;
+ }
+-@@ -757,12 +769,474 @@
++@@ -757,12 +769,479 @@
+ data->resume = 1;
+
+ return 0;
+@@ -154,6 +154,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -183,6 +184,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -209,6 +211,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -237,6 +240,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -268,6 +272,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+--- phc-intel-pack-rev11/inc/2.6.33/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev11/inc/2.6.33/linux-phc-0.3.2.patch
+@@ -72,7 +72,7 @@
+
+ return 0;
+ }
+-@@ -758,12 +770,474 @@
++@@ -758,12 +770,479 @@
+ data->resume = 1;
+
+ return 0;
+@@ -153,6 +153,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -182,6 +183,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -208,6 +210,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -236,6 +239,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -267,6 +271,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+--- phc-intel-pack-rev11/inc/2.6.33.8/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev11/inc/2.6.33.8/linux-phc-0.3.2.patch
+@@ -73,7 +73,7 @@
+
+ return 0;
+ }
+-@@ -759,12 +771,474 @@
++@@ -759,12 +771,479 @@
+ data->resume = 1;
+
+ return 0;
+@@ -154,6 +154,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -183,6 +184,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -209,6 +211,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -237,6 +240,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -268,6 +272,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+--- phc-intel-pack-rev11/inc/2.6.34/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev11/inc/2.6.34/linux-phc-0.3.2.patch
+@@ -72,7 +72,7 @@
+
+ return 0;
+ }
+-@@ -759,12 +771,474 @@
++@@ -759,12 +771,479 @@
+ data->resume = 1;
+
+ return 0;
+@@ -153,6 +153,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -182,6 +183,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -208,6 +210,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -236,6 +239,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -267,6 +271,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+--- phc-intel-pack-rev11/inc/2.6.34.9/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev11/inc/2.6.34.9/linux-phc-0.3.2.patch
+@@ -73,7 +73,7 @@
+
+ return 0;
+ }
+-@@ -760,12 +772,474 @@
++@@ -760,12 +772,479 @@
+ data->resume = 1;
+
+ return 0;
+@@ -154,6 +154,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -183,6 +184,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -209,6 +211,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -237,6 +240,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -268,6 +272,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+--- phc-intel-pack-rev11/inc/2.6.35/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev11/inc/2.6.35/linux-phc-0.3.2.patch
+@@ -72,7 +72,7 @@
+
+ return 0;
+ }
+-@@ -719,12 +731,474 @@
++@@ -719,12 +731,479 @@
+ data->resume = 1;
+
+ return 0;
+@@ -153,6 +153,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -182,6 +183,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -208,6 +210,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -236,6 +239,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -267,6 +271,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+--- phc-intel-pack-rev11/inc/2.6.35.10/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev11/inc/2.6.35.10/linux-phc-0.3.2.patch
+@@ -73,7 +73,7 @@
+
+ return 0;
+ }
+-@@ -720,12 +732,474 @@
++@@ -720,12 +732,479 @@
+ data->resume = 1;
+
+ return 0;
+@@ -154,6 +154,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -183,6 +184,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -209,6 +211,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -237,6 +240,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -268,6 +272,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+--- phc-intel-pack-rev11/inc/2.6.36/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev11/inc/2.6.36/linux-phc-0.3.2.patch
+@@ -72,7 +72,7 @@
+
+ return 0;
+ }
+-@@ -716,12 +728,474 @@
++@@ -716,12 +728,479 @@
+ data->resume = 1;
+
+ return 0;
+@@ -153,6 +153,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -182,6 +183,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -208,6 +210,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -236,6 +239,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -267,6 +271,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+--- phc-intel-pack-rev11/inc/2.6.36.2/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev11/inc/2.6.36.2/linux-phc-0.3.2.patch
+@@ -73,7 +73,7 @@
+
+ return 0;
+ }
+-@@ -717,12 +729,474 @@
++@@ -717,12 +729,479 @@
+ data->resume = 1;
+
+ return 0;
+@@ -154,6 +154,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -183,6 +184,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -209,6 +211,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -237,6 +240,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -268,6 +272,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+--- phc-intel-pack-rev11/inc/2.6.37/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev11/inc/2.6.37/linux-phc-0.3.2.patch
+@@ -71,7 +71,7 @@
+ }
+
+ return 0;
+-@@ -717,12 +729,474 @@
++@@ -717,12 +729,479 @@
+ data->resume = 1;
+
+ return 0;
+@@ -152,6 +152,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -181,6 +182,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -207,6 +209,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -235,6 +238,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -266,6 +270,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+--- phc-intel-pack-rev11/inc/3.10/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev11/inc/3.10/linux-phc-0.3.2.patch
+@@ -120,7 +120,7 @@
+ if (boot_cpu_has(X86_FEATURE_CPB) || boot_cpu_has(X86_FEATURE_IDA)) {
+ msrs = msrs_alloc();
+
+-@@ -963,10 +965,484 @@
++@@ -963,10 +965,489 @@
+ msrs_free(msrs);
+ msrs = NULL;
+ }
+@@ -198,6 +198,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -227,6 +228,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -253,6 +255,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -281,6 +284,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -312,6 +316,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+--- phc-intel-pack-rev11/inc/3.11/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev11/inc/3.11/linux-phc-0.3.2.patch
+@@ -122,7 +122,7 @@
+ if (boot_cpu_has(X86_FEATURE_CPB) || boot_cpu_has(X86_FEATURE_IDA)) {
+ msrs = msrs_alloc();
+
+-@@ -986,10 +987,485 @@
++@@ -986,10 +987,490 @@
+ msrs_free(msrs);
+ msrs = NULL;
+ }
+@@ -200,6 +200,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].driver_data].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -229,6 +230,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].driver_data]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -255,6 +257,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].driver_data].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -283,6 +286,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].driver_data].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -314,6 +318,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].driver_data]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+--- phc-intel-pack-rev11/inc/3.7.5/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev11/inc/3.7.5/linux-phc-0.3.2.patch
+@@ -120,7 +120,7 @@
+ if (boot_cpu_has(X86_FEATURE_CPB) || boot_cpu_has(X86_FEATURE_IDA)) {
+ msrs = msrs_alloc();
+
+-@@ -966,10 +968,484 @@
++@@ -966,10 +968,489 @@
+ msrs_free(msrs);
+ msrs = NULL;
+ }
+@@ -198,6 +198,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -227,6 +228,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -253,6 +255,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -281,6 +284,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -312,6 +316,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+--- phc-intel-pack-rev11/inc/3.9/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev11/inc/3.9/linux-phc-0.3.2.patch
+@@ -120,7 +120,7 @@
+ if (boot_cpu_has(X86_FEATURE_CPB) || boot_cpu_has(X86_FEATURE_IDA)) {
+ msrs = msrs_alloc();
+
+-@@ -970,10 +972,484 @@
++@@ -970,10 +972,489 @@
+ msrs_free(msrs);
+ msrs = NULL;
+ }
+@@ -198,6 +198,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -227,6 +228,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -253,6 +255,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -281,6 +284,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -312,6 +316,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+Remove trailing white spaces from /proc output.
+
+Signed-off-by: Michael Weber <xmw@gentoo.org>
+--- phc-intel-pack-rev12/inc/3.12/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev12/inc/3.12/linux-phc-0.3.2.patch
+@@ -97,7 +97,7 @@
+ static void __init acpi_cpufreq_boost_init(void)
+ {
+ if (boot_cpu_has(X86_FEATURE_CPB) || boot_cpu_has(X86_FEATURE_IDA)) {
+-@@ -982,6 +983,480 @@
++@@ -982,6 +983,485 @@
+ }
+ }
+
+@@ -173,6 +173,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].driver_data].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -202,6 +203,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].driver_data]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -228,6 +230,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].driver_data].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -256,6 +259,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].driver_data].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -287,6 +291,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].driver_data]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
diff --git a/sys-power/phc-intel/files/phc-intel-0.3.2-rev14-trailing-space-3.13.patch b/sys-power/phc-intel/files/phc-intel-0.3.2-rev14-trailing-space-3.13.patch
new file mode 100644
index 000000000000..4e1e4dfc8543
--- /dev/null
+++ b/sys-power/phc-intel/files/phc-intel-0.3.2-rev14-trailing-space-3.13.patch
@@ -0,0 +1,51 @@
+--- phc-intel-pack-rev14/inc/3.13/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev14/inc/3.13/linux-phc-0.3.2.patch
+@@ -197,7 +197,7 @@
+ static void __init acpi_cpufreq_boost_init(void)
+ {
+ if (boot_cpu_has(X86_FEATURE_CPB) || boot_cpu_has(X86_FEATURE_IDA)) {
+-@@ -956,6 +1050,480 @@
++@@ -956,6 +1050,485 @@
+ }
+ }
+
+@@ -273,6 +273,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].driver_data].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -302,6 +303,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].driver_data]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -328,6 +330,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].driver_data].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -356,6 +359,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].driver_data].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -387,6 +391,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].driver_data]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
diff --git a/sys-power/phc-intel/files/phc-intel-0.3.2-rev14-trailing-space-3.14.patch b/sys-power/phc-intel/files/phc-intel-0.3.2-rev14-trailing-space-3.14.patch
new file mode 100644
index 000000000000..19c1b546fb7d
--- /dev/null
+++ b/sys-power/phc-intel/files/phc-intel-0.3.2-rev14-trailing-space-3.14.patch
@@ -0,0 +1,51 @@
+--- phc-intel-pack-rev14/inc/3.14/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev14/inc/3.14/linux-phc-0.3.2.patch
+@@ -198,7 +198,7 @@
+ static void __init acpi_cpufreq_boost_init(void)
+ {
+ if (boot_cpu_has(X86_FEATURE_CPB) || boot_cpu_has(X86_FEATURE_IDA)) {
+-@@ -929,6 +1022,481 @@
++@@ -929,6 +1022,486 @@
+ }
+ }
+
+@@ -274,6 +274,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].driver_data].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -303,6 +304,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].driver_data]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -329,6 +331,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].driver_data].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -357,6 +360,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].driver_data].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -388,6 +392,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].driver_data]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
diff --git a/sys-power/phc-intel/files/phc-intel-0.3.2-rev15-trailing-space-3.15.patch b/sys-power/phc-intel/files/phc-intel-0.3.2-rev15-trailing-space-3.15.patch
new file mode 100644
index 000000000000..e1db916f7192
--- /dev/null
+++ b/sys-power/phc-intel/files/phc-intel-0.3.2-rev15-trailing-space-3.15.patch
@@ -0,0 +1,51 @@
+--- phc-intel-pack-rev15.1/inc/3.15/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev15.1/inc/3.15/linux-phc-0.3.2.patch
+@@ -198,7 +198,7 @@
+ static void __init acpi_cpufreq_boost_init(void)
+ {
+ if (boot_cpu_has(X86_FEATURE_CPB) || boot_cpu_has(X86_FEATURE_IDA)) {
+-@@ -929,6 +1022,481 @@
++@@ -929,6 +1022,486 @@
+ }
+ }
+
+@@ -274,6 +274,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].driver_data].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -303,6 +304,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].driver_data]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -329,6 +331,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].driver_data].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -357,6 +360,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].driver_data].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -388,6 +392,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].driver_data]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
diff --git a/sys-power/phc-intel/files/phc-intel-0.3.2-rev15-trailing-space-3.5.patch b/sys-power/phc-intel/files/phc-intel-0.3.2-rev15-trailing-space-3.5.patch
new file mode 100644
index 000000000000..01bf10bba48b
--- /dev/null
+++ b/sys-power/phc-intel/files/phc-intel-0.3.2-rev15-trailing-space-3.5.patch
@@ -0,0 +1,51 @@
+--- phc-intel-pack-rev15.1/inc/3.5/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev15.1/inc/3.5/linux-phc-0.3.2.patch
+@@ -55,7 +55,7 @@
+ kfree(data->freq_table);
+ kfree(data);
+ }
+-@@ -716,8 +728,470 @@
++@@ -716,8 +728,475 @@
+ return 0;
+ }
+
+@@ -134,6 +134,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -163,6 +164,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -189,6 +191,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -217,6 +220,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].index].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -248,6 +252,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].index]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
diff --git a/sys-power/phc-intel/files/phc-intel-0.3.2-rev16-trailing-space-3.16.patch b/sys-power/phc-intel/files/phc-intel-0.3.2-rev16-trailing-space-3.16.patch
new file mode 100644
index 000000000000..1934d9cde11a
--- /dev/null
+++ b/sys-power/phc-intel/files/phc-intel-0.3.2-rev16-trailing-space-3.16.patch
@@ -0,0 +1,51 @@
+--- phc-intel-pack-rev16/inc/3.16/linux-phc-0.3.2.patch
++++ phc-intel-pack-rev16/inc/3.16/linux-phc-0.3.2.patch
+@@ -195,7 +195,7 @@
+ static void __init acpi_cpufreq_boost_init(void)
+ {
+ if (boot_cpu_has(X86_FEATURE_CPB) || boot_cpu_has(X86_FEATURE_IDA)) {
+-@@ -928,6 +1019,481 @@
++@@ -928,6 +1019,486 @@
+ }
+ }
+
+@@ -271,6 +271,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].driver_data].control);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -300,6 +301,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].driver_data]);
+ + count += sprintf(&buf[count], "%u ", vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -326,6 +328,7 @@
+ + fid = extract_fid_from_control(acpi_data->states[freq_table[i].driver_data].control);
+ + count += sprintf(&buf[count], "%u ", fid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -354,6 +357,7 @@
+ + vid = extract_vid_from_control(acpi_data->states[freq_table[i].driver_data].control);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
+@@ -385,6 +389,7 @@
+ + vid = extract_vid_from_control(data->original_controls[freq_table[i].driver_data]);
+ + count += sprintf(&buf[count], "%u:%u ", fid, vid);
+ + }
+++ if (count) count--;
+ + count += sprintf(&buf[count], "\n");
+ +
+ + return count;
diff --git a/sys-power/phc-intel/metadata.xml b/sys-power/phc-intel/metadata.xml
new file mode 100644
index 000000000000..5b80fb94c393
--- /dev/null
+++ b/sys-power/phc-intel/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+<email>xmw@gentoo.org</email>
+<name>Michael Weber</name>
+</maintainer>
+</pkgmetadata>
diff --git a/sys-power/phc-intel/phc-intel-0.3.2.12.15.1.ebuild b/sys-power/phc-intel/phc-intel-0.3.2.12.15.1.ebuild
new file mode 100644
index 000000000000..de791a008df8
--- /dev/null
+++ b/sys-power/phc-intel/phc-intel-0.3.2.12.15.1.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit linux-info linux-mod eutils
+
+DESCRIPTION="Processor Hardware Control for Intel CPUs"
+HOMEPAGE="http://www.linux-phc.org/
+ http://www.linux-phc.org/forum/viewtopic.php?f=7&t=267"
+#no automatic filenames here, sorry
+SRC_URI="http://www.linux-phc.org/forum/download/file.php?id=161 -> phc-intel-pack-rev15.1.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+CONFIG_CHECK="~!X86_ACPI_CPUFREQ"
+ERROR_X86_ACPI_CPUFREQ="CONFIG_X86_ACPI_CPUFREQ has to be configured to Module to enable the replacement of acpi-cpufreq with phc-intel."
+
+MODULE_NAMES="phc-intel(misc:)"
+BUILD_PARAMS="KERNELSRC=\"${KERNEL_DIR}\" -j1"
+BUILD_TARGETS="all"
+
+S=${WORKDIR}/${A/.tar.bz2}
+
+pkg_setup() {
+ if kernel_is lt 2 6 27 ; then
+ eerror "Your kernel version is no longer supported by this version of ${PN}."
+ eerror "Please use a previous version of ${PN} or a newer kernel."
+ die
+ fi
+ if kernel_is gt 3 15 ; then
+ eerror "Your kernel version is not yet supported by this version of ${PN}."
+ eerror "Please use a newer version of ${PN} or an older kernel."
+ die
+ fi
+ linux-mod_pkg_setup
+}
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/phc-intel-0.3.2-rev12-trailing-space-misc.patch \
+ "${FILESDIR}"/phc-intel-0.3.2-rev15-trailing-space-3.5.patch \
+ "${FILESDIR}"/phc-intel-0.3.2-rev14-trailing-space-3.13.patch \
+ "${FILESDIR}"/phc-intel-0.3.2-rev14-trailing-space-3.14.patch \
+ "${FILESDIR}"/phc-intel-0.3.2-rev15-trailing-space-3.15.patch
+
+ sed -e '/^all:/s:prepare::' \
+ -i Makefile || die
+
+ local my_sub=arch/x86/kernel/cpu
+ if kernel_is gt 2 6 39 ; then
+ my_sub=drivers
+ fi
+ cp -v "${KERNEL_DIR}"/${my_sub}/cpufreq/acpi-cpufreq.c . || die
+ if kernel_is lt 3 12 ; then
+ cp -v "${KERNEL_DIR}"/${my_sub}/cpufreq/mperf.h . || die
+ fi
+
+ if kernel_is lt 3 0 ; then
+ epatch inc/${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}/linux-phc-0.3.2.patch
+ else
+ epatch inc/${KV_MAJOR}.${KV_MINOR}/linux-phc-0.3.2.patch
+ fi
+
+ mv acpi-cpufreq.c phc-intel.c || die
+}
diff --git a/sys-power/phc-intel/phc-intel-0.3.2.12.16.ebuild b/sys-power/phc-intel/phc-intel-0.3.2.12.16.ebuild
new file mode 100644
index 000000000000..0c6bad24c3a8
--- /dev/null
+++ b/sys-power/phc-intel/phc-intel-0.3.2.12.16.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit linux-info linux-mod eutils
+
+DESCRIPTION="Processor Hardware Control for Intel CPUs"
+HOMEPAGE="http://www.linux-phc.org/
+ http://www.linux-phc.org/forum/viewtopic.php?f=7&t=267"
+#no automatic filenames here, sorry
+SRC_URI="http://www.linux-phc.org/forum/download/file.php?id=162 -> phc-intel-pack-rev16.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+CONFIG_CHECK="~!X86_ACPI_CPUFREQ"
+ERROR_X86_ACPI_CPUFREQ="CONFIG_X86_ACPI_CPUFREQ has to be configured to Module to enable the replacement of acpi-cpufreq with phc-intel."
+
+MODULE_NAMES="phc-intel(misc:)"
+BUILD_PARAMS="KERNELSRC=\"${KERNEL_DIR}\" -j1"
+BUILD_TARGETS="all"
+
+S=${WORKDIR}/${A/.tar.bz2}
+
+pkg_setup() {
+ if kernel_is lt 2 6 27 ; then
+ eerror "Your kernel version is no longer supported by this version of ${PN}."
+ eerror "Please use a previous version of ${PN} or a newer kernel."
+ die
+ fi
+ if kernel_is gt 3 19 ; then
+ eerror "Your kernel version is not yet tested with this version of ${PN}."
+ eerror "It might not build or expose runtime problems."
+ fi
+ linux-mod_pkg_setup
+}
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/phc-intel-0.3.2-rev12-trailing-space-misc.patch \
+ "${FILESDIR}"/phc-intel-0.3.2-rev15-trailing-space-3.5.patch \
+ "${FILESDIR}"/phc-intel-0.3.2-rev14-trailing-space-3.13.patch \
+ "${FILESDIR}"/phc-intel-0.3.2-rev14-trailing-space-3.14.patch \
+ "${FILESDIR}"/phc-intel-0.3.2-rev15-trailing-space-3.15.patch \
+ "${FILESDIR}"/phc-intel-0.3.2-rev16-trailing-space-3.16.patch
+
+ sed -e '/^all:/s:prepare::' \
+ -i Makefile || die
+
+ local my_sub=arch/x86/kernel/cpu
+ if kernel_is gt 2 6 39 ; then
+ my_sub=drivers
+ fi
+ cp -v "${KERNEL_DIR}"/${my_sub}/cpufreq/acpi-cpufreq.c . || die
+ if kernel_is lt 3 12 ; then
+ cp -v "${KERNEL_DIR}"/${my_sub}/cpufreq/mperf.h . || die
+ fi
+
+ if kernel_is lt 3 0 ; then
+ epatch inc/${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}/linux-phc-0.3.2.patch
+ elif kernel_is lt 3 17 ; then
+ epatch inc/${KV_MAJOR}.${KV_MINOR}/linux-phc-0.3.2.patch
+ else
+ epatch inc/3.16/linux-phc-0.3.2.patch
+ fi
+
+ mv acpi-cpufreq.c phc-intel.c || die
+}
diff --git a/sys-power/phc-intel/phc-intel-0.3.2.12.17.ebuild b/sys-power/phc-intel/phc-intel-0.3.2.12.17.ebuild
new file mode 100644
index 000000000000..02ce12628d54
--- /dev/null
+++ b/sys-power/phc-intel/phc-intel-0.3.2.12.17.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit linux-info linux-mod eutils
+
+DESCRIPTION="Processor Hardware Control for Intel CPUs"
+HOMEPAGE="http://www.linux-phc.org/
+ http://www.linux-phc.org/forum/viewtopic.php?f=7&t=267"
+#no automatic filenames here, sorry
+SRC_URI="http://www.linux-phc.org/forum/download/file.php?id=166 -> phc-intel-pack-rev17.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+CONFIG_CHECK="~!X86_ACPI_CPUFREQ"
+ERROR_X86_ACPI_CPUFREQ="CONFIG_X86_ACPI_CPUFREQ has to be configured to Module to enable the replacement of acpi-cpufreq with phc-intel."
+
+MODULE_NAMES="phc-intel(misc:)"
+BUILD_PARAMS="KERNELSRC=\"${KERNEL_DIR}\" -j1"
+BUILD_TARGETS="all"
+
+S=${WORKDIR}/${A/.tar.bz2}
+
+pkg_setup() {
+ if kernel_is lt 2 6 27 ; then
+ eerror "Your kernel version is no longer supported by this version of ${PN}."
+ eerror "Please use a previous version of ${PN} or a newer kernel."
+ die
+ fi
+ if kernel_is gt 4 0 ; then
+ eerror "Your kernel version is not yet tested with this version of ${PN}."
+ eerror "It might not build or expose runtime problems."
+ fi
+ linux-mod_pkg_setup
+}
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/phc-intel-0.3.2-rev12-trailing-space-misc.patch \
+ "${FILESDIR}"/phc-intel-0.3.2-rev15-trailing-space-3.5.patch \
+ "${FILESDIR}"/phc-intel-0.3.2-rev14-trailing-space-3.13.patch \
+ "${FILESDIR}"/phc-intel-0.3.2-rev14-trailing-space-3.14.patch \
+ "${FILESDIR}"/phc-intel-0.3.2-rev15-trailing-space-3.15.patch \
+ "${FILESDIR}"/phc-intel-0.3.2-rev16-trailing-space-3.16.patch
+
+ sed -e '/^all:/s:prepare::' \
+ -i Makefile || die
+
+ local my_sub=arch/x86/kernel/cpu
+ if kernel_is gt 2 6 39 ; then
+ my_sub=drivers
+ fi
+ cp -v "${KERNEL_DIR}"/${my_sub}/cpufreq/acpi-cpufreq.c . || die
+ if kernel_is lt 3 12 ; then
+ cp -v "${KERNEL_DIR}"/${my_sub}/cpufreq/mperf.h . || die
+ fi
+
+ if kernel_is lt 3 0 ; then
+ epatch inc/${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}/linux-phc-0.3.2.patch
+ elif kernel_is lt 3 17 ; then
+ epatch inc/${KV_MAJOR}.${KV_MINOR}/linux-phc-0.3.2.patch
+ else
+ epatch inc/3.16/linux-phc-0.3.2.patch
+ fi
+
+ mv acpi-cpufreq.c phc-intel.c || die
+}
diff --git a/sys-power/phc-k8/Manifest b/sys-power/phc-k8/Manifest
new file mode 100644
index 000000000000..3a329dae8adc
--- /dev/null
+++ b/sys-power/phc-k8/Manifest
@@ -0,0 +1,2 @@
+DIST phc-k8-0.4.3.tar.gz 23324 SHA256 b72b02f77afb0cc32f04c2abbc88e1a23241eb1e3a2e9ed3159045f18087d859
+DIST phc-k8-0.4.4.tar.gz 24535 SHA256 19744a7ae94f19c1327e3e5542522f9ab5f978e4466f1973b7518e1a83e91edd
diff --git a/sys-power/phc-k8/metadata.xml b/sys-power/phc-k8/metadata.xml
new file mode 100644
index 000000000000..5b80fb94c393
--- /dev/null
+++ b/sys-power/phc-k8/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+<email>xmw@gentoo.org</email>
+<name>Michael Weber</name>
+</maintainer>
+</pkgmetadata>
diff --git a/sys-power/phc-k8/phc-k8-0.4.3.ebuild b/sys-power/phc-k8/phc-k8-0.4.3.ebuild
new file mode 100644
index 000000000000..1b3d9f2b75ed
--- /dev/null
+++ b/sys-power/phc-k8/phc-k8-0.4.3.ebuild
@@ -0,0 +1,43 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit linux-info linux-mod
+
+DESCRIPTION="Processor Hardware Control for AMD K8 CPUs"
+HOMEPAGE="http://www.linux-phc.org/"
+SRC_URI="http://www.linux-phc.org/forum/download/file.php?id=107 -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+S=${WORKDIR}/${PN}_v${PV}
+
+pkg_pretend() {
+ if kernel_is gt 3 0 0 ; then
+ eerror "This version is not compartible with linux 3.x (bug 376441)"
+ eerror "Please use >=sys-power/phc-k8-0.4.4 !"
+ einfo ; einfo ; einfo
+ die "wrong kernel version"
+ fi
+}
+
+pkg_setup() {
+ CONFIG_CHECK="~!X86_POWERNOW_K8"
+ ERROR_X86_POWERNOW_K8="CONFIG_X86_POWERNOW_K8 should be configured to Module, to
+a) include needed symbol cpufreq_get_measured_perf and
+b) enable the replacemant of powernow-k8 with phc-k8."
+
+ MODULE_NAMES="phc-k8(misc:)"
+ BUILD_PARAMS="KERNELSRC=\"${KERNEL_DIR}\" -j1"
+ BUILD_TARGETS="all"
+}
+
+src_install() {
+ linux-mod_src_install
+ dodoc Changelog README || die
+}
diff --git a/sys-power/phc-k8/phc-k8-0.4.4.ebuild b/sys-power/phc-k8/phc-k8-0.4.4.ebuild
new file mode 100644
index 000000000000..0326a297cb0b
--- /dev/null
+++ b/sys-power/phc-k8/phc-k8-0.4.4.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit linux-info linux-mod
+
+DESCRIPTION="Processor Hardware Control for AMD K8 CPUs"
+HOMEPAGE="http://www.linux-phc.org/"
+SRC_URI="http://www.linux-phc.org/forum/download/file.php?id=124 -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+S=${WORKDIR}/${PN}_v${PV}
+
+pkg_setup() {
+ CONFIG_CHECK="~!X86_POWERNOW_K8"
+ ERROR_X86_POWERNOW_K8="CONFIG_X86_POWERNOW_K8 should be configured to Module, to
+a) include needed symbol cpufreq_get_measured_perf and
+b) enable the replacemant of powernow-k8 with phc-k8."
+
+ MODULE_NAMES="phc-k8(misc:)"
+ BUILD_PARAMS="KERNELSRC=\"${KERNEL_DIR}\" -j1"
+ BUILD_TARGETS="all"
+
+ linux-mod_pkg_setup
+}
+
+src_prepare() {
+ sed -e '/error Only support for 2.6 series kernels/d' \
+ -i Makefile || die
+
+ if kernel_is gt 2 6 32 ; then
+ #use mperf.{c,h,ko) from kerel
+ sed -e '/^MODULES/s:mperf.ko::' \
+ -e '/^obj-m/s:mperf.o::' \
+ -i Makefile || die
+ fi
+}
+
+src_install() {
+ linux-mod_src_install
+ dodoc Changelog README
+}
diff --git a/sys-power/phctool/Manifest b/sys-power/phctool/Manifest
new file mode 100644
index 000000000000..3280107ec0d8
--- /dev/null
+++ b/sys-power/phctool/Manifest
@@ -0,0 +1 @@
+DIST phctool-0.5.2.2.tar.gz 941587 RMD160 3b4b496428fcb1951f5510ee7b4435f7725dc24a SHA1 8f0f2b6dd8023746a308cc2a7cab8a22a8e1ebab SHA256 ef60b13a74e7a123008a93d02759e99537a58c40091774a7e70e3e1d5960fa4a
diff --git a/sys-power/phctool/files/phctool-0.5.2.2_all_paths_tool_no_sudo.patch b/sys-power/phctool/files/phctool-0.5.2.2_all_paths_tool_no_sudo.patch
new file mode 100644
index 000000000000..2c4de7d32b6a
--- /dev/null
+++ b/sys-power/phctool/files/phctool-0.5.2.2_all_paths_tool_no_sudo.patch
@@ -0,0 +1,17 @@
+--- phctool.sh 2007-10-27 22:32:35.000000000 +0200
++++ phctool.sh 2009-09-05 23:20:18.000000000 +0200
+@@ -1,10 +1,7 @@
+ #!/bin/sh
+-#this shellscript is just a wrapper to subphctool.sh
+-#but necessary to run phctool with sudo even from the tray icon
+-PROGPATH=`dirname "$0"`
+-cd $PROGPATH
+-if test -e /usr/bin/gksu
+- then gksu ./subphctool.sh $1
+- else sudo ./subphctool.sh $1
+-fi
++#this shellscript is just a wrapper to phctool.py
++#but necessary to run phctool from another directory
++
++cd /usr/share/phctool
++./phctool.py $1
diff --git a/sys-power/phctool/files/phctool-0.5.2.2_all_paths_tool_sudo.patch b/sys-power/phctool/files/phctool-0.5.2.2_all_paths_tool_sudo.patch
new file mode 100644
index 000000000000..3ec8a9172403
--- /dev/null
+++ b/sys-power/phctool/files/phctool-0.5.2.2_all_paths_tool_sudo.patch
@@ -0,0 +1,18 @@
+--- phctool.sh 2007-10-27 22:32:35.000000000 +0200
++++ phctool.sh 2009-09-05 23:20:18.000000000 +0200
+@@ -1,10 +1,7 @@
+ #!/bin/sh
+-#this shellscript is just a wrapper to subphctool.sh
+-#but necessary to run phctool with sudo even from the tray icon
+-PROGPATH=`dirname "$0"`
+-cd $PROGPATH
+-if test -e /usr/bin/gksu
+- then gksu ./subphctool.sh $1
+- else sudo ./subphctool.sh $1
+-fi
++#this shellscript is just a wrapper to subphctool.py
++#but necessary to run phctool from another directory
++
++cd /usr/share/phctool
++sudo ./subphctool.sh $1
+
diff --git a/sys-power/phctool/files/phctool-0.5.2.2_all_paths_tray.patch b/sys-power/phctool/files/phctool-0.5.2.2_all_paths_tray.patch
new file mode 100644
index 000000000000..992ed5c7ef15
--- /dev/null
+++ b/sys-power/phctool/files/phctool-0.5.2.2_all_paths_tray.patch
@@ -0,0 +1,32 @@
+--- phctray.sh 2007-09-08 08:29:31.000000000 +0200
++++ phctray.sh 2009-09-05 23:16:54.000000000 +0200
+@@ -2,6 +2,5 @@
+ #this shellscript is just a wrapper to phctray.py
+ #but necessary to run phctray from another directory
+
+-PROGPATH=`dirname "$0"`
+-cd $PROGPATH
++cd /usr/share/phctool
+ ./phctray.py
+--- phctray.py 2009-09-08 12:17:11.000000000 +0200
++++ phctray.py 2009-09-08 12:17:33.000000000 +0200
+@@ -61,7 +61,7 @@
+ t.show_all()
+
+ ##call phctool without GUI to set stored values
+-cmd=[sys.path[0]+"/phctool.sh","background"] ##command
++cmd=["/usr/bin/phctool","background"] ##command
+ subprocess.Popen(cmd, shell=False) ##call the affinated programm
+
+ gtk.main()
+--- phctray.py 2009-09-08 12:22:28.000000000 +0200
++++ phctray.py 2009-09-08 12:23:44.000000000 +0200
+@@ -11,7 +11,7 @@
+ return;
+
+ def run_phctool( *args ):
+- cmd=[sys.path[0]+"/phctool.sh"] ##command
++ cmd=["/usr/bin/phctool"] ##command
+ subprocess.Popen(cmd, shell=False) ##call the affinated programm
+
+ def applet_face_click( window, event, *data ):
diff --git a/sys-power/phctool/files/phctool-0.5.2.2_gui_kernel_2.6.38.patch b/sys-power/phctool/files/phctool-0.5.2.2_gui_kernel_2.6.38.patch
new file mode 100644
index 000000000000..db33396e3d17
--- /dev/null
+++ b/sys-power/phctool/files/phctool-0.5.2.2_gui_kernel_2.6.38.patch
@@ -0,0 +1,21 @@
+--- phctool/inc/libs/cpuinfo.py
++++ phctool/inc/libs/cpuinfo.py
+@@ -1,6 +1,7 @@
+ #cpuinfo.py
+ #This is a function library to get
+ #informations about CPUs and its PHC data
++#Modified by Fabio Veronese fveronese85*at*gmail.com 22 Mar 2011
+
+
+ import os, string
+@@ -30,6 +31,10 @@
+ if os.path.exists('/proc/acpi/processor/CPU'+cpunr):
+ ##remember ACPI Pathname
+ self.data[cpunr]['acpi']['acpiname']='/proc/acpi/processor/CPU'+cpunr
++ elif os.path.exists('/sys/devices/system/cpu/cpu'+cpunr+'/thermal_throttle'):
++ ##here some throttling infos for 2.6.38 and maybe laters
++ #self.data[cpunr]['acpi']['acpiname']='/sys/devices/system/cpu/cpu'+cpunr+'/thermal_throttle'
++ self.data[cpunr]['acpi']['acpiname']=''
+ else:
+ self.data[cpunr]['acpi']['exist']=False
+ # For some reason we have to fallback on the old function...
diff --git a/sys-power/phctool/files/phctool-0.5.2.2_kernel_2.6.36.patch b/sys-power/phctool/files/phctool-0.5.2.2_kernel_2.6.36.patch
new file mode 100644
index 000000000000..beb9efa7e5c5
--- /dev/null
+++ b/sys-power/phctool/files/phctool-0.5.2.2_kernel_2.6.36.patch
@@ -0,0 +1,79 @@
+--- phctool-0.5.2-2/phctool/inc/libs/cpuinfo.py
++++ phctool-0.5.2-2/phctool/inc/libs/cpuinfo.py
+@@ -14,33 +14,49 @@
+
+
+ def _get_acpi_cpus(self):
+- ##count number of CPUs on this system using acpi proc interface
+- ##since we need acpi this i a good way to count CPUs
+- ##we also will remember the Directory-Name because on single CPU
+- ##systems the Dir may be named CPU while on Multicores they are indexed (CPU0, CPU1) ..
+- directory="/proc/acpi/processor/"
+- for f in os.listdir(directory): ##iterate the directory
+- pathname = os.path.join(directory, f) ##
+- if os.path.isdir(pathname): ##is the object we found really a (sub-)directory?
+- ##We open the info-file to get the ID to this CPU,
+- ##i don't know if this really could happen but the ID may differ from
+- ##from the Path iterator (maybe one CPU is supported and another isn't)
+- if os.path.exists(pathname+'/info'):
+- file = open(pathname+'/info', 'r');
+- for line in file:
+- if string.find(line,":"):
+- content = line.split(":");
+- if len(content)>1:
+- info_ident=content[0].strip();
+- info_value=content[1].strip();
+- if info_ident == "processor id":
+- cpunr=info_value
+- self.data[cpunr]={}
+- self.data[cpunr]['acpi']={}
+- self.data[cpunr]['acpi']['exist']=True
+- self.data[cpunr]['acpi']['acpiname']=f ##remember ACPI Pathname
+- else:
+- self.data[cpunr]['acpi']['exist']=False
++ # We need to ignore /proc/acpi/processor as it's becoming deprecated
++ # A good solution might be a look in online cpus, but it doesn't mean they are surely ACPI-supported
++ if os.path.exists('/sys/devices/system/cpu/online'):
++ file = open('/sys/devices/system/cpu/online', 'r');
++ for line in file:
++ if string.find(line,"-"):
++ content = line.split("-");
++ for val in content:
++ cpunr=val.strip();
++ self.data[cpunr]={}
++ self.data[cpunr]['acpi']={}
++ self.data[cpunr]['acpi']['exist']=True
++ # This sounds useful just for throttling, which is managed better by other stuff... I'll keep just for compatibility
++ if os.path.exists('/proc/acpi/processor/CPU'+cpunr):
++ ##remember ACPI Pathname
++ self.data[cpunr]['acpi']['acpiname']='/proc/acpi/processor/CPU'+cpunr
++ else:
++ self.data[cpunr]['acpi']['exist']=False
++ # For some reason we have to fallback on the old function...
++ else:
++ directory="/proc/acpi/processor/"
++ for f in os.listdir(directory): ##iterate the directory
++ pathname = os.path.join(directory, f) ##
++ if os.path.isdir(pathname): ##is the object we found really a (sub-)directory?
++ ##We open the info-file to get the ID to this CPU,
++ ##i don't know if this really could happen but the ID may differ from
++ ##from the Path iterator (maybe one CPU is supported and another isn't)
++ if os.path.exists(pathname+'/info'):
++ file = open(pathname+'/info', 'r');
++ for line in file:
++ if string.find(line,":"):
++ content = line.split(":");
++ if len(content)>1:
++ info_ident=content[0].strip();
++ info_value=content[1].strip();
++ if info_ident == "processor id":
++ cpunr=info_value
++ self.data[cpunr]={}
++ self.data[cpunr]['acpi']={}
++ self.data[cpunr]['acpi']['exist']=True
++ self.data[cpunr]['acpi']['acpiname']=f ##remember ACPI Pathname
++ else:
++ self.data[cpunr]['acpi']['exist']=False
+
+
+ def _get_cpuinfos(self):
diff --git a/sys-power/phctool/metadata.xml b/sys-power/phctool/metadata.xml
new file mode 100644
index 000000000000..c6a63cf13917
--- /dev/null
+++ b/sys-power/phctool/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+<email>xmw@gentoo.org</email>
+<name>Michael Weber</name>
+</maintainer>
+<use>
+ <flag name="sudo">Enable support for sudo to run gui from non-root user</flag>
+</use>
+</pkgmetadata>
diff --git a/sys-power/phctool/phctool-0.5.2.2-r1.ebuild b/sys-power/phctool/phctool-0.5.2.2-r1.ebuild
new file mode 100644
index 000000000000..0718c8c88ad2
--- /dev/null
+++ b/sys-power/phctool/phctool-0.5.2.2-r1.ebuild
@@ -0,0 +1,79 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=2
+
+PYTHON_DEPEND="2"
+inherit eutils python user
+
+DESCRIPTION="Processor Hardware Control userland configuration tool"
+HOMEPAGE="http://www.linux-phc.org/"
+SRC_URI="http://www.linux-phc.org/forum/download/file.php?id=50 -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc sudo"
+
+RDEPEND="dev-python/egg-python
+ dev-python/pygtk:2
+ sudo? ( app-admin/sudo )"
+
+S="${WORKDIR}/${PV%.*}-${PV##*.}/${PN}"
+
+pkg_setup() {
+ MY_PROGDIR="/usr/share/${PN}"
+ if use sudo ; then
+ MY_GROUPNAME="phcusers"
+ enewgroup ${MY_GROUPNAME}
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${P}_all_paths_tray.patch"
+ if use sudo; then
+ epatch "${FILESDIR}/${P}_all_paths_tool_sudo.patch"
+ else
+ epatch "${FILESDIR}/${P}_all_paths_tool_no_sudo.patch"
+ fi
+ epatch "${FILESDIR}/${P}_kernel_2.6.36.patch"
+ find . -name "*.pyc" -exec rm {} +
+}
+
+src_install() {
+ newbin phctool.sh phctool || die
+ newbin phctray.sh phctray || die
+
+ exeinto ${MY_PROGDIR}
+ doexe phc{tool,tray}.py subphctool.sh || die
+ insinto ${MY_PROGDIR}
+ doins -r inc || die
+
+ if use sudo ; then
+ fowners -R :${MY_GROUPNAME} "${MY_PROGDIR}" || die
+ fperms g+rX "${MY_PROGDIR}" || die
+ fi
+
+ dodoc CHANGELOG || die
+ if use doc; then
+ dohtml -r doc/docfiles doc/index.htm || die
+ fi
+}
+
+pkg_postinst() {
+ if use sudo; then
+ einfo "You have to add a line to /etc/sudoers to get access to"
+ einfo "/sys/devices/system/cpu/cpu1/cpufreq/phc_controls from the phctool/phctray"
+ einfo "Please check following line and add it to /etc/sudoser using visudo:"
+ einfo " %${MY_GROUPNAME} ALL=(root) NOPASSWD:${MY_PROGDIR}/subphctool.sh"
+ else
+ einfo "Group not automatically added. Please run phctool as root."
+ fi
+
+ python_mod_optimize ${MY_PROGDIR}
+}
+
+pkg_postrm() {
+ python_mod_cleanup ${MY_PROGDIR}
+}
diff --git a/sys-power/phctool/phctool-0.5.2.2-r2.ebuild b/sys-power/phctool/phctool-0.5.2.2-r2.ebuild
new file mode 100644
index 000000000000..638eda14b61b
--- /dev/null
+++ b/sys-power/phctool/phctool-0.5.2.2-r2.ebuild
@@ -0,0 +1,78 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+PYTHON_DEPEND="2"
+inherit eutils python user
+
+DESCRIPTION="Processor Hardware Control userland configuration tool"
+HOMEPAGE="http://www.linux-phc.org/"
+SRC_URI="http://www.linux-phc.org/forum/download/file.php?id=50 -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc sudo"
+
+RDEPEND="dev-python/egg-python
+ dev-python/pygtk:2
+ sudo? ( app-admin/sudo )"
+
+S="${WORKDIR}/${PV%.*}-${PV##*.}/${PN}"
+
+pkg_setup() {
+ MY_PROGDIR="/usr/share/${PN}"
+ if use sudo ; then
+ MY_GROUPNAME="phcusers"
+ enewgroup ${MY_GROUPNAME}
+ fi
+ python_pkg_setup
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}_all_paths_tray.patch
+ if use sudo ; then
+ epatch "${FILESDIR}"/${P}_all_paths_tool_sudo.patch
+ else
+ epatch "${FILESDIR}"/${P}_all_paths_tool_no_sudo.patch
+ fi
+ epatch "${FILESDIR}"/${P}_kernel_2.6.36.patch
+ epatch "${FILESDIR}"/${P}_gui_kernel_2.6.38.patch
+ find . -name "*.pyc" -delete || die
+}
+
+src_install() {
+ newbin phctool.sh phctool
+ newbin phctray.sh phctray
+
+ exeinto ${MY_PROGDIR}
+ doexe phc{tool,tray}.py subphctool.sh
+ insinto ${MY_PROGDIR}
+ doins -r inc
+
+ if use sudo ; then
+ fowners -R ":${MY_GROUPNAME}" "${MY_PROGDIR}"
+ fperms g+rX "${MY_PROGDIR}"
+ dodir /etc/sudoers.d
+ echo "#%${MY_GROUPNAME} ALL=(root) NOPASSWD:${MY_PROGDIR}/subphctool.sh" \
+ > "${ED}"/etc/sudoers.d/${PN} || die
+ fperms a-w,o-r /etc/sudoers.d/${PN}
+ fi
+
+ dodoc CHANGELOG
+ if use doc; then
+ dohtml -r doc/docfiles doc/index.htm
+ fi
+}
+
+pkg_postinst() {
+ if use sudo; then
+ einfo "You have to add a line to /etc/sudoers to get access to"
+ einfo "/sys/devices/system/cpu/cpu1/cpufreq/phc_controls from the phctool/phctray"
+ einfo "Please check and uncomment the content of /etc/sudoers.d/${PN}"
+ else
+ einfo "Group not automatically added. Please run phctool as root."
+ fi
+}
diff --git a/sys-power/pm-quirks/Manifest b/sys-power/pm-quirks/Manifest
new file mode 100644
index 000000000000..1cf76b90f1e4
--- /dev/null
+++ b/sys-power/pm-quirks/Manifest
@@ -0,0 +1 @@
+DIST pm-quirks-20100619.tar.gz 10033 RMD160 9382883b4e70a2e5318faebd29d4949990d6e7af SHA1 01aab63e2bb8c0f8d81d325ffce1fa49af0e2f3a SHA256 14a50518928c27417cdc8bcbabb32b3d986931de105149aa248d8883e56c61ec
diff --git a/sys-power/pm-quirks/metadata.xml b/sys-power/pm-quirks/metadata.xml
new file mode 100644
index 000000000000..854288052d19
--- /dev/null
+++ b/sys-power/pm-quirks/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>freedesktop</herd>
+</pkgmetadata>
diff --git a/sys-power/pm-quirks/pm-quirks-20100619.ebuild b/sys-power/pm-quirks/pm-quirks-20100619.ebuild
new file mode 100644
index 000000000000..99d6b10884c9
--- /dev/null
+++ b/sys-power/pm-quirks/pm-quirks-20100619.ebuild
@@ -0,0 +1,22 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=3
+inherit multilib
+
+DESCRIPTION="Video Quirks database for pm-utils"
+HOMEPAGE="http://pm-utils.freedesktop.org/"
+SRC_URI="http://pm-utils.freedesktop.org/releases/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ia64 ~mips ppc ppc64 sparc x86"
+IUSE=""
+
+S=${WORKDIR}
+
+src_install() {
+ insinto /usr/$(get_libdir)/pm-utils
+ doins -r video-quirks || die
+}
diff --git a/sys-power/pm-utils/Manifest b/sys-power/pm-utils/Manifest
new file mode 100644
index 000000000000..b0f96eb8f576
--- /dev/null
+++ b/sys-power/pm-utils/Manifest
@@ -0,0 +1 @@
+DIST pm-utils-1.4.1.tar.gz 208687 SHA256 8ed899032866d88b2933a1d34cc75e8ae42dcde20e1cc21836baaae3d4370c0b SHA512 5bc9479fe75f120aee136befeb24c8d7d85f61410b551177ed61fd1b4ea9cce7989796b067e357ea93b44b4ae9f66311687066f188236c5efdfd3750695a8017 WHIRLPOOL 7bf4752d96af776c90eb2d0319d615be157c8289551c72edb0c7fed05aeebbdc729f405d5ff04de401f4c12bfb8801e8b80242c3ba28e7b973442e51bf2374a3
diff --git a/sys-power/pm-utils/files/1.4.1-bluetooth-sync.patch b/sys-power/pm-utils/files/1.4.1-bluetooth-sync.patch
new file mode 100644
index 000000000000..b41f32cf9165
--- /dev/null
+++ b/sys-power/pm-utils/files/1.4.1-bluetooth-sync.patch
@@ -0,0 +1,43 @@
+From 640b53438c20818b3e344343b58b1f1765606a85 Mon Sep 17 00:00:00 2001
+From: Martin Pitt <martin.pitt@ubuntu.com>
+Date: Mon, 31 Jan 2011 15:30:01 +0100
+Subject: [PATCH] 49bluetooth: Wait for btusb module to get unused
+
+The 49bluetooth hook disables /proc/acpi/ibm/bluetooth but this isn't
+synchronous, i. e. it doesn't wait until the module usage count actually drops
+to 0. Due to that, it's impossible to add btusb to SUSPEND_MODULES (on some
+models/older kernels you need to do that to fix suspend problems), as at that
+point the module is still in use.
+
+On my system (ThinkPad X201) the module takes between 0.3 and 0.5 seconds to
+unload, so use 100 ms wait steps with a timeout of 2 seconds.
+
+Bug: https://bugs.freedesktop.org//show_bug.cgi?id=33759
+Bug-Ubuntu: https://launchpad.net/bugs/698331
+---
+ pm/sleep.d/49bluetooth | 9 +++++++++
+ 1 files changed, 9 insertions(+), 0 deletions(-)
+
+diff --git a/pm/sleep.d/49bluetooth b/pm/sleep.d/49bluetooth
+index d46ba49..0dc1909 100755
+--- a/pm/sleep.d/49bluetooth
++++ b/pm/sleep.d/49bluetooth
+@@ -12,6 +12,15 @@ suspend_bluetooth()
+ if grep -q enabled /proc/acpi/ibm/bluetooth; then
+ savestate ibm_bluetooth enable
+ echo disable > /proc/acpi/ibm/bluetooth
++
++ # wait for up to 2 seconds for the module to actually get
++ # unused
++ TIMEOUT=20
++ while [ $TIMEOUT -ge 0 ]; do
++ [ `cat /sys/module/btusb/refcnt` = 0 ] && break
++ TIMEOUT=$((TIMEOUT-1))
++ sleep 0.1
++ done
+ else
+ savestate ibm_bluetooth disable
+ fi
+--
+1.7.2.3
+
diff --git a/sys-power/pm-utils/files/1.4.1-disable-sata-alpm.patch b/sys-power/pm-utils/files/1.4.1-disable-sata-alpm.patch
new file mode 100644
index 000000000000..e3e3819b82eb
--- /dev/null
+++ b/sys-power/pm-utils/files/1.4.1-disable-sata-alpm.patch
@@ -0,0 +1,24 @@
+Description: Disable SATA link power management by default, as it still causes disk errors and corruptions on many hardware.
+Author: Martin Pitt <martin.pitt@ubuntu.com>
+Bug-Ubuntu: https://launchpad.net/bugs/539467
+
+--- pm/power.d/sata_alpm
++++ pm/power.d/sata_alpm
+@@ -2,7 +2,7 @@
+
+ . "${PM_FUNCTIONS}"
+
+-SATA_ALPM_ENABLE=${SATA_ALPM_ENABLE:-true}
++SATA_ALPM_ENABLE=${SATA_ALPM_ENABLE:-false}
+
+ help() {
+ cat <<EOF
+@@ -16,7 +16,7 @@
+
+ This hook has 1 parameter:
+ SATA_ALPM_ENABLE = whether to use SATA ALPM on battery.
+-Defaults to "true".
++Defaults to "false".
+
+ EOF
+ }
diff --git a/sys-power/pm-utils/files/1.4.1-echo-n.patch b/sys-power/pm-utils/files/1.4.1-echo-n.patch
new file mode 100644
index 000000000000..354ccb6a7e65
--- /dev/null
+++ b/sys-power/pm-utils/files/1.4.1-echo-n.patch
@@ -0,0 +1,51 @@
+From ffce4bc35a34b6b543e2ae2828a3096a19ebb1ae Mon Sep 17 00:00:00 2001
+From: Alexandre Rostovtsev <tetromino@gentoo.org>
+Date: Tue, 28 Jul 2015 22:24:56 -0400
+Subject: [PATCH] Avoid -n in "echo -n foo > /sys/bar"
+
+It's not portable and not needed.
+
+https://bugs.freedesktop.org/show_bug.cgi?id=91497
+
+[ Rebased on top of Gentoo's -r6 patchset. ]
+---
+ pm/pm-functions.in | 8 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/pm/pm-functions.in b/pm/pm-functions.in
+index c82be30..a68f955 100644
+--- a/pm/pm-functions.in
++++ b/pm/pm-functions.in
+@@ -296,13 +296,13 @@
+ if [ -z "$SUSPEND_MODULE" ]; then
+ if grep -q mem /sys/power/state; then
+ SUSPEND_MODULE="kernel"
+- do_suspend() { echo -n "mem" >/sys/power/state; }
++ do_suspend() { echo "mem" >/sys/power/state; }
+ elif [ -c /dev/pmu ] && pm-pmu --check; then
+ SUSPEND_MODULE="kernel"
+ do_suspend() { pm-pmu --suspend; }
+ elif grep -q standby /sys/power/state; then
+ SUSPEND_MODULE="kernel"
+- do_suspend() { echo -n "standby" >/sys/power/state; }
++ do_suspend() { echo "standby" >/sys/power/state; }
+ fi
+ fi
+
+@@ -317,10 +317,10 @@
+ HIBERNATE_MODE_SAVE=$(cat /sys/power/disk) && \
+ HIBERNATE_MODE_SAVE="${HIBERNATE_MODE_SAVE##*[}" && \
+ HIBERNATE_MODE_SAVE="${HIBERNATE_MODE_SAVE%%]*}" && \
+- echo -n "${HIBERNATE_MODE}" > /sys/power/disk
+- echo -n "disk" > /sys/power/state
++ echo "${HIBERNATE_MODE}" > /sys/power/disk
++ echo "disk" > /sys/power/state
+ RET=$?
+- echo -n "$HIBERNATE_MODE_SAVE" > /sys/power/disk
++ echo "$HIBERNATE_MODE_SAVE" > /sys/power/disk
+ return "$RET"
+ }
+ fi
+--
+2.4.6
+
diff --git a/sys-power/pm-utils/files/1.4.1-fix-alpm-typo.patch b/sys-power/pm-utils/files/1.4.1-fix-alpm-typo.patch
new file mode 100644
index 000000000000..799369159ff2
--- /dev/null
+++ b/sys-power/pm-utils/files/1.4.1-fix-alpm-typo.patch
@@ -0,0 +1,29 @@
+From 93d46b88f415c1931b017856e3162c192bfba07c Mon Sep 17 00:00:00 2001
+From: Martin Pitt <martin.pitt@ubuntu.com>
+Date: Wed, 11 Jan 2012 15:39:53 +0100
+Subject: [PATCH 3/3] Fix typo in sata_alpm
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+ALPM → APLM
+
+Bug: https://bugs.freedesktop.org/show_bug.cgi?id=44676
+Bug-Ubuntu: https://launchpad.net/bugs/900930
+---
+ pm/power.d/sata_alpm | 4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/pm/power.d/sata_alpm b/pm/power.d/sata_alpm
+index 5ede307..400e1e7 100644
+--- a/pm/power.d/sata_alpm
++++ b/pm/power.d/sata_alpm
+@@ -28,7 +28,7 @@ set_sata_alpm() {
+ [ "${kv%-*}" \< "2.6.33" ] && exit $NA # avoid fs corruption
+ for f in /sys/class/scsi_host/host*; do
+ [ -w "$f/link_power_management_policy" ] || continue
+- printf "Setting SATA APLM on %s to %s..." "${f##*/}" "$1"
++ printf "Setting SATA ALPM on %s to %s..." "${f##*/}" "$1"
+ echo "$1" > "$f/link_power_management_policy" && echo Done. || \
+ echo Failed.
+ done
diff --git a/sys-power/pm-utils/files/1.4.1-fix-intel-audio-powersave-hook.patch b/sys-power/pm-utils/files/1.4.1-fix-intel-audio-powersave-hook.patch
new file mode 100644
index 000000000000..2d884da1e7b6
--- /dev/null
+++ b/sys-power/pm-utils/files/1.4.1-fix-intel-audio-powersave-hook.patch
@@ -0,0 +1,40 @@
+From: Florian Kriener <florian@kriener.org>
+To: submit@bugs.debian.org
+Subject: [pm-utils] wrong path in intel-audio-powersave (and a small bug)
+Date: Sat, 25 Sep 2010 11:27:30 +0200
+
+In the script intel-audio-powersave is this loop
+
+for dev in /sys/module/snd_*/parameters/power_save; do
+ [ -w "$dev/parameters/power_save" ] || continue
+ printf "Setting power savings for $s to %d..." "$dev##*/" "$1"
+ echo $1 > "$dev/parameters/power_save" && echo Done. || echo Failed.
+done
+
+I think it should be
+
+for dev in /sys/module/snd_*; do
+ [ -w "$dev/parameters/power_save" ] || continue
+ printf "Setting power savings for %s to %d..." "${dev##*/}" "$1"
+ echo $1 > "$dev/parameters/power_save" && echo Done. || echo Failed.
+done
+
+
+This fixes the two bugs.
+
+diff --git a/pm/power.d/intel-audio-powersave b/pm/power.d/intel-audio-powersave
+index 36675a8..da63e40 100644
+--- a/pm/power.d/intel-audio-powersave
++++ b/pm/power.d/intel-audio-powersave
+@@ -20,9 +20,9 @@ EOF
+
+ audio_powersave() {
+ [ "$INTEL_AUDIO_POWERSAVE" = "true" ] || exit $NA
+- for dev in /sys/module/snd_*/parameters/power_save; do
++ for dev in /sys/module/snd_*; do
+ [ -w "$dev/parameters/power_save" ] || continue
+- printf "Setting power savings for $s to %d..." "$dev##*/" "$1"
++ printf "Setting power savings for %s to %d..." "${dev##*/}" "$1"
+ echo $1 > "$dev/parameters/power_save" && echo Done. || echo Failed.
+ done
+ }
diff --git a/sys-power/pm-utils/files/1.4.1-ignore-led-failure.patch b/sys-power/pm-utils/files/1.4.1-ignore-led-failure.patch
new file mode 100644
index 000000000000..7b8e4f2da1d1
--- /dev/null
+++ b/sys-power/pm-utils/files/1.4.1-ignore-led-failure.patch
@@ -0,0 +1,14 @@
+Description: LED operation should not block S3/S4
+Author: Adam Lee <adam8157@gmail.com>
+
+Some Lenovo Thinkpad models don't have a suspend LED, this should not
+block S3/S4.
+
+--- pm/sleep.d/95led
++++ pm/sleep.d/95led
+@@ -14,3 +14,5 @@
+ *) exit $NA
+ ;;
+ esac
++
++exit 0
diff --git a/sys-power/pm-utils/files/1.4.1-inhibit-on-right-status.patch b/sys-power/pm-utils/files/1.4.1-inhibit-on-right-status.patch
new file mode 100644
index 000000000000..250ae0872fbd
--- /dev/null
+++ b/sys-power/pm-utils/files/1.4.1-inhibit-on-right-status.patch
@@ -0,0 +1,20 @@
+Description: Do not use the exit status of log rather the exit status of the hook.
+
+http://bugs.freedesktop.org/show_bug.cgi?id=32210
+http://bugs.gentoo.org/360673
+
+--- pm/pm-functions.in
++++ pm/pm-functions.in
+@@ -197,9 +197,11 @@
+ # rest of args passed to hook unchanged.
+ log "Running hook $*:"
+ hook_ok "$1" && "$@"
++ # log() changes the return value, so save it for later
++ local status=$?
+ log ""
+ log -n "$*: "
+- hook_exit_status $? && LAST_HOOK="${1##*/}" || inhibit
++ hook_exit_status $status && LAST_HOOK="${1##*/}" || inhibit
+ }
+
+ if profiling; then
diff --git a/sys-power/pm-utils/files/1.4.1-logging-append.patch b/sys-power/pm-utils/files/1.4.1-logging-append.patch
new file mode 100644
index 000000000000..7a5d682b122d
--- /dev/null
+++ b/sys-power/pm-utils/files/1.4.1-logging-append.patch
@@ -0,0 +1,17 @@
+Author: James Westby <james.westby@ubuntu.com>
+Description: Do not clear the log file on each operation, but instead append to it.
+ This makes debugging of several suspends much easier.
+Bug: https://bugs.freedesktop.org/show_bug.cgi?id=25255
+Bug-Ubuntu: https://launchpad.net/bugs/410352
+
+--- pm/pm-functions.in
++++ pm/pm-functions.in
+@@ -271,7 +271,7 @@
+ return 1
+ fi
+ export LOGGING=true
+- exec > "$1" 2>&1
++ exec >> "$1" 2>&1
+ }
+
+ check_suspend() { [ -n "$SUSPEND_MODULE" ]; }
diff --git a/sys-power/pm-utils/files/1.4.1-run-hook-logging.patch b/sys-power/pm-utils/files/1.4.1-run-hook-logging.patch
new file mode 100644
index 000000000000..19ac4064d791
--- /dev/null
+++ b/sys-power/pm-utils/files/1.4.1-run-hook-logging.patch
@@ -0,0 +1,17 @@
+Description: In suspend log, put empty line after running the hook, not in between.
+Author: Dominique Brazziel <dbrazziel@snet.net>
+Bug-Debian: http://bugs.debian.org/661168
+
+--- pm/pm-functions.in
++++ pm/pm-functions.in
+@@ -199,9 +199,9 @@
+ hook_ok "$1" && "$@"
+ # log() changes the return value, so save it for later
+ local status=$?
+- log ""
+ log -n "$*: "
+ hook_exit_status $status && LAST_HOOK="${1##*/}" || inhibit
++ log ""
+ }
+
+ if profiling; then
diff --git a/sys-power/pm-utils/files/1.4.1-suspend-hybrid.patch b/sys-power/pm-utils/files/1.4.1-suspend-hybrid.patch
new file mode 100644
index 000000000000..8d92002733f3
--- /dev/null
+++ b/sys-power/pm-utils/files/1.4.1-suspend-hybrid.patch
@@ -0,0 +1,36 @@
+Description: Add support for in-kernel suspend to both
+Author: Bojan Smojver <bojan@rexursive.com>
+Author: Jaroslav Škarvada <jskarvad@redhat.com>
+Bug: https://bugs.freedesktop.org/show_bug.cgi?id=52572
+Bug-Ubuntu: https://launchpad.net/bugs/1172692
+
+--- pm/pm-functions.in
++++ pm/pm-functions.in
+@@ -336,8 +336,28 @@
+ {
+ [ -n "${HIBERNATE_MODE}" ] && \
+ grep -qw "${HIBERNATE_MODE}" /sys/power/disk && \
++ HIBERNATE_MODE_SAVE=$(cat /sys/power/disk) && \
++ HIBERNATE_MODE_SAVE="${HIBERNATE_MODE_SAVE##*[}" && \
++ HIBERNATE_MODE_SAVE="${HIBERNATE_MODE_SAVE%%]*}" && \
+ echo -n "${HIBERNATE_MODE}" > /sys/power/disk
+ echo -n "disk" > /sys/power/state
++ RET=$?
++ echo -n "$HIBERNATE_MODE_SAVE" > /sys/power/disk
++ return "$RET"
++ }
++fi
++
++# for kernels that support suspend to both (i.e. hybrid suspend)
++# since kernel 3.6
++if [ -z "$SUSPEND_HYBRID_MODULE" ] && \
++ [ -f /sys/power/disk ] && \
++ grep -q disk /sys/power/state && \
++ grep -q suspend /sys/power/disk; then
++ SUSPEND_HYBRID_MODULE="kernel"
++ do_suspend_hybrid()
++ {
++ HIBERNATE_MODE="suspend"
++ do_hibernate
+ }
+ fi
diff --git a/sys-power/pm-utils/files/1.4.1-uswsusp-hibernate-mode.patch b/sys-power/pm-utils/files/1.4.1-uswsusp-hibernate-mode.patch
new file mode 100644
index 000000000000..8c970698d5bb
--- /dev/null
+++ b/sys-power/pm-utils/files/1.4.1-uswsusp-hibernate-mode.patch
@@ -0,0 +1,19 @@
+Description: Check HIBERNATE_MODE in uswsusp module
+Author: Vadim Solomin <vadic052@gmail.com>
+Bug-Debian: http://bugs.debian.org/589553
+
+--- pm/module.d/uswsusp
++++ pm/module.d/uswsusp
+@@ -87,7 +87,11 @@
+ HIBERNATE_MODULE="uswsusp"
+ do_hibernate()
+ {
+- s2disk
++ if [ -n "$HIBERNATE_MODE" ]; then
++ s2disk -P "shutdown method=$HIBERNATE_MODE"
++ else
++ s2disk
++ fi
+ }
+ fi
+
diff --git a/sys-power/pm-utils/files/1.4.1-xfs_buffer_arguments.patch b/sys-power/pm-utils/files/1.4.1-xfs_buffer_arguments.patch
new file mode 100644
index 000000000000..3eee91166f88
--- /dev/null
+++ b/sys-power/pm-utils/files/1.4.1-xfs_buffer_arguments.patch
@@ -0,0 +1,31 @@
+From fdc626dadfd985e823f4e828f2a542c945aea219 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik@st.com>
+Date: Tue, 10 Jan 2012 11:21:02 +0100
+Subject: [PATCH 2/2] pm/power.d/xfs_buffer: Fix wrong argument ordering
+
+Write the values in the correct order.
+
+Bug: https://bugs.freedesktop.org/show_bug.cgi?id=44620
+Bug-Ubuntu: https://launchpad.net/bugs/645974
+
+Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
+---
+ pm/power.d/xfs_buffer | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/pm/power.d/xfs_buffer b/pm/power.d/xfs_buffer
+index d21e845..9f06f6e 100644
+--- a/pm/power.d/xfs_buffer
++++ b/pm/power.d/xfs_buffer
+@@ -59,7 +59,7 @@ xfs_ac() {
+ xfs_battery() {
+ state_exists xfs_buffer_default || \
+ read_values |savestate xfs_buffer_default
+- write_values "$XFS_AGE_BUFFER" "$XFS_BUFD" "$XFS_SYNCD"
++ write_values "$XFS_AGE_BUFFER" "$XFS_SYNCD" "$XFS_BUFD"
+ }
+
+ case $1 in
+--
+1.7.7.3
+
diff --git a/sys-power/pm-utils/files/pm-utils.logrotate b/sys-power/pm-utils/files/pm-utils.logrotate
new file mode 100644
index 000000000000..85de40035092
--- /dev/null
+++ b/sys-power/pm-utils/files/pm-utils.logrotate
@@ -0,0 +1,8 @@
+/var/log/pm-suspend.log /var/log/pm-powersave.log {
+ monthly
+ rotate 4
+ delaycompress
+ compress
+ notifempty
+ missingok
+}
diff --git a/sys-power/pm-utils/files/power.d/pci_devices b/sys-power/pm-utils/files/power.d/pci_devices
new file mode 100644
index 000000000000..c06b706d82a7
--- /dev/null
+++ b/sys-power/pm-utils/files/power.d/pci_devices
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+#
+# This script adjusts the power control of a set of PCI devices that
+# prove beneficial to enable power savings
+#
+
+PCI_DEVICES_PM_ENABLE="${PCI_DEVICES_PM_ENABLE:-true}"
+
+set_pci_device()
+{
+ for dev in /sys/bus/pci/devices/* ; do
+ if [ -e $dev/class -a -e $dev/power/control ]; then
+ id=`basename $dev`
+ case `cat $dev/class` in
+ 0x020000) # ethernet
+ echo "Setting Ethernet device $id to $1"
+ echo $1 > $dev/power/control
+ ;;
+ 0x028000) # wireless
+ echo "Setting Wireless device $id to $1"
+ echo $1 > $dev/power/control
+ ;;
+ 0x040300) # audio
+ echo "Setting Audio device $id to $1"
+ echo $1 > $dev/power/control
+ ;;
+ 0x060000) # host bridge
+ echo "Setting Host Bridge $id to $1"
+ echo $1 > $dev/power/control
+ ;;
+ 0x080500) # SD card reader
+ echo "Setting SD card reader device $id to $1"
+ echo $1 > $dev/power/control
+ ;;
+ 0x088000|0x088001) # card reader
+ echo "Setting card reader device $id to $1"
+ echo $1 > $dev/power/control
+ ;;
+ 0x0c0000|0x0c0010) # firewire
+ echo "Setting FireWire device $id to $1"
+ echo $1 > $dev/power/control
+ ;;
+ esac
+ fi
+ done
+}
+
+case "$1" in
+ true) # powersaving on
+ [ "$PCI_DEVICES_PM_ENABLE" = true ] && set_pci_device "auto"
+ ;;
+ false) # powersaving off
+ [ "$PCI_DEVICES_PM_ENABLE" = true ] && set_pci_device "on"
+ ;;
+ *)
+ exit 254
+ ;;
+esac
+
+exit 0
diff --git a/sys-power/pm-utils/files/power.d/usb_bluetooth b/sys-power/pm-utils/files/power.d/usb_bluetooth
new file mode 100644
index 000000000000..615d19e95631
--- /dev/null
+++ b/sys-power/pm-utils/files/power.d/usb_bluetooth
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+#
+# This script adjusts the USB bluetooth device settings via the USB
+# power control. This simply sets this to "auto" for power saving and to "on"
+# for non-power saving. This has been shown to save about 1W on some
+# systems.
+#
+# According to http://www.usb.org/developers/defined_class
+# USB wireless bluetooth devices have baseclass 0xe0, subclass 0x01,
+# protocol 0x01
+#
+
+USB_BLUETOOTH_PM_ENABLE="${USB_BLUETOOTH_PM_ENABLE:-true}"
+
+set_usb_bluetooth()
+{
+ for dev in /sys/bus/usb/devices/* ; do
+ if [ -e $dev/bDeviceClass -a \
+ -e $dev/bDeviceSubClass -a \
+ -e $dev/bDeviceProtocol -a \
+ -e $dev/power/control ]; then
+ if [ x`cat $dev/bDeviceClass` = xe0 -a \
+ x`cat $dev/bDeviceSubClass` = x01 -a \
+ x`cat $dev/bDeviceProtocol` = x01 ]; then
+ echo Setting $dev to $1
+ echo $1 > $dev/power/control
+ fi
+ fi
+ done
+}
+
+case "$1" in
+ true) # powersaving on
+ [ "$USB_BLUETOOTH_PM_ENABLE" = true ] && set_usb_bluetooth "auto"
+ ;;
+ false) # powersaving off
+ [ "$USB_BLUETOOTH_PM_ENABLE" = true ] && set_usb_bluetooth "on"
+ ;;
+ *)
+ exit 254
+ ;;
+esac
+
+exit 0
diff --git a/sys-power/pm-utils/files/sleep.d/50unload_alx b/sys-power/pm-utils/files/sleep.d/50unload_alx
new file mode 100644
index 000000000000..6d352c50f7c0
--- /dev/null
+++ b/sys-power/pm-utils/files/sleep.d/50unload_alx
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# 50unload_alx: unload the alx module during suspend (LP #1173952)
+
+[ -d /sys/module/alx ] || exit 0
+
+. "${PM_FUNCTIONS}"
+
+case "$1" in
+ suspend)
+ echo "Unloading alx kernel module ..."
+ modunload alx && echo Done. || echo Failed.
+ ;;
+ resume)
+ echo "Reloading alx kernel module ..."
+ ;;
+esac
+exit 0
diff --git a/sys-power/pm-utils/metadata.xml b/sys-power/pm-utils/metadata.xml
new file mode 100644
index 000000000000..e1f7c9831435
--- /dev/null
+++ b/sys-power/pm-utils/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>freedesktop</herd>
+ <maintainer>
+ <email>freedesktop-bugs@gentoo.org</email>
+ </maintainer>
+ <use>
+ <flag name="ntp">Install support for <pkg>net-misc/ntp</pkg></flag>
+ </use>
+</pkgmetadata>
diff --git a/sys-power/pm-utils/pm-utils-1.4.1-r6.ebuild b/sys-power/pm-utils/pm-utils-1.4.1-r6.ebuild
new file mode 100644
index 000000000000..ceb279a51d1d
--- /dev/null
+++ b/sys-power/pm-utils/pm-utils-1.4.1-r6.ebuild
@@ -0,0 +1,94 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils multilib
+
+DESCRIPTION="Suspend and hibernation utilities"
+HOMEPAGE="http://pm-utils.freedesktop.org/"
+SRC_URI="http://pm-utils.freedesktop.org/releases/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ia64 ~mips ppc ppc64 sparc x86"
+IUSE="alsa debug ntp video_cards_intel video_cards_radeon"
+
+vbetool="!video_cards_intel? ( sys-apps/vbetool )"
+RDEPEND="!<app-laptop/laptop-mode-tools-1.55-r1
+ !sys-power/powermgmt-base[-pm-utils(+)]
+ sys-apps/dbus
+ >=sys-apps/util-linux-2.13
+ sys-power/pm-quirks
+ alsa? ( media-sound/alsa-utils )
+ ntp? ( || ( net-misc/ntp net-misc/openntpd ) )
+ amd64? ( ${vbetool} )
+ x86? ( ${vbetool} )
+ video_cards_radeon? ( app-laptop/radeontool )"
+DEPEND="${RDEPEND}"
+
+DOCS="AUTHORS ChangeLog NEWS pm/HOWTO* README* TODO"
+
+src_prepare() {
+ local ignore="01grub"
+ use ntp || ignore+=" 90clock"
+
+ use debug && echo 'PM_DEBUG="true"' > "${T}"/gentoo
+ echo "HOOK_BLACKLIST=\"${ignore}\"" >> "${T}"/gentoo
+
+ epatch \
+ "${FILESDIR}"/${PV}-bluetooth-sync.patch \
+ "${FILESDIR}"/${PV}-disable-sata-alpm.patch \
+ "${FILESDIR}"/${PV}-fix-intel-audio-powersave-hook.patch \
+ "${FILESDIR}"/${PV}-logging-append.patch \
+ "${FILESDIR}"/${PV}-fix-alpm-typo.patch \
+ "${FILESDIR}"/${PV}-inhibit-on-right-status.patch \
+ "${FILESDIR}"/${PV}-ignore-led-failure.patch \
+ "${FILESDIR}"/${PV}-run-hook-logging.patch \
+ "${FILESDIR}"/${PV}-suspend-hybrid.patch \
+ "${FILESDIR}"/${PV}-uswsusp-hibernate-mode.patch \
+ "${FILESDIR}"/${PV}-xfs_buffer_arguments.patch
+}
+
+src_configure() {
+ econf --disable-doc
+}
+
+src_install() {
+ default
+ doman man/*.{1,8}
+
+ # Remove duplicate documentation install
+ rm -r "${ED}"/usr/share/doc/${PN}
+
+ insinto /etc/pm/config.d
+ doins "${T}"/gentoo
+
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}"/${PN}.logrotate ${PN} #408091
+
+ exeinto /usr/$(get_libdir)/${PN}/sleep.d
+ doexe "${FILESDIR}"/sleep.d/50unload_alx
+
+ exeinto /usr/$(get_libdir)/${PN}/power.d
+ doexe "${FILESDIR}"/power.d/{pci_devices,usb_bluetooth}
+
+ # No longer required with current networkmanager (rm -f from debian/rules)
+ rm -f "${ED}"/usr/$(get_libdir)/${PN}/sleep.d/55NetworkManager
+
+ # No longer required with current kernels (rm -f from debian/rules)
+ rm -f "${ED}"/usr/$(get_libdir)/${PN}/sleep.d/49bluetooth
+
+ # Punt HAL related file wrt #401257 (rm -f from debian/rules)
+ rm -f "${ED}"/usr/$(get_libdir)/${PN}/power.d/hal-cd-polling
+
+ # Punt hooks which have shown to not reduce, or even increase power usage
+ # (rm -f from debian rules)
+ rm -f "${ED}"/usr/$(get_libdir)/${PN}/power.d/{journal-commit,readahead}
+
+ # Remove hooks which are not stable enough yet (rm -f from debian/rules)
+ rm -f "${ED}"/usr/$(get_libdir)/${PN}/power.d/harddrive
+
+ # Change to executable (chmod +x from debian/rules)
+ fperms +x /usr/$(get_libdir)/${PN}/defaults
+}
diff --git a/sys-power/pm-utils/pm-utils-1.4.1-r7.ebuild b/sys-power/pm-utils/pm-utils-1.4.1-r7.ebuild
new file mode 100644
index 000000000000..a7b19e41fe4e
--- /dev/null
+++ b/sys-power/pm-utils/pm-utils-1.4.1-r7.ebuild
@@ -0,0 +1,95 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils multilib
+
+DESCRIPTION="Suspend and hibernation utilities"
+HOMEPAGE="http://pm-utils.freedesktop.org/"
+SRC_URI="http://pm-utils.freedesktop.org/releases/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
+IUSE="alsa debug ntp video_cards_intel video_cards_radeon"
+
+vbetool="!video_cards_intel? ( sys-apps/vbetool )"
+RDEPEND="!<app-laptop/laptop-mode-tools-1.55-r1
+ !sys-power/powermgmt-base[-pm-utils(+)]
+ sys-apps/dbus
+ >=sys-apps/util-linux-2.13
+ sys-power/pm-quirks
+ alsa? ( media-sound/alsa-utils )
+ ntp? ( || ( net-misc/ntp net-misc/openntpd ) )
+ amd64? ( ${vbetool} )
+ x86? ( ${vbetool} )
+ video_cards_radeon? ( app-laptop/radeontool )"
+DEPEND="${RDEPEND}"
+
+DOCS="AUTHORS ChangeLog NEWS pm/HOWTO* README* TODO"
+
+src_prepare() {
+ local ignore="01grub"
+ use ntp || ignore+=" 90clock"
+
+ use debug && echo 'PM_DEBUG="true"' > "${T}"/gentoo
+ echo "HOOK_BLACKLIST=\"${ignore}\"" >> "${T}"/gentoo
+
+ epatch \
+ "${FILESDIR}"/${PV}-bluetooth-sync.patch \
+ "${FILESDIR}"/${PV}-disable-sata-alpm.patch \
+ "${FILESDIR}"/${PV}-fix-intel-audio-powersave-hook.patch \
+ "${FILESDIR}"/${PV}-logging-append.patch \
+ "${FILESDIR}"/${PV}-fix-alpm-typo.patch \
+ "${FILESDIR}"/${PV}-inhibit-on-right-status.patch \
+ "${FILESDIR}"/${PV}-ignore-led-failure.patch \
+ "${FILESDIR}"/${PV}-run-hook-logging.patch \
+ "${FILESDIR}"/${PV}-suspend-hybrid.patch \
+ "${FILESDIR}"/${PV}-uswsusp-hibernate-mode.patch \
+ "${FILESDIR}"/${PV}-xfs_buffer_arguments.patch \
+ "${FILESDIR}"/${PV}-echo-n.patch
+}
+
+src_configure() {
+ econf --disable-doc
+}
+
+src_install() {
+ default
+ doman man/*.{1,8}
+
+ # Remove duplicate documentation install
+ rm -r "${ED}"/usr/share/doc/${PN}
+
+ insinto /etc/pm/config.d
+ doins "${T}"/gentoo
+
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}"/${PN}.logrotate ${PN} #408091
+
+ exeinto /usr/$(get_libdir)/${PN}/sleep.d
+ doexe "${FILESDIR}"/sleep.d/50unload_alx
+
+ exeinto /usr/$(get_libdir)/${PN}/power.d
+ doexe "${FILESDIR}"/power.d/{pci_devices,usb_bluetooth}
+
+ # No longer required with current networkmanager (rm -f from debian/rules)
+ rm -f "${ED}"/usr/$(get_libdir)/${PN}/sleep.d/55NetworkManager
+
+ # No longer required with current kernels (rm -f from debian/rules)
+ rm -f "${ED}"/usr/$(get_libdir)/${PN}/sleep.d/49bluetooth
+
+ # Punt HAL related file wrt #401257 (rm -f from debian/rules)
+ rm -f "${ED}"/usr/$(get_libdir)/${PN}/power.d/hal-cd-polling
+
+ # Punt hooks which have shown to not reduce, or even increase power usage
+ # (rm -f from debian rules)
+ rm -f "${ED}"/usr/$(get_libdir)/${PN}/power.d/{journal-commit,readahead}
+
+ # Remove hooks which are not stable enough yet (rm -f from debian/rules)
+ rm -f "${ED}"/usr/$(get_libdir)/${PN}/power.d/harddrive
+
+ # Change to executable (chmod +x from debian/rules)
+ fperms +x /usr/$(get_libdir)/${PN}/defaults
+}
diff --git a/sys-power/pmtools/Manifest b/sys-power/pmtools/Manifest
new file mode 100644
index 000000000000..d2731b946ec0
--- /dev/null
+++ b/sys-power/pmtools/Manifest
@@ -0,0 +1,2 @@
+DIST pmtools-20071116.tar.gz 51566 SHA256 91751774976e39f6237efd0326eb35196a9346220b92ad35894a33283e872748
+DIST pmtools-20110323.tar.gz 62002 SHA256 192ee6623ecb96cdcf20c73d8b93eadce003a343b3bab10f08a950ef3667a77a SHA512 81108c011b45c58c02013a3653c2d00bc2a9a9d80bf85438a193a4fed04a3fd2890d9cd4d64ab455e3e9c1613d35a6be59698395d9a27ca0a858e3935439bafd WHIRLPOOL 047828586a2e28af69be39b77b6a95766d7ac8040bf434d8e5d1064d3abe50e318c9ce352ae580f0c29a486208e4697d99eabddfd10a797b744d05ac6e1b3585
diff --git a/sys-power/pmtools/files/pmtools-20071116-64bit.patch b/sys-power/pmtools/files/pmtools-20071116-64bit.patch
new file mode 100644
index 000000000000..756ac8412abe
--- /dev/null
+++ b/sys-power/pmtools/files/pmtools-20071116-64bit.patch
@@ -0,0 +1,20 @@
+--- madt/madt.c.orig
++++ madt/madt.c
+@@ -46,7 +46,7 @@
+ {
+ size_t retval;
+
+- if (verbose) printf("reading %d byte entry header\n", sizeof(acpi_table_entry_header));
++ if (verbose) printf("reading %ld byte entry header\n", sizeof(acpi_table_entry_header));
+ retval = fread((void *)entry_header, sizeof(acpi_table_entry_header), 1, stdin);
+ return retval;
+ }
+@@ -64,7 +64,7 @@
+
+ bytes_read = csum = 0;
+
+- if (verbose) printf("reading %d madt header\n", sizeof(struct acpi_table_madt));
++ if (verbose) printf("reading %ld madt header\n", sizeof(struct acpi_table_madt));
+
+ retval = fread((void *)buffer, sizeof(struct acpi_table_madt), 1, stdin);
+ if (retval != 1) {
diff --git a/sys-power/pmtools/files/pmtools-20071116-acpixtract-pmtools.patch b/sys-power/pmtools/files/pmtools-20071116-acpixtract-pmtools.patch
new file mode 100644
index 000000000000..1e733663f3ed
--- /dev/null
+++ b/sys-power/pmtools/files/pmtools-20071116-acpixtract-pmtools.patch
@@ -0,0 +1,42 @@
+diff -Nuar --exclude '*.orig' --exclude '*.rej' pmtools-20071116.orig/acpixtract/acpixtract.c pmtools-20071116/acpixtract/acpixtract.c
+--- pmtools-20071116.orig/acpixtract/acpixtract.c 2007-11-16 10:45:44.000000000 -0800
++++ pmtools-20071116/acpixtract/acpixtract.c 2008-06-06 18:28:34.203106692 -0700
+@@ -199,7 +199,7 @@
+ void)
+ {
+
+- printf ("Usage: acpixtract [option] <InputFile>\n");
++ printf ("Usage: acpixtract-pmtools [option] <InputFile>\n");
+ printf ("\nExtract binary ACPI tables from text acpidump output\n");
+ printf ("Default invocation extracts all DSDTs and SSDTs\n");
+ printf ("Version %8.8X\n\n", VERSION);
+diff -Nuar --exclude '*.orig' --exclude '*.rej' pmtools-20071116.orig/madt/README pmtools-20071116/madt/README
+--- pmtools-20071116.orig/madt/README 2007-11-16 10:39:50.000000000 -0800
++++ pmtools-20071116/madt/README 2008-06-06 18:30:18.101885794 -0700
+@@ -2,7 +2,7 @@
+ Hacked out of Linux kernel code to do the same.
+
+ # ./acpidmp > acpidump.txt
+-$ acpixtract -a acpidump.txt
++$ acpixtract-pmtools -a acpidump.txt
+ $ madt < APIC.dat
+
+ ACPI: APIC (v001 INTEL D845EBT2 0x20021021 MSFT 0x00000097) @ 0x(nil)
+diff -Nuar --exclude '*.orig' --exclude '*.rej' pmtools-20071116.orig/README pmtools-20071116/README
+--- pmtools-20071116.orig/README 2007-11-16 10:54:27.000000000 -0800
++++ pmtools-20071116/README 2008-06-06 18:29:53.513505961 -0700
+@@ -24,11 +24,11 @@
+ and it is why the output doesn't change when different
+ kernels are booted.
+
+-./acpidump/acpixtract
+---------------------
++./acpidump/acpixtract-pmtools
++-----------------------------
+ Convert ASCII acpidump output to raw binary tables:
+
+- $ acpixtract/acpixtract -a acpidump.txt
++ $ acpixtract/acpixtract-pmtools -a acpidump.txt
+ Acpi table [DSDT] - 15974 bytes written to DSDT.dat
+ Acpi table [FACS] - 64 bytes written to FACS.dat
+ Acpi table [FACP] - 116 bytes written to FACP.dat
diff --git a/sys-power/pmtools/files/pmtools-20071116-cflags-ldflags.patch b/sys-power/pmtools/files/pmtools-20071116-cflags-ldflags.patch
new file mode 100644
index 000000000000..1d55e6a81b96
--- /dev/null
+++ b/sys-power/pmtools/files/pmtools-20071116-cflags-ldflags.patch
@@ -0,0 +1,38 @@
+--- acpidump/Makefile.orig
++++ acpidump/Makefile
+@@ -1,11 +1,11 @@
+ PROG= acpidump
+ SRCS= acpidump.c
+ KERNEL_INCLUDE := ../include
+-CFLAGS += -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Os -s -D_LINUX -DDEFINE_ALTERNATE_TYPES -I$(KERNEL_INCLUDE)
++CFLAGS += -Wall -Wstrict-prototypes -Wdeclaration-after-statement -D_LINUX -DDEFINE_ALTERNATE_TYPES -I$(KERNEL_INCLUDE)
+
+ all: acpidump
+ $(PROG) : $(SRCS)
+- $(CC) $(CFLAGS) $(SRCS) -o $(PROG)
++ $(CC) $(CFLAGS) $(LDFLAGS) $(SRCS) -o $(PROG)
+
+ CLEANFILES= $(PROG)
+
+--- acpixtract/Makefile.orig
++++ acpixtract/Makefile
+@@ -6,7 +6,7 @@
+ all: $(PROG)
+
+ $(PROG) : $(SRCS)
+- $(CC) $(CFLAGS) $(SRCS) -o $(PROG)
++ $(CC) $(CFLAGS) $(LDFLAGS) $(SRCS) -o $(PROG)
+
+ CLEANFILES= $(PROG)
+
+--- madt/Makefile.orig
++++ madt/Makefile
+@@ -3,7 +3,7 @@
+
+ all: madt
+ $(PROG) : $(SRCS)
+- $(CC) $(CFLAGS) $(SRCS) -o $(PROG)
++ $(CC) $(CFLAGS) $(LDFLAGS) $(SRCS) -o $(PROG)
+
+ test: madt
+ ./madt < example.APIC.dat
diff --git a/sys-power/pmtools/files/pmtools-20100123-acpixtract-pmtools.patch b/sys-power/pmtools/files/pmtools-20100123-acpixtract-pmtools.patch
new file mode 100644
index 000000000000..feca654687b3
--- /dev/null
+++ b/sys-power/pmtools/files/pmtools-20100123-acpixtract-pmtools.patch
@@ -0,0 +1,42 @@
+diff -Nuar pmtools-20100123.orig/acpixtract/acpixtract.c pmtools-20100123/acpixtract/acpixtract.c
+--- pmtools-20100123.orig/acpixtract/acpixtract.c 2010-01-23 19:31:07.000000000 +0100
++++ pmtools-20100123/acpixtract/acpixtract.c 2010-03-07 14:44:32.451141841 +0100
+@@ -199,7 +199,7 @@
+ void)
+ {
+
+- printf ("Usage: acpixtract [option] <InputFile>\n");
++ printf ("Usage: acpixtract-pmtools [option] <InputFile>\n");
+ printf ("\nExtract binary ACPI tables from text acpidump output\n");
+ printf ("Default invocation extracts all DSDTs and SSDTs\n");
+ printf ("Version %8.8X\n\n", VERSION);
+diff -Nuar pmtools-20100123.orig/madt/README pmtools-20100123/madt/README
+--- pmtools-20100123.orig/madt/README 2005-11-11 18:07:04.000000000 +0100
++++ pmtools-20100123/madt/README 2010-03-07 14:45:31.818052302 +0100
+@@ -1,7 +1,7 @@
+ User utility to parse the ACPI MADT
+ Hacked out of Linux kernel code to do the same.
+
+-# ./acpidmp | ./acpixtract APIC | ./madt
++# ./acpidmp | ./acpixtract-pmtools APIC | ./madt
+
+ ACPI: APIC (v001 INTEL D845EBT2 0x20021021 MSFT 0x00000097) @ 0x(nil)
+ ACPI: LAPIC (acpi_id[0x01] lapic_id[0x00] enabled)
+diff -Nuar pmtools-20100123.orig/README pmtools-20100123/README
+--- pmtools-20100123.orig/README 2010-01-23 19:31:52.000000000 +0100
++++ pmtools-20100123/README 2010-03-07 14:47:18.286017297 +0100
+@@ -17,11 +17,11 @@
+
+ # ./acpidump > acpidump.out
+
+-./acpidump/acpixtract
+---------------------
++./acpidump/acpixtract-pmtools
++-----------------------------
+ Convert ASCII acpidump output to raw binary tables:
+
+- $ acpixtract/acpixtract -a acpidump.out
++ $ acpixtract/acpixtract-pmtools -a acpidump.out
+ Acpi table [DSDT] - 15974 bytes written to DSDT.dat
+ Acpi table [FACS] - 64 bytes written to FACS.dat
+ Acpi table [FACP] - 116 bytes written to FACP.dat
diff --git a/sys-power/pmtools/files/pmtools-20100123-cflags-ldflags.patch b/sys-power/pmtools/files/pmtools-20100123-cflags-ldflags.patch
new file mode 100644
index 000000000000..57642abacfe6
--- /dev/null
+++ b/sys-power/pmtools/files/pmtools-20100123-cflags-ldflags.patch
@@ -0,0 +1,52 @@
+diff -Nuar pmtools-20100123.orig/acpidump/Makefile pmtools-20100123/acpidump/Makefile
+--- pmtools-20100123.orig/acpidump/Makefile 2006-11-30 13:41:15.000000000 +0100
++++ pmtools-20100123/acpidump/Makefile 2010-03-07 14:19:12.337141824 +0100
+@@ -1,11 +1,11 @@
+ PROG= acpidump
+ SRCS= acpidump.c
+ KERNEL_INCLUDE := ../include
+-CFLAGS += -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Os -s -D_LINUX -DDEFINE_ALTERNATE_TYPES -I$(KERNEL_INCLUDE)
++CFLAGS += -Wall -Wstrict-prototypes -Wdeclaration-after-statement -D_LINUX -DDEFINE_ALTERNATE_TYPES -I$(KERNEL_INCLUDE)
+
+ all: acpidump
+ $(PROG) : $(SRCS)
+- $(CC) $(CFLAGS) $(SRCS) -o $(PROG)
++ $(CC) $(CFLAGS) $(LDFLAGS) $(SRCS) -o $(PROG)
+
+ CLEANFILES= $(PROG)
+
+diff -Nuar pmtools-20100123.orig/acpixtract/Makefile pmtools-20100123/acpixtract/Makefile
+--- pmtools-20100123.orig/acpixtract/Makefile 2006-11-30 13:45:06.000000000 +0100
++++ pmtools-20100123/acpixtract/Makefile 2010-03-07 14:19:12.337141824 +0100
+@@ -6,7 +6,7 @@
+ all: $(PROG)
+
+ $(PROG) : $(SRCS)
+- $(CC) $(CFLAGS) $(SRCS) -o $(PROG)
++ $(CC) $(CFLAGS) $(LDFLAGS) $(SRCS) -o $(PROG)
+
+ CLEANFILES= $(PROG)
+
+diff -Nuar pmtools-20100123.orig/madt/Makefile pmtools-20100123/madt/Makefile
+--- pmtools-20100123.orig/madt/Makefile 2005-11-11 18:07:04.000000000 +0100
++++ pmtools-20100123/madt/Makefile 2010-03-07 14:22:15.199017246 +0100
+@@ -1,6 +1,6 @@
+ test: madt
+ ./madt < APIC
+ madt: madt.c acpi.h tables.c
+- cc -o madt madt.c
++ $(CC) $(CFLAGS) $(LDFLAGS) madt.c -o madt
+ clean:
+ rm madt
+diff -Nuar pmtools-20100123.orig/turbostat/Makefile pmtools-20100123/turbostat/Makefile
+--- pmtools-20100123.orig/turbostat/Makefile 2010-01-23 19:19:32.000000000 +0100
++++ pmtools-20100123/turbostat/Makefile 2010-03-07 14:26:10.473010923 +0100
+@@ -4,7 +4,7 @@
+ all: turbostat
+
+ $(PROG) : $(SRCS)
+- $(CC) $(CFLAGS) $(SRCS) -o $(PROG)
++ $(CC) $(CFLAGS) $(LDFLAGS) $(SRCS) -o $(PROG)
+
+ CLEANFILES= $(PROG)
+
diff --git a/sys-power/pmtools/files/pmtools-20100123-madt.patch b/sys-power/pmtools/files/pmtools-20100123-madt.patch
new file mode 100644
index 000000000000..49aca9f4c76c
--- /dev/null
+++ b/sys-power/pmtools/files/pmtools-20100123-madt.patch
@@ -0,0 +1,39 @@
+diff -Nuar pmtools-20100123.orig/madt/madt.c pmtools-20100123/madt/madt.c
+--- pmtools-20100123.orig/madt/madt.c 2005-11-11 18:07:04.000000000 +0100
++++ pmtools-20100123/madt/madt.c 2010-03-07 14:39:31.657017114 +0100
+@@ -26,8 +26,6 @@
+
+ #define printk printf
+
+-#include "./tables.c"
+-
+ //#define INPUT_FILE "madt.dat"
+ //#include <sys/types.h>
+ //#include <sys/stat.h>
+@@ -37,6 +35,8 @@
+ #include <stdio.h> // fread
+ #include <stdlib.h> // malloc
+
++#include "./tables.c"
++
+ int verbose = 0;
+ /*
+ /* read standard input
+diff -Nuar pmtools-20100123.orig/madt/Makefile pmtools-20100123/madt/Makefile
+--- pmtools-20100123.orig/madt/Makefile 2005-11-11 18:07:04.000000000 +0100
++++ pmtools-20100123/madt/Makefile 2010-03-07 14:34:17.486002917 +0100
+@@ -1,3 +1,5 @@
++all: madt
++
+ test: madt
+ ./madt < APIC
+ madt: madt.c acpi.h tables.c
+diff -Nuar pmtools-20100123.orig/Makefile pmtools-20100123/Makefile
+--- pmtools-20100123.orig/Makefile 2010-01-23 19:18:18.000000000 +0100
++++ pmtools-20100123/Makefile 2010-03-07 14:33:01.729955480 +0100
+@@ -1,4 +1,4 @@
+-DIRS = acpidump acpixtract turbostat
++DIRS = acpidump acpixtract madt turbostat
+
+ all:
+ for i in $(DIRS); do $(MAKE) -C $$i $@; done
diff --git a/sys-power/pmtools/files/pmtools-20101124-cflags-ldflags.patch b/sys-power/pmtools/files/pmtools-20101124-cflags-ldflags.patch
new file mode 100644
index 000000000000..0ae69e8c46d4
--- /dev/null
+++ b/sys-power/pmtools/files/pmtools-20101124-cflags-ldflags.patch
@@ -0,0 +1,48 @@
+diff -Nuar pmtools-20100123.orig/acpidump/Makefile pmtools-20100123/acpidump/Makefile
+--- pmtools-20100123.orig/acpidump/Makefile 2006-11-30 13:41:15.000000000 +0100
++++ pmtools-20100123/acpidump/Makefile 2010-03-07 14:19:12.337141824 +0100
+@@ -1,11 +1,11 @@
+ PROG= acpidump
+ SRCS= acpidump.c
+ KERNEL_INCLUDE := ../include
+-CFLAGS += -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Os -s -D_LINUX -DDEFINE_ALTERNATE_TYPES -I$(KERNEL_INCLUDE)
++CFLAGS += -Wall -Wstrict-prototypes -Wdeclaration-after-statement -D_LINUX -DDEFINE_ALTERNATE_TYPES -I$(KERNEL_INCLUDE)
+
+ all: acpidump
+ $(PROG) : $(SRCS)
+- $(CC) $(CFLAGS) $(SRCS) -o $(PROG)
++ $(CC) $(CFLAGS) $(LDFLAGS) $(SRCS) -o $(PROG)
+
+ CLEANFILES= $(PROG)
+
+diff -Nuar pmtools-20100123.orig/acpixtract/Makefile pmtools-20100123/acpixtract/Makefile
+--- pmtools-20100123.orig/acpixtract/Makefile 2006-11-30 13:45:06.000000000 +0100
++++ pmtools-20100123/acpixtract/Makefile 2010-03-07 14:19:12.337141824 +0100
+@@ -6,7 +6,7 @@
+ all: $(PROG)
+
+ $(PROG) : $(SRCS)
+- $(CC) $(CFLAGS) $(SRCS) -o $(PROG)
++ $(CC) $(CFLAGS) $(LDFLAGS) $(SRCS) -o $(PROG)
+
+ CLEANFILES= $(PROG)
+
+diff -Nuar pmtools-20100123.orig/madt/Makefile pmtools-20100123/madt/Makefile
+--- pmtools-20100123.orig/madt/Makefile 2005-11-11 18:07:04.000000000 +0100
++++ pmtools-20100123/madt/Makefile 2010-03-07 14:22:15.199017246 +0100
+@@ -1,6 +1,6 @@
+ test: madt
+ ./madt < APIC
+ madt: madt.c acpi.h tables.c
+- cc -o madt madt.c
++ $(CC) $(CFLAGS) $(LDFLAGS) madt.c -o madt
+ clean:
+ rm madt
+--- pmtools-20101124.orig/turbostat/Makefile.old 2010-11-27 22:13:00.405571001 +0100
++++ pmtools-20101124/turbostat/Makefile 2010-11-27 22:16:39.070571001 +0100
+@@ -1,3 +1,5 @@
++all : turbostat
++
+ turbostat : turbostat.c
+
+ clean :
diff --git a/sys-power/pmtools/metadata.xml b/sys-power/pmtools/metadata.xml
new file mode 100644
index 000000000000..59c25fcc789f
--- /dev/null
+++ b/sys-power/pmtools/metadata.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>robbat2@gentoo.org</email>
+ </maintainer>
+ <maintainer>
+ <email>prometheanfire@gentoo.org</email>
+ </maintainer>
+ <longdescription>This package really just provides acpidump and associated tools
+for extracting ACPI tables to edit/reload buggy BIOS tables (works with iasl).
+Useful for all ACPI-based systems (not just mobile/laptop systems).
+</longdescription>
+ <upstream>
+ <remote-id type="github">anyc/pmtools</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-power/pmtools/pmtools-20071116.ebuild b/sys-power/pmtools/pmtools-20071116.ebuild
new file mode 100644
index 000000000000..74fa42b6439d
--- /dev/null
+++ b/sys-power/pmtools/pmtools-20071116.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils flag-o-matic toolchain-funcs
+
+DESCRIPTION="ACPI disassembler tools, including acpidump"
+HOMEPAGE="http://www.lesswatts.org/projects/acpi/utilities.php"
+SRC_URI="http://www.lesswatts.org/patches/linux_acpi/${P}.tar.gz"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86"
+IUSE=""
+DEPEND=""
+RDEPEND="${DEPEND}
+ dev-lang/perl
+ >=sys-power/iasl-20060512"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ epatch "${FILESDIR}"/${PN}-20071116-acpixtract-pmtools.patch
+
+ sed -i.orig -e '/^CFLAGS/s, -s , ,' \
+ -i.orig -e "s:-Os::g" \
+ acpidump/Makefile || die "sed failed"
+
+ strip-unsupported-flags
+}
+
+src_compile() {
+ # respect user's LDFLAGS
+ emake CC="$(tc-getCC)" LDFLAGS="${LDFLAGS}" || die "emake failed"
+}
+
+src_install() {
+ # acpidump access the ACPI data via /dev/mem or EFI firmware in /sys
+ dosbin acpidump/acpidump
+ # the other tools only process data
+ newbin acpixtract/acpixtract acpixtract-pmtools
+ dobin madt/madt
+
+ dodoc README
+ docinto madt
+ dodoc madt/README madt/example.APIC*
+}
+
+pkg_postinst() {
+ ewarn "Please note that acpixtract is now named acpixtract-pmtools to avoid"
+ ewarn "conflicts with the new tool of the same name from the iasl package."
+}
diff --git a/sys-power/pmtools/pmtools-20110323-r1.ebuild b/sys-power/pmtools/pmtools-20110323-r1.ebuild
new file mode 100644
index 000000000000..4b1e0a63d4fd
--- /dev/null
+++ b/sys-power/pmtools/pmtools-20110323-r1.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils flag-o-matic toolchain-funcs
+
+DESCRIPTION="Collection of tools for ACPI and power management"
+HOMEPAGE="https://github.com/anyc/pmtools/"
+SRC_URI="https://github.com/anyc/pmtools/tarball/${PV} -> ${P}.tar.gz"
+LICENSE="GPL-2"
+
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc"
+DEPEND=""
+RDEPEND="${DEPEND}
+ dev-lang/perl
+ >=sys-power/iasl-20090521"
+
+S="${WORKDIR}/pmtools"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-20100123-acpixtract-pmtools.patch
+ epatch "${FILESDIR}"/${PN}-20100123-madt.patch
+ epatch "${FILESDIR}"/${PN}-20071116-64bit.patch
+ epatch "${FILESDIR}"/${PN}-20101124-cflags-ldflags.patch
+
+ # update version info
+ sed -i -e "s|20060324|20110323|" acpixtract/acpixtract.c
+
+ strip-unsupported-flags
+}
+
+src_compile() {
+ # respect user's LDFLAGS
+ emake CC="$(tc-getCC)" LDFLAGS="${LDFLAGS}" || die "emake failed"
+}
+
+src_install() {
+ dosbin acpidump/acpidump
+ newbin acpixtract/acpixtract acpixtract-pmtools
+ dobin madt/madt
+
+ dodoc README
+ docinto madt
+ dodoc madt/README
+ use doc && dodoc madt/APIC*
+}
+
+pkg_postinst() {
+ ewarn "Please note that acpixtract is now named acpixtract-pmtools to avoid"
+ ewarn "conflicts with the new tool of the same name from the iasl package."
+}
diff --git a/sys-power/pmtools/pmtools-20110323.ebuild b/sys-power/pmtools/pmtools-20110323.ebuild
new file mode 100644
index 000000000000..9527a52a2f37
--- /dev/null
+++ b/sys-power/pmtools/pmtools-20110323.ebuild
@@ -0,0 +1,58 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=2
+
+inherit eutils flag-o-matic toolchain-funcs
+
+DESCRIPTION="ACPI disassembler tools, including acpidump"
+HOMEPAGE="http://ftp.kernel.org/pub/linux/kernel/people/lenb/acpi/"
+SRC_URI="http://ftp.kernel.org/pub/linux/kernel/people/lenb/acpi/utils/${P}.tar.gz"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc"
+DEPEND=""
+RDEPEND="${DEPEND}
+ dev-lang/perl
+ >=sys-power/iasl-20090521"
+
+S="${WORKDIR}/pmtools"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-20100123-acpixtract-pmtools.patch
+ epatch "${FILESDIR}"/${PN}-20100123-madt.patch
+ epatch "${FILESDIR}"/${PN}-20071116-64bit.patch
+ epatch "${FILESDIR}"/${PN}-20101124-cflags-ldflags.patch
+
+ # update version info
+ sed -i -e "s|20060324|20110323|" acpixtract/acpixtract.c
+
+ strip-unsupported-flags
+}
+
+src_compile() {
+ # respect user's LDFLAGS
+ emake CC="$(tc-getCC)" LDFLAGS="${LDFLAGS}" || die "emake failed"
+}
+
+src_install() {
+ # acpidump access the ACPI data via /dev/mem or EFI firmware in /sys
+ dosbin acpidump/acpidump
+ # the other tools only process data
+ newbin acpixtract/acpixtract acpixtract-pmtools
+ dobin madt/madt
+ dosbin turbostat/turbostat
+ doman turbostat/turbostat.8
+
+ dodoc README
+ docinto madt
+ dodoc madt/README
+ use doc && dodoc madt/APIC*
+}
+
+pkg_postinst() {
+ ewarn "Please note that acpixtract is now named acpixtract-pmtools to avoid"
+ ewarn "conflicts with the new tool of the same name from the iasl package."
+}
diff --git a/sys-power/powerman/Manifest b/sys-power/powerman/Manifest
new file mode 100644
index 000000000000..30e808a93c83
--- /dev/null
+++ b/sys-power/powerman/Manifest
@@ -0,0 +1 @@
+DIST powerman-2.3.9.tar.gz 654883 SHA256 d669767b037e38ee339c01b5b02fe586027489addcd59c45d9d5061d6ca0365f SHA512 0c1817369ef358f617139792a203c4480128bae22ea484ad23e16f8091372e91bca33988cd27bd8c5e1f0fcb3321e68efa3a29ae3b477c2bf6d90c990a1940fc WHIRLPOOL 36d5e7b85e50cca59dcdffe72e1abcd61769b8c58a55cdfb1b306a2661acac5dda8bb39aa361504e0e48c585a7ad21033af27e9e6fe2d14c96b8e1caa79125d0
diff --git a/sys-power/powerman/files/powerman b/sys-power/powerman/files/powerman
new file mode 100644
index 000000000000..02bb133dac4c
--- /dev/null
+++ b/sys-power/powerman/files/powerman
@@ -0,0 +1,24 @@
+#!/sbin/runscript
+
+depend() {
+ need net
+}
+
+start() {
+ ebegin "Starting powermand"
+
+ checkpath -q -d -m 0755 /var/run/powerman
+
+ start-stop-daemon --start \
+ --pidfile /var/run/powerman/powermand.pid \
+ --exec /usr/sbin/powermand
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping powermand"
+ start-stop-daemon --stop \
+ --pidfile /var/run/powerman/powermand.pid \
+ --exec /usr/sbin/powermand
+ eend $?
+}
diff --git a/sys-power/powerman/metadata.xml b/sys-power/powerman/metadata.xml
new file mode 100644
index 000000000000..04d640ee055a
--- /dev/null
+++ b/sys-power/powerman/metadata.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>maintainer-needed@gentoo.org</email>
+ </maintainer>
+ <longdescription lang="en">Powerman provides power management in a data center or compute cluster
+ environment. It performs operations such as power on, power off, and
+ power cycle via remote power controller (RPC) devices.</longdescription>
+ <use>
+ <flag name="httppower">Add support for HTTP based power controllers</flag>
+ <flag name="snmppower">Add support for SNMP based power controllers</flag>
+ <flag name="h8power">Add support for h8 based power controllers</flag>
+ <flag name="genders">Add support for selecting power control targets using genders (-g option)</flag>
+ </use>
+ <upstream>
+ <remote-id type="google-code">powerman</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-power/powerman/powerman-2.3.9.ebuild b/sys-power/powerman/powerman-2.3.9.ebuild
new file mode 100644
index 000000000000..604ecf9d6788
--- /dev/null
+++ b/sys-power/powerman/powerman-2.3.9.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+DESCRIPTION="RPC/PDU control and monitoring service for data center or compute cluster power management"
+HOMEPAGE="http://code.google.com/p/powerman/"
+SRC_URI="http://powerman.googlecode.com/files/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+httppower -snmppower -h8power +genders"
+
+DEPEND="sys-devel/bison
+ httppower? ( net-misc/curl )
+ snmppower? ( net-analyzer/net-snmp )
+ !app-accessibility/speech-tools"
+RDEPEND=">=sys-libs/freeipmi-0.2.3"
+
+src_configure() {
+ # Powerman stores the pidfile under $localstatedir/run.
+ # It's set to /var/lib in the release, but in gentoo pidfiles live under /var/run.
+ econf \
+ --localstatedir=/var \
+ $(use_with httppower) \
+ $(use_with snmppower) \
+ $(use_with h8power) \
+ $(use_with genders)
+}
+
+src_install() {
+ emake DESTDIR="${D}" -j1 install
+ rm -rf "${D}"/{etc/init.d/${PN},var/run}
+ doinitd "${FILESDIR}"/${PN}
+ dodoc AUTHORS ChangeLog DISCLAIMER NEWS TODO
+}
diff --git a/sys-power/powermgmt-base/Manifest b/sys-power/powermgmt-base/Manifest
new file mode 100644
index 000000000000..c834546176b5
--- /dev/null
+++ b/sys-power/powermgmt-base/Manifest
@@ -0,0 +1 @@
+DIST powermgmt-base_1.31.tar.gz 10015 SHA256 cfa68cbb381f9eeef2c4e4f50abd864e951aaa58f6ca647d8b60360cd1d22024 SHA512 deae8b227e079a73fdd3f9a6be83bdc76400d457c17d3a0881ace1fddc8785ee401beddbafad93dbf3a09b5effe5ca7c998eae69a0740a083a9e8a65c2f0af40 WHIRLPOOL f9aecd8396454462213cffb2e08c4569a2a5b9d5a513de44b473a2ebcd755cc1c4713ae51bd75ebc7ff80c069e0b28f639e981de0ab2b92eab01a3e466b57bc2
diff --git a/sys-power/powermgmt-base/metadata.xml b/sys-power/powermgmt-base/metadata.xml
new file mode 100644
index 000000000000..bc3ce8796602
--- /dev/null
+++ b/sys-power/powermgmt-base/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer><email>maintainer-needed@gentoo.org</email></maintainer>
+ <use>
+ <flag name="pm-utils">Adds support for on_ac_power through <pkg>sys-power/pm-utils</pkg></flag>
+ </use>
+</pkgmetadata>
diff --git a/sys-power/powermgmt-base/powermgmt-base-1.31.ebuild b/sys-power/powermgmt-base/powermgmt-base-1.31.ebuild
new file mode 100644
index 000000000000..495a5c70e7bf
--- /dev/null
+++ b/sys-power/powermgmt-base/powermgmt-base-1.31.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit toolchain-funcs
+
+DESCRIPTION="Script to test whether computer is running on AC power"
+HOMEPAGE="http://packages.debian.org/testing/utils/powermgmt-base"
+SRC_URI="mirror://debian/pool/main/p/${PN}/${PN}_${PV}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 arm ia64 ppc ppc64 x86"
+IUSE="+pm-utils"
+
+RDEPEND="!pm-utils? ( virtual/awk )
+ sys-apps/grep
+ virtual/modutils
+ pm-utils? ( >=sys-power/pm-utils-1.4.1 )"
+
+S=${WORKDIR}/${PN}
+
+src_prepare() {
+ sed -i \
+ -e 's:$(CC) $(CFLAGS):$(CC) $(LDFLAGS) $(CFLAGS):' \
+ src/Makefile || die
+}
+
+src_compile() {
+ tc-export CC
+ emake CFLAGS="${CFLAGS} -Wall -Wstrict-prototypes -DLINUX"
+}
+
+src_install() {
+ dodir /sbin
+ emake DESTDIR="${D}" install
+
+ doman man/{acpi,apm}_available.1
+
+ if ! use pm-utils; then
+ doman man/on_ac_power.1
+ else
+ rm -f "${D}"/sbin/on_ac_power
+ fi
+
+ newdoc debian/powermgmt-base.README.Debian README
+ dodoc debian/changelog
+}
diff --git a/sys-power/powernowd/Manifest b/sys-power/powernowd/Manifest
new file mode 100644
index 000000000000..8e1e58717436
--- /dev/null
+++ b/sys-power/powernowd/Manifest
@@ -0,0 +1 @@
+DIST powernowd-1.00.tar.gz 19651 SHA256 af7381d2def69aaf7a07e883bebc37141d1b5ca1bb959bfd4bf7015767b6c46d SHA512 b4285de6b330927568ac44789ae4fda0cb431fc5f15abc5d275c03b5bfaec8627f453abbe78561971cce1eba895f73ed6f382be8a034fc2cf5d1a55010d30cf3 WHIRLPOOL 038597f30b63adaa1a28cb10cb0e9c9dc2fdceca0f6392a1b14314aecb4271eb32de4dba0cbbe40d9acea5d5feb8a62fb70c4d596dc26d76fcfbc0c3fec089f5
diff --git a/sys-power/powernowd/files/powernowd-1.00-buf.patch b/sys-power/powernowd/files/powernowd-1.00-buf.patch
new file mode 100644
index 000000000000..56f048296ec7
--- /dev/null
+++ b/sys-power/powernowd/files/powernowd-1.00-buf.patch
@@ -0,0 +1,11 @@
+--- a/powernowd.c
++++ b/powernowd.c
+@@ -107,7 +107,7 @@ typedef struct cpuinfo {
+ cpuinfo_t **all_cpus;
+
+ /* idea stolen from procps */
+-static char buf[1024];
++static char buf[2048];
+
+ enum function {
+ SINE,
diff --git a/sys-power/powernowd/files/powernowd.confd b/sys-power/powernowd/files/powernowd.confd
new file mode 100644
index 000000000000..e374a59777bc
--- /dev/null
+++ b/sys-power/powernowd/files/powernowd.confd
@@ -0,0 +1,24 @@
+#PowerNow Daemon v0.97, (c) 2003-2005 John Clemens
+#Daemon to control the speed and voltage of cpus.
+#
+#This is a simple client to the CPUFreq driver, and uses
+#linux kernel v2.5 sysfs interface. You need a supported
+#cpu, and a kernel that supports sysfs to run this daemon.
+#
+#Available Options:
+# -h Print this help message
+# -d Don't detach from terminal (default is to
+# detach and run in the background)
+# -v Increase output verbosity, can be used more than once.
+# -q Quiet mode, only emergency output.
+# -n Include 'nice'd processes in calculations
+# -m # Modes of operation, can be 0, 1, 2, or 3:
+# 0 = SINE, 1 = AGGRESSIVE (default),
+# 2 = PASSIVE, 3 = LEAPS
+# -s # Frequency step in kHz (default = 100000)
+# -p # Polling frequency in msecs (default = 1000)
+# -c # Specify number of threads per power-managed core
+# -u # CPU usage upper limit percentage [0 .. 100, default 80]
+# -l # CPU usage lower limit percentage [0 .. 100, default 20]
+
+POWERNOWD_OPTS=""
diff --git a/sys-power/powernowd/files/powernowd.initd b/sys-power/powernowd/files/powernowd.initd
new file mode 100644
index 000000000000..8792a8c5bda9
--- /dev/null
+++ b/sys-power/powernowd/files/powernowd.initd
@@ -0,0 +1,21 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+depend() {
+ need localmount
+ use logger
+}
+
+start() {
+ ebegin "Starting powernowd"
+ start-stop-daemon --start --exec /usr/sbin/powernowd -- ${POWERNOWD_OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping powernowd"
+ start-stop-daemon --stop --exec /usr/sbin/powernowd
+ eend $?
+}
diff --git a/sys-power/powernowd/files/powernowd.service b/sys-power/powernowd/files/powernowd.service
new file mode 100644
index 000000000000..326e6fd28581
--- /dev/null
+++ b/sys-power/powernowd/files/powernowd.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=PowerNow! Daemon
+
+[Service]
+ExecStart=/usr/sbin/powernowd -d -q
+
+[Install]
+WantedBy=multi-user.target
diff --git a/sys-power/powernowd/metadata.xml b/sys-power/powernowd/metadata.xml
new file mode 100644
index 000000000000..e4832978b544
--- /dev/null
+++ b/sys-power/powernowd/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>jer@gentoo.org</email>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">clemej/powernowd</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-power/powernowd/powernowd-1.00-r3.ebuild b/sys-power/powernowd/powernowd-1.00-r3.ebuild
new file mode 100644
index 000000000000..23d091914b60
--- /dev/null
+++ b/sys-power/powernowd/powernowd-1.00-r3.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils linux-info systemd toolchain-funcs
+
+DESCRIPTION="Daemon to control the speed and voltage of CPUs"
+HOMEPAGE="http://www.deater.net/john/powernowd.html https://github.com/clemej/powernowd"
+SRC_URI="http://www.deater.net/john/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc ppc64 x86"
+
+pkg_setup() {
+ CONFIG_CHECK="~CPU_FREQ"
+ WARNING_CPU_FREQ="Powernowd needs CPU_FREQ turned on!"
+ linux-info_pkg_setup
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-buf.patch
+ rm -f Makefile
+ tc-export CC
+}
+
+src_compile() {
+ emake powernowd
+}
+
+src_install() {
+ dosbin powernowd
+ dodoc README
+
+ newconfd "${FILESDIR}"/powernowd.confd powernowd
+ newinitd "${FILESDIR}"/powernowd.initd powernowd
+ systemd_dounit "${FILESDIR}"/${PN}.service
+}
diff --git a/sys-power/powertop/Manifest b/sys-power/powertop/Manifest
new file mode 100644
index 000000000000..611bb61d0b25
--- /dev/null
+++ b/sys-power/powertop/Manifest
@@ -0,0 +1,4 @@
+DIST powertop-1.13.tar.gz 104675 SHA256 2bc866089496877dd26d2d316ad5763ab8ecb5e28aefba44bc5d355dcdc58d98 SHA512 0c22a903da64798d987492336d57260372e03eab067ad94cf30b7640e9ee05e759a2fe9fa48fbdc35404cd2782b6b29d705e11e68452653b08f7f9df1a52be44 WHIRLPOOL 5ba44b84f49609f67c32563f75e20f6576c21a93fcb1ca99ebfe064475397602aa0f0fb9575e05b5a0290983791e7cf6ebae0139b39158b962e4b51027a6f5aa
+DIST powertop-2.5.tar.gz 635979 SHA256 8b2c08a555d79e1c428863470c41cb023971d74ba4801d80a05e35adeec23c0b SHA512 696629fb6f5d0164da3ec2b259780dc635abc661de859e5e908debd3872c9a82024c0cc2dd8210c4cd1cf5586bf4238e31c3af29266f6a8ed8d90b1d876f04d8 WHIRLPOOL 5940b15ea4c5f09809e9a8febc11b1abe680df04469d75889c3a0cc0935a8c9d578d1f7c4ecaf2507cda74d574696a61b3bef21c6e30e9c768c09abf03436bcf
+DIST powertop-2.6.tar.gz 3024009 SHA256 3024c2b13c8f32cdac0b0ea9359eb5668dc9bd11776cf063481daa878533d1ee SHA512 7c44b9c49f74d0f415d0332b60629940e05cf1c9170a9a7b98427da630c25c0cc9c8ece49e059ec8c665847ff03fa8a341e0cf8f7ca792d889f2c52a39ddbb62 WHIRLPOOL eaa6e05d2fdb3050eb3a37f39fb5d760a8d3d91461b8c6f0ae825138080a0dd8a532e490a71246d62d2e340e3820b402d761a1331a6e7b6bc23db116c98cf0d9
+DIST powertop-2.7.tar.gz 654329 SHA256 8d4b1490e2baad4467c0ded3c423db4472dcbf7b2dd8f8f2a928f54047c678ca SHA512 7a69bee4dd5330d9d5d6da9c47615337cdde27eb1eeb3ffc75297df1a61b5ced9f2ee94684680154e71c0c46fac72e5485cadf7a43e943d8087b1d7b4f33f59d WHIRLPOOL b2323b3222fa45ff1874cca9f2a3121aebd54d4dd9c89a31f7299fac15e30013ae3103f79759e86368efdba528eb3a2f166359cbe15d97022166abc16e6fddad
diff --git a/sys-power/powertop/files/csstoh b/sys-power/powertop/files/csstoh
new file mode 100644
index 000000000000..51d1ec1372b0
--- /dev/null
+++ b/sys-power/powertop/files/csstoh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+in=$1
+out=$2
+
+(
+cat <<EOF
+#ifndef __INCLUDE_GUARD_CCS_H
+#define __INCLUDE_GUARD_CCS_H
+
+const char css[] =
+EOF
+sed -e 's:^:\t":' -e 's:$:\\n":' "${in}"
+cat <<EOF
+;
+#endif
+EOF
+) > "${out}"
diff --git a/sys-power/powertop/files/powertop-1.98-build-cc.patch b/sys-power/powertop/files/powertop-1.98-build-cc.patch
new file mode 100644
index 000000000000..70beb81db3ba
--- /dev/null
+++ b/sys-power/powertop/files/powertop-1.98-build-cc.patch
@@ -0,0 +1,28 @@
+From e2a8efc2d349880833215ccbe9ac6cb80cdfe5d0 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Tue, 23 Aug 2011 18:03:38 -0400
+Subject: [PATCH] allow control over the build compiler
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ Makefile | 3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index f637bfe..75e6e63 100644
+--- a/Makefile
++++ b/Makefile
+@@ -80,8 +80,9 @@ install: powertop
+ @(cd po/ && env LOCALESDIR=$(LOCALESDIR) DESTDIR=$(DESTDIR) $(MAKE) $@)
+
+
++BUILD_CC ?= gcc
+ csstoh: csstoh.c
+- gcc -o csstoh csstoh.c
++ $(BUILD_CC) -o csstoh csstoh.c
+
+ css.h: csstoh powertop.css
+ ./csstoh powertop.css css.h
+--
+1.7.6
+
diff --git a/sys-power/powertop/files/powertop-1.98-build-libnl-3.patch b/sys-power/powertop/files/powertop-1.98-build-libnl-3.patch
new file mode 100644
index 000000000000..bbe2b1c85737
--- /dev/null
+++ b/sys-power/powertop/files/powertop-1.98-build-libnl-3.patch
@@ -0,0 +1,27 @@
+From 21dcbd03507632c987e8c68b3efcf7b4a5d51147 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Wed, 18 Apr 2012 21:11:22 -0400
+Subject: [PATCH] use right libnl pkg-config name
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ Makefile | 3 +--
+ 1 files changed, 1 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 94ed2be..8a90b85 100644
+--- a/Makefile
++++ b/Makefile
+@@ -39,8 +39,7 @@ endif
+
+ ifeq ($(NL3FOUND),Y)
+ CPPFLAGS += -DCONFIG_LIBNL20
+-LIBS += -lnl-genl
+-NLLIBNAME = libnl-3.0
++NLLIBNAME = libnl-genl-3.0
+ endif
+
+ ifeq ($(NLLIBNAME),)
+--
+1.7.8.5
+
diff --git a/sys-power/powertop/files/powertop-1.98-build.patch b/sys-power/powertop/files/powertop-1.98-build.patch
new file mode 100644
index 000000000000..8f130fdacebc
--- /dev/null
+++ b/sys-power/powertop/files/powertop-1.98-build.patch
@@ -0,0 +1,80 @@
+From cafa47147fdc503103cda1e67e736ab95051e44a Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Tue, 23 Aug 2011 18:01:36 -0400
+Subject: [PATCH] use right flag names
+
+CFLAGS for the C compiler, CXXFLAGS for the C++ compiler, and
+CPPFLAGS for preprocessor flags.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ Makefile | 20 ++++++++++++--------
+ 1 files changed, 12 insertions(+), 8 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index b0b6cb7..bf9b79a 100644
+--- a/Makefile
++++ b/Makefile
+@@ -2,9 +2,13 @@ all: powertop po/powertop.pot
+
+ VERSION := 1.98
+
+-CFLAGS += -Wall -O2 -g -fno-omit-frame-pointer -fstack-protector -Wshadow -Wformat -D_FORTIFY_SOURCE=2
+-CPPFLAGS += -Wall -O2 -g -fno-omit-frame-pointer
+-CXXFLAGS += -Wall -O2 -g -fno-omit-frame-pointer -fstack-protector -Wshadow -Wformat -D_FORTIFY_SOURCE=2
++WFLAGS = -Wall -Wshadow -Wformat
++COMMON_FLAGS = -O2 -g -fno-omit-frame-pointer -fstack-protector
++CFLAGS ?= $(COMMON_FLAGS)
++CFLAGS += $(WFLAGS)
++CXXFLAGS ?= $(COMMON_FLAGS)
++CXXFLAGS += $(WFLAGS)
++CPPFLAGS += -D_FORTIFY_SOURCE=2
+ PKG_CONFIG ?= pkg-config
+
+ OBJS := lib.o main.o display.o html.o devlist.o
+@@ -31,13 +35,13 @@ NLLIBNAME = libnl-1
+ endif
+
+ ifeq ($(NL2FOUND),Y)
+-CFLAGS += -DCONFIG_LIBNL20
++CPPFLAGS += -DCONFIG_LIBNL20
+ LIBS += -lnl-genl
+ NLLIBNAME = libnl-2.0
+ endif
+
+ ifeq ($(NL3FOUND),Y)
+-CFLAGS += -DCONFIG_LIBNL20
++CPPFLAGS += -DCONFIG_LIBNL20
+ LIBS += -lnl-genl
+ NLLIBNAME = libnl-3.0
+ endif
+@@ -47,7 +51,7 @@ $(error Cannot find development files for any supported version of libnl)
+ endif
+
+ LIBS += $(shell $(PKG_CONFIG) --libs $(NLLIBNAME))
+-CFLAGS += $(shell $(PKG_CONFIG) --cflags $(NLLIBNAME))
++CPPFLAGS += $(shell $(PKG_CONFIG) --cflags $(NLLIBNAME))
+
+
+
+@@ -70,7 +74,7 @@ clean:
+ rm -f *.o *~ powertop DEADJOE core.* */*.o */*~ csstoh css.h
+
+ powertop: $(OBJS) $(HEADERS)
+- $(CXX) $(OBJS) $(LIBS) -o powertop
++ $(CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o powertop
+ @(cd po/ && $(MAKE))
+
+ install: powertop
+@@ -90,7 +94,7 @@ css.h: csstoh powertop.css
+ %.o: %.cpp lib.h css.h Makefile
+ @echo " CC $<"
+ @[ -x /usr/bin/cppcheck ] && /usr/bin/cppcheck -q $< || :
+- @$(CC) $(CFLAGS) -c -o $@ $<
++ @$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
+
+
+ uptrans:
+--
+1.7.8.5
+
diff --git a/sys-power/powertop/files/powertop-1.98-gcc-4.7.patch b/sys-power/powertop/files/powertop-1.98-gcc-4.7.patch
new file mode 100644
index 000000000000..78d2d70e5ebb
--- /dev/null
+++ b/sys-power/powertop/files/powertop-1.98-gcc-4.7.patch
@@ -0,0 +1,151 @@
+From b86877fb2f24563d74cd3faf7eceffcc8fa59299 Mon Sep 17 00:00:00 2001
+From: Han Shen <shenhan@chromium.org>
+Date: Thu, 19 Apr 2012 12:14:08 -0400
+Subject: [PATCH] include unistd.h when necessary
+
+Older versions of gcc (pre-4.7) would implicitly include unistd.h in some
+of its internal headers. With newer versions though, that is no longer
+the case, so building powertop breaks with files that use things from the
+unistd.h header but don't include it explicitly.
+
+Signed-off-by: Han Shen <shenhan@chromium.org>
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ cpu/intel_cpus.cpp | 1 +
+ devices/alsa.cpp | 2 +-
+ devices/device.cpp | 1 +
+ devices/i915-gpu.cpp | 2 +-
+ devices/network.cpp | 1 +
+ devices/rfkill.cpp | 2 +-
+ devices/thinkpad-fan.cpp | 1 +
+ devices/thinkpad-light.cpp | 1 +
+ html.cpp | 1 +
+ main.cpp | 1 +
+ 10 files changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/cpu/intel_cpus.cpp b/cpu/intel_cpus.cpp
+index f42f3b4..bbbd460 100644
+--- a/cpu/intel_cpus.cpp
++++ b/cpu/intel_cpus.cpp
+@@ -34,6 +34,7 @@
+ #include <sys/time.h>
+ #include <string.h>
+ #include <errno.h>
++#include <unistd.h>
+
+ #include "../lib.h"
+ #include "../parameters/parameters.h"
+diff --git a/devices/alsa.cpp b/devices/alsa.cpp
+index b0bcd3f..5100c36 100644
+--- a/devices/alsa.cpp
++++ b/devices/alsa.cpp
+@@ -39,7 +39,7 @@ using namespace std;
+ #include "../devlist.h"
+
+ #include <string.h>
+-
++#include <unistd.h>
+
+ alsa::alsa(char *_name, char *path): device()
+ {
+diff --git a/devices/device.cpp b/devices/device.cpp
+index c38b96c..9ce4509 100644
+--- a/devices/device.cpp
++++ b/devices/device.cpp
+@@ -29,6 +29,7 @@
+ #include <stdio.h>
+ #include <limits.h>
+ #include <stdlib.h>
++#include <unistd.h>
+
+ using namespace std;
+
+diff --git a/devices/i915-gpu.cpp b/devices/i915-gpu.cpp
+index a9dc899..ca2dad1 100644
+--- a/devices/i915-gpu.cpp
++++ b/devices/i915-gpu.cpp
+@@ -28,7 +28,7 @@
+ #include <stdio.h>
+ #include <sys/types.h>
+ #include <dirent.h>
+-
++#include <unistd.h>
+
+ using namespace std;
+
+diff --git a/devices/network.cpp b/devices/network.cpp
+index 5f3ddf2..72c766d 100644
+--- a/devices/network.cpp
++++ b/devices/network.cpp
+@@ -33,6 +33,7 @@
+ #include <dirent.h>
+ #include <libgen.h>
+ #include <stdlib.h>
++#include <unistd.h>
+
+ #include <linux/ethtool.h>
+
+diff --git a/devices/rfkill.cpp b/devices/rfkill.cpp
+index 5bf40c4..33a8fcd 100644
+--- a/devices/rfkill.cpp
++++ b/devices/rfkill.cpp
+@@ -29,7 +29,7 @@
+ #include <sys/types.h>
+ #include <dirent.h>
+ #include <libgen.h>
+-
++#include <unistd.h>
+
+ using namespace std;
+
+diff --git a/devices/thinkpad-fan.cpp b/devices/thinkpad-fan.cpp
+index 4ac3d11..8750c6e 100644
+--- a/devices/thinkpad-fan.cpp
++++ b/devices/thinkpad-fan.cpp
+@@ -29,6 +29,7 @@
+ #include <sys/types.h>
+ #include <dirent.h>
+ #include <math.h>
++#include <unistd.h>
+
+ #include "../lib.h"
+
+diff --git a/devices/thinkpad-light.cpp b/devices/thinkpad-light.cpp
+index ba4c553..7e91637 100644
+--- a/devices/thinkpad-light.cpp
++++ b/devices/thinkpad-light.cpp
+@@ -29,6 +29,7 @@
+ #include <sys/types.h>
+ #include <dirent.h>
+ #include <math.h>
++#include <unistd.h>
+
+ #include "../lib.h"
+
+diff --git a/html.cpp b/html.cpp
+index 0a4db2e..8260ed5 100644
+--- a/html.cpp
++++ b/html.cpp
+@@ -29,6 +29,7 @@
+ #include <utility>
+ #include <iostream>
+ #include <fstream>
++#include <unistd.h>
+
+ #include "css.h"
+ #include "lib.h"
+diff --git a/main.cpp b/main.cpp
+index 45a126e..0bbb4aa 100644
+--- a/main.cpp
++++ b/main.cpp
+@@ -33,6 +33,7 @@
+ #include <time.h>
+ #include <sys/stat.h>
+ #include <getopt.h>
++#include <unistd.h>
+
+ #include "cpu/cpu.h"
+ #include "process/process.h"
+--
+1.7.8.5
+
diff --git a/sys-power/powertop/files/powertop-2.2-cpu-add-new-Intel-cpuid.patch b/sys-power/powertop/files/powertop-2.2-cpu-add-new-Intel-cpuid.patch
new file mode 100644
index 000000000000..04f17a3b5e82
--- /dev/null
+++ b/sys-power/powertop/files/powertop-2.2-cpu-add-new-Intel-cpuid.patch
@@ -0,0 +1,41 @@
+From 6626761dec9b3d1e3053d214913f329ed27c468c Mon Sep 17 00:00:00 2001
+From: Kristen Carlson Accardi <kristen@linux.intel.com>
+Date: Tue, 19 Mar 2013 16:45:47 -0700
+Subject: [PATCH] cpu: add new Intel cpuid
+
+update cpu to support next generation Intel core processor
+---
+ src/cpu/cpu.cpp | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp
+index 1eb340c..afe6a8c 100644
+--- a/src/cpu/cpu.cpp
++++ b/src/cpu/cpu.cpp
+@@ -78,6 +78,7 @@ static class abstract_cpu * new_package(int package, int cpu, char * vendor, int
+ case 0x3A: /* IVB */
+ case 0x3C:
+ case 0x3D: /* IVB Xeon */
++ case 0x45: /* Next Gen Intel Core Processor */
+ has_c2c7_res = 1;
+ ret = new class nhm_package;
+ break;
+@@ -116,6 +117,7 @@ static class abstract_cpu * new_core(int core, int cpu, char * vendor, int famil
+ case 0x3A: /* IVB */
+ case 0x3C:
+ case 0x3D: /* IVB Xeon */
++ case 0x45: /* Next Gen Intel Core Processor */
+ ret = new class nhm_core;
+ }
+ }
+@@ -159,6 +161,7 @@ static class abstract_cpu * new_cpu(int number, char * vendor, int family, int m
+ case 0x3A: /* IVB */
+ case 0x3C:
+ case 0x3D: /* IVB Xeon */
++ case 0x45: /* Next Gen Intel Core Processor */
+ ret = new class nhm_cpu;
+ }
+ }
+--
+1.8.1.2
+
diff --git a/sys-power/powertop/files/powertop-2.2-use-package_version.patch b/sys-power/powertop/files/powertop-2.2-use-package_version.patch
new file mode 100644
index 000000000000..f4ec6c3ed040
--- /dev/null
+++ b/sys-power/powertop/files/powertop-2.2-use-package_version.patch
@@ -0,0 +1,26 @@
+It was missed to update POWERTOP_VERSION macro so that the
+new v2.2 release still shows v2.1 string on the header of
+ncurses window. Convert to use PACKAGE_VERSION macro which
+set by autotools to the AC_INIT version so that it cannot
+be missed anymore.
+
+Signed-off-by: Namhyung Kim <namhyung at gmail.com>
+---
+ src/lib.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/lib.h b/src/lib.h
+index 8cf4632..209421a 100644
+--- a/src/lib.h
++++ b/src/lib.h
+@@ -35,8 +35,8 @@
+
+ #define _(STRING) gettext(STRING)
+
+-#define POWERTOP_VERSION "v2.1"
+-#define POWERTOP_SHORT_VERSION "2.1"
++#define POWERTOP_VERSION "v"PACKAGE_VERSION
++#define POWERTOP_SHORT_VERSION PACKAGE_VERSION
+
+
+ extern int get_max_cpu(void);
diff --git a/sys-power/powertop/files/powertop-2.4-tinfo.patch b/sys-power/powertop/files/powertop-2.4-tinfo.patch
new file mode 100644
index 000000000000..b965d8e06a59
--- /dev/null
+++ b/sys-power/powertop/files/powertop-2.4-tinfo.patch
@@ -0,0 +1,11 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -46,7 +46,7 @@
+ AC_FUNC_STRTOD
+ AC_CHECK_FUNCS([fdatasync getpagesize gettimeofday memmove memset mkdir munmap pow realpath regcomp select setlocale socket sqrt strcasecmp strchr strdup strerror strncasecmp strstr strtoul strtoull])
+
+-AC_SEARCH_LIBS([delwin], [ncursesw ncurses], [], AC_MSG_ERROR([ncurses is required but was not found]), [])
++PKG_CHECK_MODULES(ncurses, ncurses, [LIBS="$LIBS $ncurses_LIBS"], AC_MSG_ERROR([ncurses is required but was not found]))
+
+ has_libpci=0
+ PKG_CHECK_MODULES([PCIUTILS], [libpci],[has_libpci=1],[
diff --git a/sys-power/powertop/files/powertop-2.7-baytrail-msr.patch b/sys-power/powertop/files/powertop-2.7-baytrail-msr.patch
new file mode 100644
index 000000000000..9c4c17b3f8c1
--- /dev/null
+++ b/sys-power/powertop/files/powertop-2.7-baytrail-msr.patch
@@ -0,0 +1,33 @@
+From 037906c55374cbf045f197b43c22314617dbfc21 Mon Sep 17 00:00:00 2001
+From: Daniel Leung <daniel.leung@linux.intel.com>
+Date: Wed, 25 Feb 2015 16:36:45 -0800
+Subject: [PATCH] Baytrail does not have core C7 MSR to read
+
+So do not acquire core C7 from MSR, or else it fails
+and stops the program.
+
+Reported-by: Eoff, Ullysses A <ullysses.a.eoff@intel.com>
+Signed-off-by: Daniel Leung <daniel.leung@linux.intel.com>
+---
+ src/cpu/intel_cpus.cpp | 5 -----
+ 1 file changed, 5 deletions(-)
+
+diff --git a/src/cpu/intel_cpus.cpp b/src/cpu/intel_cpus.cpp
+index 04275e5..72ecd50 100644
+--- a/src/cpu/intel_cpus.cpp
++++ b/src/cpu/intel_cpus.cpp
+@@ -135,11 +135,6 @@ nhm_core::nhm_core(int model)
+ if (model == 0x37) {
+ has_c3_res = 0;
+ has_c1_res = 1;
+- this->byt_has_ahci();
+- if ((this->get_byt_ahci_support()) == 0)
+- has_c7_res = 1;/*BYT-T PC7 <- S0iX*/
+- else
+- has_c7_res = 0;
+ } else {
+ has_c3_res = 1;
+ has_c1_res = 0;
+--
+2.3.1
+
diff --git a/sys-power/powertop/files/powertop-2.7-braswell.patch b/sys-power/powertop/files/powertop-2.7-braswell.patch
new file mode 100644
index 000000000000..cabbed44ed03
--- /dev/null
+++ b/sys-power/powertop/files/powertop-2.7-braswell.patch
@@ -0,0 +1,81 @@
+From 1c60f2342b752149f3d6543c63fee11a167dc998 Mon Sep 17 00:00:00 2001
+From: "David E. Box" <david.e.box@linux.intel.com>
+Date: Thu, 2 Apr 2015 21:24:29 -0700
+Subject: [PATCH] Fix Powertop support for Intel Braswell SOC
+
+Correct Braswell MSR used to determine PC6 residency.
+
+Signed-off-by: David E. Box <david.e.box@linux.intel.com>
+---
+ src/cpu/intel_cpus.cpp | 21 +++++++++++++++++++--
+ src/cpu/intel_cpus.h | 1 +
+ 2 files changed, 20 insertions(+), 2 deletions(-)
+
+diff --git a/src/cpu/intel_cpus.cpp b/src/cpu/intel_cpus.cpp
+index d96cb49..1f3647a 100644
+--- a/src/cpu/intel_cpus.cpp
++++ b/src/cpu/intel_cpus.cpp
+@@ -289,6 +289,7 @@ nhm_package::nhm_package(int model)
+ has_c8c9c10_res = 0;
+ has_c2c6_res = 0;
+ has_c7_res = 0;
++ has_c6c_res = 0;
+
+ switch(model) {
+ case 0x2A: /* SNB */
+@@ -314,6 +315,9 @@ nhm_package::nhm_package(int model)
+ else
+ has_c7_res = 0;
+ }
++ /* BSW only exposes package C6 */
++ else if (model == 0x4C)
++ has_c6c_res = 1;
+ else
+ has_c3_res = 1;
+
+@@ -360,7 +364,15 @@ void nhm_package::measurement_start(void)
+
+ if (this->has_c3_res)
+ c3_before = get_msr(number, MSR_PKG_C3_RESIDENCY);
+- c6_before = get_msr(number, MSR_PKG_C6_RESIDENCY);
++
++ /*
++ * Hack for Braswell where C7 MSR is actually BSW C6
++ */
++ if (this->has_c6c_res)
++ c6_before = get_msr(number, MSR_PKG_C7_RESIDENCY);
++ else
++ c6_before = get_msr(number, MSR_PKG_C6_RESIDENCY);
++
+ if (this->has_c7_res)
+ c7_before = get_msr(number, MSR_PKG_C7_RESIDENCY);
+ if (this->has_c8c9c10_res) {
+@@ -401,7 +413,12 @@ void nhm_package::measurement_end(void)
+
+ if (this->has_c3_res)
+ c3_after = get_msr(number, MSR_PKG_C3_RESIDENCY);
+- c6_after = get_msr(number, MSR_PKG_C6_RESIDENCY);
++
++ if (this->has_c6c_res)
++ c6_after = get_msr(number, MSR_PKG_C7_RESIDENCY);
++ else
++ c6_after = get_msr(number, MSR_PKG_C6_RESIDENCY);
++
+ if (this->has_c7_res)
+ c7_after = get_msr(number, MSR_PKG_C7_RESIDENCY);
+ if (has_c8c9c10_res) {
+diff --git a/src/cpu/intel_cpus.h b/src/cpu/intel_cpus.h
+index 810a243..0331069 100644
+--- a/src/cpu/intel_cpus.h
++++ b/src/cpu/intel_cpus.h
+@@ -77,6 +77,7 @@ public:
+ int has_c7_res;
+ int has_c2c6_res;
+ int has_c3_res;
++ int has_c6c_res; /* BSW */
+ int has_c8c9c10_res;
+ nhm_package(int model);
+ virtual void measurement_start(void);
+--
+2.4.4
+
diff --git a/sys-power/powertop/files/powertop-2.7-broadwell.patch b/sys-power/powertop/files/powertop-2.7-broadwell.patch
new file mode 100644
index 000000000000..7a1ed6f1ff33
--- /dev/null
+++ b/sys-power/powertop/files/powertop-2.7-broadwell.patch
@@ -0,0 +1,28 @@
+From 60258e6149a420b45521201e02f39cf41839e081 Mon Sep 17 00:00:00 2001
+From: Alexandra Yates <alexandra.yates@linux.intel.com>
+Date: Wed, 22 Oct 2014 06:57:10 -0700
+Subject: [PATCH] Enable PowerTOP support for: BSW, BDW-H
+
+Added PowerTOP support for BSW and BDW-H platforms.
+
+Signed-off-by: Alexandra Yates <alexandra.yates@linux.intel.com>
+---
+ src/cpu/intel_cpus.cpp | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/cpu/intel_cpus.cpp b/src/cpu/intel_cpus.cpp
+index 167f1a7..d307aa1 100644
+--- a/src/cpu/intel_cpus.cpp
++++ b/src/cpu/intel_cpus.cpp
+@@ -59,6 +59,8 @@ static int intel_cpu_models[] = {
+ 0x3D, /* Intel Next Generation */
+ 0x3F, /* HSX */
+ 0x46, /* HSW */
++ 0x47, /* BDW-H */
++ 0x4C, /* BSW */
+ 0x4D, /* AVN */
+ 0x4F, /* BDX */
+ 0x56, /* BDX-DE */
+--
+2.4.4
+
diff --git a/sys-power/powertop/files/powertop-2.7-skylake-2.patch b/sys-power/powertop/files/powertop-2.7-skylake-2.patch
new file mode 100644
index 000000000000..be5f0a3789ee
--- /dev/null
+++ b/sys-power/powertop/files/powertop-2.7-skylake-2.patch
@@ -0,0 +1,37 @@
+From a7ddbd00f84253da38acc393e38f1c4db4263864 Mon Sep 17 00:00:00 2001
+From: Alexandra Yates <alexandra.yates@linux.intel.com>
+Date: Thu, 16 Apr 2015 14:36:29 -0700
+Subject: [PATCH] Add C7- C10 support for Intel SKY
+
+Add C7 to C10 support for Intel SKY for CPU idle.
+
+Signed-off-by: Alexandra Yates <alexandra.yates@linux.intel.com>
+---
+ src/cpu/intel_cpus.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/cpu/intel_cpus.cpp b/src/cpu/intel_cpus.cpp
+index 72ecd50..d96cb49 100644
+--- a/src/cpu/intel_cpus.cpp
++++ b/src/cpu/intel_cpus.cpp
+@@ -63,7 +63,7 @@ static int intel_cpu_models[] = {
+ 0x4C, /* BSW */
+ 0x4D, /* AVN */
+ 0x4F, /* BDX */
+- 0x4E, /* Intel Next Generation */
++ 0x4E, /* SKY */
+ 0x56, /* BDX-DE */
+ 0 /* last entry must be zero */
+ };
+@@ -318,7 +318,7 @@ nhm_package::nhm_package(int model)
+ has_c3_res = 1;
+
+ /* Haswell-ULT has C8/9/10*/
+- if (model == 0x45 || model ==0x3D)
++ if (model == 0x45 || model == 0x3D || model == 0x4E)
+ has_c8c9c10_res = 1;
+ }
+
+--
+2.4.4
+
diff --git a/sys-power/powertop/files/powertop-2.7-skylake.patch b/sys-power/powertop/files/powertop-2.7-skylake.patch
new file mode 100644
index 000000000000..50781dd2468d
--- /dev/null
+++ b/sys-power/powertop/files/powertop-2.7-skylake.patch
@@ -0,0 +1,58 @@
+From 761e87f1ccd3b5364b5518d7e29f4b7b8a6b8490 Mon Sep 17 00:00:00 2001
+From: Alexandra Yates <alexandra.yates@linux.intel.com>
+Date: Wed, 21 Jan 2015 16:55:59 -0800
+Subject: [PATCH] Adding support to SKY platforms.
+
+Adding Intel SKY platform support to PowerTOP
+
+Signed-off-by: Alexandra Yates <alexandra.yates@linux.intel.com>
+---
+ src/cpu/intel_cpus.cpp | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/src/cpu/intel_cpus.cpp b/src/cpu/intel_cpus.cpp
+index d307aa1..04275e5 100644
+--- a/src/cpu/intel_cpus.cpp
++++ b/src/cpu/intel_cpus.cpp
+@@ -51,18 +51,19 @@ static int intel_cpu_models[] = {
+ 0x2C, /* Westmere */
+ 0x2A, /* SNB */
+ 0x2D, /* SNB Xeon */
++ 0x37, /* BYT-M */
+ 0x3A, /* IVB */
+ 0x3C,
++ 0x3D, /* Broadwell */
+ 0x3E, /* IVB Xeon */
+- 0x37, /* BYT-M */
+- 0x45, /* HSW-ULT */
+- 0x3D, /* Intel Next Generation */
+ 0x3F, /* HSX */
++ 0x45, /* HSW-ULT */
+ 0x46, /* HSW */
+ 0x47, /* BDW-H */
+ 0x4C, /* BSW */
+ 0x4D, /* AVN */
+ 0x4F, /* BDX */
++ 0x4E, /* Intel Next Generation */
+ 0x56, /* BDX-DE */
+ 0 /* last entry must be zero */
+ };
+@@ -125,6 +126,7 @@ nhm_core::nhm_core(int model)
+ case 0x3C:
+ case 0x3E: /* IVB Xeon */
+ case 0x45: /* HSW-ULT */
++ case 0x4E: /* SKY */
+ case 0x3D: /* Intel Next Generation */
+ has_c7_res = 1;
+ }
+@@ -300,6 +302,7 @@ nhm_package::nhm_package(int model)
+ case 0x3C:
+ case 0x3E: /* IVB Xeon */
+ case 0x45: /* HSW-ULT */
++ case 0x4E: /* SKY */
+ case 0x3D: /* Intel Next Generation */
+ has_c2c6_res=1;
+ has_c7_res = 1;
+--
+2.4.4
+
diff --git a/sys-power/powertop/metadata.xml b/sys-power/powertop/metadata.xml
new file mode 100644
index 000000000000..9cca7a80e628
--- /dev/null
+++ b/sys-power/powertop/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>zerochaos@gentoo.org</email>
+ <name>Rick Farina</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/sys-power/powertop/powertop-1.13.ebuild b/sys-power/powertop/powertop-1.13.ebuild
new file mode 100644
index 000000000000..359fb8324fa6
--- /dev/null
+++ b/sys-power/powertop/powertop-1.13.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=3
+
+inherit toolchain-funcs eutils
+
+DESCRIPTION="tool that helps you find what software is using the most power"
+HOMEPAGE="http://www.lesswatts.org/projects/powertop/"
+SRC_URI="http://www.lesswatts.org/projects/powertop/download/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 arm ppc sparc x86 ~amd64-linux ~x86-linux"
+IUSE="unicode"
+
+DEPEND="sys-libs/ncurses[unicode?]
+ sys-devel/gettext"
+RDEPEND="sys-libs/ncurses[unicode?]
+ virtual/libintl
+ sys-apps/pciutils"
+
+src_prepare() {
+ sed -i '/${CFLAGS}/s:$: ${LDFLAGS}:' Makefile
+ use unicode || sed -i 's:-lncursesw:-lncurses:' Makefile
+}
+
+src_configure() {
+ tc-export CC
+}
+
+src_install() {
+ emake install DESTDIR="${ED}" || die
+ dodoc Changelog README
+ gunzip "${ED}"/usr/share/man/man1/powertop.1.gz
+}
+
+pkg_postinst() {
+ echo
+ einfo "For PowerTOP to work best, use a Linux kernel with the"
+ einfo "tickless idle (NO_HZ) feature enabled (version 2.6.21 or later)"
+ echo
+}
diff --git a/sys-power/powertop/powertop-2.5.ebuild b/sys-power/powertop/powertop-2.5.ebuild
new file mode 100644
index 000000000000..238ac0253060
--- /dev/null
+++ b/sys-power/powertop/powertop-2.5.ebuild
@@ -0,0 +1,110 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils linux-info autotools
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://github.com/fenrus75/powertop.git"
+ inherit git-2 autotools
+ SRC_URI=""
+else
+ SRC_URI="https://01.org/powertop/sites/default/files/downloads/${P}.tar.gz"
+ KEYWORDS="amd64 arm ppc sparc x86 ~amd64-linux ~x86-linux"
+fi
+
+DESCRIPTION="tool that helps you find what software is using the most power"
+HOMEPAGE="https://01.org/powertop/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="unicode X"
+
+COMMON_DEPEND="
+ dev-libs/libnl:3
+ sys-apps/pciutils
+ sys-libs/ncurses[unicode?]
+"
+
+DEPEND="${COMMON_DEPEND}
+ virtual/pkgconfig
+ sys-devel/gettext
+"
+RDEPEND="
+ ${COMMON_DEPEND}
+ X? ( x11-apps/xset )
+ virtual/libintl
+"
+
+DOCS=( TODO README )
+
+pkg_setup() {
+ CONFIG_CHECK="
+ ~X86_MSR
+ ~DEBUG_FS
+ ~PERF_EVENTS
+ ~TRACEPOINTS
+ ~NO_HZ
+ ~HIGH_RES_TIMERS
+ ~HPET_TIMER
+ ~CPU_FREQ_STAT
+ ~CPU_FREQ_GOV_ONDEMAND
+ ~FTRACE
+ ~BLK_DEV_IO_TRACE
+ ~TIMER_STATS
+ ~TRACING
+ "
+ ERROR_KERNEL_X86_MSR="X86_MSR is not enabled in the kernel, you almost certainly need it"
+ ERROR_KERNEL_DEBUG_FS="DEBUG_FS is not enabled in the kernel, you almost certainly need it"
+ ERROR_KERNEL_PERF_EVENTS="PERF_EVENTS should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_TRACEPOINTS="TRACEPOINTS should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_NO_HZ="NO_HZ should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_HIGH_RES_TIMERS="HIGH_RES_TIMERS should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_HPET_TIMER="HPET_TIMER should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_CPU_FREQ_STAT="CPU_FREQ_STAT should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_CPU_FREQ_GOV_ONDEMAND="CPU_FREQ_GOV_ONDEMAND should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_FTRACE="FTRACE needs to be turned on to enable BLK_DEV_IO_TRACE"
+ ERROR_KERNEL_BLK_DEV_IO_TRACE="BLK_DEV_IO_TRACE needs to be turned on to enable TIMER_STATS, TRACING and EVENT_POWER_TRACING_DEPRECATED"
+ ERROR_KERNEL_TIMER_STATS="TIMER_STATS should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_TRACING="TRACING should be enabled in the kernel for full powertop function"
+ linux-info_pkg_setup
+ if linux_config_exists; then
+ if kernel_is -lt 3 7 0; then
+ if linux_chkconfig_present SND_HDA_INTEL; then
+ CONFIG_CHECK="~SND_HDA_POWER_SAVE"
+ ERROR_KERNEL_SND_HDA_POWER_SAVE="SND_HDA_POWER_SAVE should be enabled in the kernel for full powertop function"
+ check_extra_config
+ fi
+ fi
+ if kernel_is -lt 3 9 0; then
+ CONFIG_CHECK="~EVENT_POWER_TRACING_DEPRECATED"
+ ERROR_KERNEL_EVENT_POWER_TRACING_DEPRECATED="EVENT_POWER_TRACING_DEPRECATED should be enabled in the kernel for full powertop function"
+ check_extra_config
+ fi
+ if kernel_is -lt 3 19; then
+ CONFIG_CHECK="~PM_RUNTIME"
+ ERROR_KERNEL_PM_RUNTIME="PM_RUNTIME should be enabled in the kernel for full powertop function"
+ check_extra_config
+ else
+ CONFIG_CHECK="~PM"
+ ERROR_KERNEL_PM="PM should be enabled in the kernel for full powertop function"
+ check_extra_config
+ fi
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/powertop-2.4-tinfo.patch
+ eautoreconf
+}
+
+src_configure() {
+ export ac_cv_search_delwin=$(usex unicode -lncursesw -lncurses)
+ default
+}
+
+src_install() {
+ default
+ keepdir /var/cache/powertop
+}
diff --git a/sys-power/powertop/powertop-2.6.ebuild b/sys-power/powertop/powertop-2.6.ebuild
new file mode 100644
index 000000000000..482be30a139a
--- /dev/null
+++ b/sys-power/powertop/powertop-2.6.ebuild
@@ -0,0 +1,107 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils linux-info autotools
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://github.com/fenrus75/powertop.git"
+ inherit git-2 autotools
+ SRC_URI=""
+else
+ SRC_URI="https://01.org/sites/default/files/downloads/${PN}/${P}.tar.gz"
+ KEYWORDS="amd64 arm ppc sparc x86 ~amd64-linux ~x86-linux"
+fi
+
+DESCRIPTION="tool that helps you find what software is using the most power"
+HOMEPAGE="https://01.org/powertop/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="unicode X"
+
+COMMON_DEPEND="
+ dev-libs/libnl:3
+ sys-apps/pciutils
+ sys-libs/ncurses[unicode?]
+"
+
+DEPEND="${COMMON_DEPEND}
+ virtual/pkgconfig
+ sys-devel/gettext
+"
+RDEPEND="
+ ${COMMON_DEPEND}
+ X? ( x11-apps/xset )
+ virtual/libintl
+"
+
+DOCS=( TODO README )
+
+S="${WORKDIR}/${PN}"
+
+pkg_setup() {
+ CONFIG_CHECK="
+ ~X86_MSR
+ ~DEBUG_FS
+ ~PERF_EVENTS
+ ~TRACEPOINTS
+ ~NO_HZ
+ ~HIGH_RES_TIMERS
+ ~HPET_TIMER
+ ~CPU_FREQ_STAT
+ ~CPU_FREQ_GOV_ONDEMAND
+ ~FTRACE
+ ~BLK_DEV_IO_TRACE
+ ~TIMER_STATS
+ ~TRACING
+ "
+ ERROR_KERNEL_X86_MSR="X86_MSR is not enabled in the kernel, you almost certainly need it"
+ ERROR_KERNEL_DEBUG_FS="DEBUG_FS is not enabled in the kernel, you almost certainly need it"
+ ERROR_KERNEL_PERF_EVENTS="PERF_EVENTS should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_TRACEPOINTS="TRACEPOINTS should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_NO_HZ="NO_HZ should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_HIGH_RES_TIMERS="HIGH_RES_TIMERS should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_HPET_TIMER="HPET_TIMER should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_CPU_FREQ_STAT="CPU_FREQ_STAT should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_CPU_FREQ_GOV_ONDEMAND="CPU_FREQ_GOV_ONDEMAND should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_FTRACE="FTRACE needs to be turned on to enable BLK_DEV_IO_TRACE"
+ ERROR_KERNEL_BLK_DEV_IO_TRACE="BLK_DEV_IO_TRACE needs to be turned on to enable TIMER_STATS, TRACING and EVENT_POWER_TRACING_DEPRECATED"
+ ERROR_KERNEL_TIMER_STATS="TIMER_STATS should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_TRACING="TRACING should be enabled in the kernel for full powertop function"
+ linux-info_pkg_setup
+ if linux_config_exists; then
+ if kernel_is -lt 3 7 0; then
+ if linux_chkconfig_present SND_HDA_INTEL; then
+ CONFIG_CHECK="~SND_HDA_POWER_SAVE"
+ ERROR_KERNEL_SND_HDA_POWER_SAVE="SND_HDA_POWER_SAVE should be enabled in the kernel for full powertop function"
+ check_extra_config
+ fi
+ fi
+ if kernel_is -lt 3 9 0; then
+ CONFIG_CHECK="~EVENT_POWER_TRACING_DEPRECATED"
+ ERROR_KERNEL_EVENT_POWER_TRACING_DEPRECATED="EVENT_POWER_TRACING_DEPRECATED should be enabled in the kernel for full powertop function"
+ check_extra_config
+ fi
+ if kernel_is -lt 3 19; then
+ CONFIG_CHECK="~PM_RUNTIME"
+ ERROR_KERNEL_PM_RUNTIME="PM_RUNTIME should be enabled in the kernel for full powertop function"
+ check_extra_config
+ else
+ CONFIG_CHECK="~PM"
+ ERROR_KERNEL_PM="PM should be enabled in the kernel for full powertop function"
+ check_extra_config
+ fi
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/powertop-2.4-tinfo.patch
+ eautoreconf
+}
+
+src_configure() {
+ export ac_cv_search_delwin=$(usex unicode -lncursesw -lncurses)
+ default
+}
diff --git a/sys-power/powertop/powertop-2.7-r1.ebuild b/sys-power/powertop/powertop-2.7-r1.ebuild
new file mode 100644
index 000000000000..6171ac423cfa
--- /dev/null
+++ b/sys-power/powertop/powertop-2.7-r1.ebuild
@@ -0,0 +1,104 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils linux-info
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://github.com/fenrus75/powertop.git"
+ inherit git-2 autotools
+ SRC_URI=""
+else
+ SRC_URI="https://01.org/sites/default/files/downloads/${PN}/${P}.tar.gz"
+ KEYWORDS="~amd64 ~arm ~ppc ~sparc ~x86 ~amd64-linux ~x86-linux"
+fi
+
+DESCRIPTION="tool that helps you find what software is using the most power"
+HOMEPAGE="https://01.org/powertop/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="nls unicode X"
+
+COMMON_DEPEND="
+ dev-libs/libnl:3
+ sys-apps/pciutils
+ sys-libs/ncurses[unicode?]
+"
+
+DEPEND="${COMMON_DEPEND}
+ virtual/pkgconfig
+ sys-devel/gettext
+"
+RDEPEND="
+ ${COMMON_DEPEND}
+ X? ( x11-apps/xset )
+ virtual/libintl
+"
+
+DOCS=( TODO README )
+
+pkg_setup() {
+ CONFIG_CHECK="
+ ~X86_MSR
+ ~DEBUG_FS
+ ~PERF_EVENTS
+ ~TRACEPOINTS
+ ~NO_HZ
+ ~HIGH_RES_TIMERS
+ ~HPET_TIMER
+ ~CPU_FREQ_STAT
+ ~CPU_FREQ_GOV_ONDEMAND
+ ~FTRACE
+ ~BLK_DEV_IO_TRACE
+ ~TIMER_STATS
+ ~TRACING
+ "
+ ERROR_KERNEL_X86_MSR="X86_MSR is not enabled in the kernel, you almost certainly need it"
+ ERROR_KERNEL_DEBUG_FS="DEBUG_FS is not enabled in the kernel, you almost certainly need it"
+ ERROR_KERNEL_PERF_EVENTS="PERF_EVENTS should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_TRACEPOINTS="TRACEPOINTS should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_NO_HZ="NO_HZ should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_HIGH_RES_TIMERS="HIGH_RES_TIMERS should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_HPET_TIMER="HPET_TIMER should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_CPU_FREQ_STAT="CPU_FREQ_STAT should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_CPU_FREQ_GOV_ONDEMAND="CPU_FREQ_GOV_ONDEMAND should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_FTRACE="FTRACE needs to be turned on to enable BLK_DEV_IO_TRACE"
+ ERROR_KERNEL_BLK_DEV_IO_TRACE="BLK_DEV_IO_TRACE needs to be turned on to enable TIMER_STATS, TRACING and EVENT_POWER_TRACING_DEPRECATED"
+ ERROR_KERNEL_TIMER_STATS="TIMER_STATS should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_TRACING="TRACING should be enabled in the kernel for full powertop function"
+ linux-info_pkg_setup
+ if linux_config_exists; then
+ if kernel_is -lt 3 7 0; then
+ if linux_chkconfig_present SND_HDA_INTEL; then
+ CONFIG_CHECK="~SND_HDA_POWER_SAVE"
+ ERROR_KERNEL_SND_HDA_POWER_SAVE="SND_HDA_POWER_SAVE should be enabled in the kernel for full powertop function"
+ check_extra_config
+ fi
+ fi
+ if kernel_is -lt 3 9 0; then
+ CONFIG_CHECK="~EVENT_POWER_TRACING_DEPRECATED"
+ ERROR_KERNEL_EVENT_POWER_TRACING_DEPRECATED="EVENT_POWER_TRACING_DEPRECATED should be enabled in the kernel for full powertop function"
+ check_extra_config
+ fi
+ if kernel_is -lt 3 19; then
+ CONFIG_CHECK="~PM_RUNTIME"
+ ERROR_KERNEL_PM_RUNTIME="PM_RUNTIME should be enabled in the kernel for full powertop function"
+ check_extra_config
+ else
+ CONFIG_CHECK="~PM"
+ ERROR_KERNEL_PM="PM should be enabled in the kernel for full powertop function"
+ check_extra_config
+ fi
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-baytrail-msr.patch
+}
+
+src_configure() {
+ export ac_cv_search_delwin=$(usex unicode -lncursesw -lncurses)
+ econf $(use_enable nls)
+}
diff --git a/sys-power/powertop/powertop-2.7-r2.ebuild b/sys-power/powertop/powertop-2.7-r2.ebuild
new file mode 100644
index 000000000000..552caf0eaa1b
--- /dev/null
+++ b/sys-power/powertop/powertop-2.7-r2.ebuild
@@ -0,0 +1,108 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils linux-info
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://github.com/fenrus75/powertop.git"
+ inherit git-2 autotools
+ SRC_URI=""
+else
+ SRC_URI="https://01.org/sites/default/files/downloads/${PN}/${P}.tar.gz"
+ KEYWORDS="~amd64 ~arm ~ppc ~sparc ~x86 ~amd64-linux ~x86-linux"
+fi
+
+DESCRIPTION="tool that helps you find what software is using the most power"
+HOMEPAGE="https://01.org/powertop/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="nls unicode X"
+
+COMMON_DEPEND="
+ dev-libs/libnl:3
+ sys-apps/pciutils
+ sys-libs/ncurses[unicode?]
+"
+
+DEPEND="${COMMON_DEPEND}
+ virtual/pkgconfig
+ sys-devel/gettext
+"
+RDEPEND="
+ ${COMMON_DEPEND}
+ X? ( x11-apps/xset )
+ virtual/libintl
+"
+
+DOCS=( TODO README )
+
+pkg_setup() {
+ CONFIG_CHECK="
+ ~X86_MSR
+ ~DEBUG_FS
+ ~PERF_EVENTS
+ ~TRACEPOINTS
+ ~NO_HZ
+ ~HIGH_RES_TIMERS
+ ~HPET_TIMER
+ ~CPU_FREQ_STAT
+ ~CPU_FREQ_GOV_ONDEMAND
+ ~FTRACE
+ ~BLK_DEV_IO_TRACE
+ ~TIMER_STATS
+ ~TRACING
+ "
+ ERROR_KERNEL_X86_MSR="X86_MSR is not enabled in the kernel, you almost certainly need it"
+ ERROR_KERNEL_DEBUG_FS="DEBUG_FS is not enabled in the kernel, you almost certainly need it"
+ ERROR_KERNEL_PERF_EVENTS="PERF_EVENTS should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_TRACEPOINTS="TRACEPOINTS should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_NO_HZ="NO_HZ should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_HIGH_RES_TIMERS="HIGH_RES_TIMERS should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_HPET_TIMER="HPET_TIMER should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_CPU_FREQ_STAT="CPU_FREQ_STAT should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_CPU_FREQ_GOV_ONDEMAND="CPU_FREQ_GOV_ONDEMAND should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_FTRACE="FTRACE needs to be turned on to enable BLK_DEV_IO_TRACE"
+ ERROR_KERNEL_BLK_DEV_IO_TRACE="BLK_DEV_IO_TRACE needs to be turned on to enable TIMER_STATS, TRACING and EVENT_POWER_TRACING_DEPRECATED"
+ ERROR_KERNEL_TIMER_STATS="TIMER_STATS should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_TRACING="TRACING should be enabled in the kernel for full powertop function"
+ linux-info_pkg_setup
+ if linux_config_exists; then
+ if kernel_is -lt 3 7 0; then
+ if linux_chkconfig_present SND_HDA_INTEL; then
+ CONFIG_CHECK="~SND_HDA_POWER_SAVE"
+ ERROR_KERNEL_SND_HDA_POWER_SAVE="SND_HDA_POWER_SAVE should be enabled in the kernel for full powertop function"
+ check_extra_config
+ fi
+ fi
+ if kernel_is -lt 3 9 0; then
+ CONFIG_CHECK="~EVENT_POWER_TRACING_DEPRECATED"
+ ERROR_KERNEL_EVENT_POWER_TRACING_DEPRECATED="EVENT_POWER_TRACING_DEPRECATED should be enabled in the kernel for full powertop function"
+ check_extra_config
+ fi
+ if kernel_is -lt 3 19; then
+ CONFIG_CHECK="~PM_RUNTIME"
+ ERROR_KERNEL_PM_RUNTIME="PM_RUNTIME should be enabled in the kernel for full powertop function"
+ check_extra_config
+ else
+ CONFIG_CHECK="~PM"
+ ERROR_KERNEL_PM="PM should be enabled in the kernel for full powertop function"
+ check_extra_config
+ fi
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-baytrail-msr.patch
+ epatch "${FILESDIR}"/${P}-broadwell.patch
+ epatch "${FILESDIR}"/${P}-braswell.patch
+ epatch "${FILESDIR}"/${P}-skylake.patch
+ epatch "${FILESDIR}"/${P}-skylake-2.patch
+}
+
+src_configure() {
+ export ac_cv_search_delwin=$(usex unicode -lncursesw -lncurses)
+ econf $(use_enable nls)
+}
diff --git a/sys-power/powertop/powertop-2.7.ebuild b/sys-power/powertop/powertop-2.7.ebuild
new file mode 100644
index 000000000000..b3011ffb230d
--- /dev/null
+++ b/sys-power/powertop/powertop-2.7.ebuild
@@ -0,0 +1,104 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils linux-info autotools
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://github.com/fenrus75/powertop.git"
+ inherit git-2 autotools
+ SRC_URI=""
+else
+ SRC_URI="https://01.org/sites/default/files/downloads/${PN}/${P}.tar.gz"
+ KEYWORDS="~amd64 ~arm ~ppc ~sparc ~x86 ~amd64-linux ~x86-linux"
+fi
+
+DESCRIPTION="tool that helps you find what software is using the most power"
+HOMEPAGE="https://01.org/powertop/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="unicode X"
+
+COMMON_DEPEND="
+ dev-libs/libnl:3
+ sys-apps/pciutils
+ sys-libs/ncurses[unicode?]
+"
+
+DEPEND="${COMMON_DEPEND}
+ virtual/pkgconfig
+ sys-devel/gettext
+"
+RDEPEND="
+ ${COMMON_DEPEND}
+ X? ( x11-apps/xset )
+ virtual/libintl
+"
+
+DOCS=( TODO README )
+
+pkg_setup() {
+ CONFIG_CHECK="
+ ~X86_MSR
+ ~DEBUG_FS
+ ~PERF_EVENTS
+ ~TRACEPOINTS
+ ~NO_HZ
+ ~HIGH_RES_TIMERS
+ ~HPET_TIMER
+ ~CPU_FREQ_STAT
+ ~CPU_FREQ_GOV_ONDEMAND
+ ~FTRACE
+ ~BLK_DEV_IO_TRACE
+ ~TIMER_STATS
+ ~TRACING
+ "
+ ERROR_KERNEL_X86_MSR="X86_MSR is not enabled in the kernel, you almost certainly need it"
+ ERROR_KERNEL_DEBUG_FS="DEBUG_FS is not enabled in the kernel, you almost certainly need it"
+ ERROR_KERNEL_PERF_EVENTS="PERF_EVENTS should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_TRACEPOINTS="TRACEPOINTS should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_NO_HZ="NO_HZ should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_HIGH_RES_TIMERS="HIGH_RES_TIMERS should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_HPET_TIMER="HPET_TIMER should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_CPU_FREQ_STAT="CPU_FREQ_STAT should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_CPU_FREQ_GOV_ONDEMAND="CPU_FREQ_GOV_ONDEMAND should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_FTRACE="FTRACE needs to be turned on to enable BLK_DEV_IO_TRACE"
+ ERROR_KERNEL_BLK_DEV_IO_TRACE="BLK_DEV_IO_TRACE needs to be turned on to enable TIMER_STATS, TRACING and EVENT_POWER_TRACING_DEPRECATED"
+ ERROR_KERNEL_TIMER_STATS="TIMER_STATS should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_TRACING="TRACING should be enabled in the kernel for full powertop function"
+ linux-info_pkg_setup
+ if linux_config_exists; then
+ if kernel_is -lt 3 7 0; then
+ if linux_chkconfig_present SND_HDA_INTEL; then
+ CONFIG_CHECK="~SND_HDA_POWER_SAVE"
+ ERROR_KERNEL_SND_HDA_POWER_SAVE="SND_HDA_POWER_SAVE should be enabled in the kernel for full powertop function"
+ check_extra_config
+ fi
+ fi
+ if kernel_is -lt 3 9 0; then
+ CONFIG_CHECK="~EVENT_POWER_TRACING_DEPRECATED"
+ ERROR_KERNEL_EVENT_POWER_TRACING_DEPRECATED="EVENT_POWER_TRACING_DEPRECATED should be enabled in the kernel for full powertop function"
+ check_extra_config
+ fi
+ if kernel_is -lt 3 19; then
+ CONFIG_CHECK="~PM_RUNTIME"
+ ERROR_KERNEL_PM_RUNTIME="PM_RUNTIME should be enabled in the kernel for full powertop function"
+ check_extra_config
+ else
+ CONFIG_CHECK="~PM"
+ ERROR_KERNEL_PM="PM should be enabled in the kernel for full powertop function"
+ check_extra_config
+ fi
+ fi
+}
+
+src_prepare() {
+ eautoreconf
+}
+
+src_configure() {
+ export ac_cv_search_delwin=$(usex unicode -lncursesw -lncurses)
+ default
+}
diff --git a/sys-power/powertop/powertop-9999.ebuild b/sys-power/powertop/powertop-9999.ebuild
new file mode 100644
index 000000000000..b3011ffb230d
--- /dev/null
+++ b/sys-power/powertop/powertop-9999.ebuild
@@ -0,0 +1,104 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils linux-info autotools
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://github.com/fenrus75/powertop.git"
+ inherit git-2 autotools
+ SRC_URI=""
+else
+ SRC_URI="https://01.org/sites/default/files/downloads/${PN}/${P}.tar.gz"
+ KEYWORDS="~amd64 ~arm ~ppc ~sparc ~x86 ~amd64-linux ~x86-linux"
+fi
+
+DESCRIPTION="tool that helps you find what software is using the most power"
+HOMEPAGE="https://01.org/powertop/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="unicode X"
+
+COMMON_DEPEND="
+ dev-libs/libnl:3
+ sys-apps/pciutils
+ sys-libs/ncurses[unicode?]
+"
+
+DEPEND="${COMMON_DEPEND}
+ virtual/pkgconfig
+ sys-devel/gettext
+"
+RDEPEND="
+ ${COMMON_DEPEND}
+ X? ( x11-apps/xset )
+ virtual/libintl
+"
+
+DOCS=( TODO README )
+
+pkg_setup() {
+ CONFIG_CHECK="
+ ~X86_MSR
+ ~DEBUG_FS
+ ~PERF_EVENTS
+ ~TRACEPOINTS
+ ~NO_HZ
+ ~HIGH_RES_TIMERS
+ ~HPET_TIMER
+ ~CPU_FREQ_STAT
+ ~CPU_FREQ_GOV_ONDEMAND
+ ~FTRACE
+ ~BLK_DEV_IO_TRACE
+ ~TIMER_STATS
+ ~TRACING
+ "
+ ERROR_KERNEL_X86_MSR="X86_MSR is not enabled in the kernel, you almost certainly need it"
+ ERROR_KERNEL_DEBUG_FS="DEBUG_FS is not enabled in the kernel, you almost certainly need it"
+ ERROR_KERNEL_PERF_EVENTS="PERF_EVENTS should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_TRACEPOINTS="TRACEPOINTS should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_NO_HZ="NO_HZ should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_HIGH_RES_TIMERS="HIGH_RES_TIMERS should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_HPET_TIMER="HPET_TIMER should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_CPU_FREQ_STAT="CPU_FREQ_STAT should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_CPU_FREQ_GOV_ONDEMAND="CPU_FREQ_GOV_ONDEMAND should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_FTRACE="FTRACE needs to be turned on to enable BLK_DEV_IO_TRACE"
+ ERROR_KERNEL_BLK_DEV_IO_TRACE="BLK_DEV_IO_TRACE needs to be turned on to enable TIMER_STATS, TRACING and EVENT_POWER_TRACING_DEPRECATED"
+ ERROR_KERNEL_TIMER_STATS="TIMER_STATS should be enabled in the kernel for full powertop function"
+ ERROR_KERNEL_TRACING="TRACING should be enabled in the kernel for full powertop function"
+ linux-info_pkg_setup
+ if linux_config_exists; then
+ if kernel_is -lt 3 7 0; then
+ if linux_chkconfig_present SND_HDA_INTEL; then
+ CONFIG_CHECK="~SND_HDA_POWER_SAVE"
+ ERROR_KERNEL_SND_HDA_POWER_SAVE="SND_HDA_POWER_SAVE should be enabled in the kernel for full powertop function"
+ check_extra_config
+ fi
+ fi
+ if kernel_is -lt 3 9 0; then
+ CONFIG_CHECK="~EVENT_POWER_TRACING_DEPRECATED"
+ ERROR_KERNEL_EVENT_POWER_TRACING_DEPRECATED="EVENT_POWER_TRACING_DEPRECATED should be enabled in the kernel for full powertop function"
+ check_extra_config
+ fi
+ if kernel_is -lt 3 19; then
+ CONFIG_CHECK="~PM_RUNTIME"
+ ERROR_KERNEL_PM_RUNTIME="PM_RUNTIME should be enabled in the kernel for full powertop function"
+ check_extra_config
+ else
+ CONFIG_CHECK="~PM"
+ ERROR_KERNEL_PM="PM should be enabled in the kernel for full powertop function"
+ check_extra_config
+ fi
+ fi
+}
+
+src_prepare() {
+ eautoreconf
+}
+
+src_configure() {
+ export ac_cv_search_delwin=$(usex unicode -lncursesw -lncurses)
+ default
+}
diff --git a/sys-power/sispmctl/Manifest b/sys-power/sispmctl/Manifest
new file mode 100644
index 000000000000..ac65ee868ccf
--- /dev/null
+++ b/sys-power/sispmctl/Manifest
@@ -0,0 +1,2 @@
+DIST sispmctl-2.7.tar.gz 192388 SHA256 d24d34fc7e14992ac822cef3c5567b04a077cfc96252b0a6fb238c8a272c16f4 SHA512 c04ce9a4b1a9e220c22f92355891a3b2872022dc27fd2489772393fb9edd521bd963070beb480a992c65adaab649ed107f17d1898c883817f1e3fc4ac110649e WHIRLPOOL ac05e3ea079e8a55818cfe78f4e6e155d27cc43aaccd3f3585f9d09a214dca3c6a1797b58abadfb5914a205461338a6e9e9285ee89af98288796d8c60e2320aa
+DIST sispmctl-3.1.tar.gz 251896 SHA256 e9a99cc81ef0a93f3484e5093efd14d93cc967221fcd22c151f0bea32eb91da7 SHA512 2942c8f1c9e4d259667d384b9dca72569fac8c3c775e68f88599eb6f339b63d92c8226a406f998830af24ea9144ed75291bcc652293a870123925fe235c31d03 WHIRLPOOL 8f7ad31eb917456dacd0e09feb94fa04e8e1cdceb25626a0ce36004d117750146d50abd458913d0770cf2b3ef133cda8162a64809592015ae5080957d12aeced
diff --git a/sys-power/sispmctl/metadata.xml b/sys-power/sispmctl/metadata.xml
new file mode 100644
index 000000000000..2df432631061
--- /dev/null
+++ b/sys-power/sispmctl/metadata.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>wschlich@gentoo.org</email>
+ <name>Wolfram Schlich</name>
+ <description>Primary maintainer</description>
+ </maintainer>
+ <use>
+ <flag name="gemplug">Install gemplug (management script)</flag>
+ </use>
+ <longdescription>
+sispmctl is an application enabling the use of the GEMBIRD
+SilverShield PowerManager (SiS-PM) device under Linux.
+The SiS-PM is an intelligent advanced surge protector with
+4 of 6 sockets being manageable from the PC via USB.
+</longdescription>
+ <upstream>
+ <remote-id type="sourceforge">sispmctl</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-power/sispmctl/sispmctl-2.7.ebuild b/sys-power/sispmctl/sispmctl-2.7.ebuild
new file mode 100644
index 000000000000..6b0942794013
--- /dev/null
+++ b/sys-power/sispmctl/sispmctl-2.7.ebuild
@@ -0,0 +1,26 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=2
+
+DESCRIPTION="GEMBIRD SiS-PM control utility"
+HOMEPAGE="http://sispmctl.sourceforge.net/"
+SRC_URI="mirror://sourceforge/sispmctl/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE=""
+
+RDEPEND="virtual/libusb:0"
+DEPEND="${RDEPEND}"
+
+src_configure() {
+ econf --enable-webless
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+ dodoc README ChangeLog NEWS
+}
diff --git a/sys-power/sispmctl/sispmctl-3.1.ebuild b/sys-power/sispmctl/sispmctl-3.1.ebuild
new file mode 100644
index 000000000000..3852b340e50a
--- /dev/null
+++ b/sys-power/sispmctl/sispmctl-3.1.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit bash-completion-r1 eutils
+
+DESCRIPTION="GEMBIRD SiS-PM control utility"
+HOMEPAGE="http://sispmctl.sourceforge.net/"
+SRC_URI="mirror://sourceforge/sispmctl/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="gemplug"
+
+RDEPEND="virtual/libusb:0
+ gemplug? ( sys-process/at )"
+DEPEND="${RDEPEND}"
+
+src_configure() {
+ econf --enable-webless
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+ dodoc README ChangeLog NEWS
+
+ ## gemplug
+ if use gemplug; then
+ sed -i "s|/usr/local/bin/sispmctl|${ROOT:-/}usr/bin/sispmctl|g" extras/gemplug/gemplug
+ dobin extras/gemplug/gemplug
+ doman extras/gemplug/gemplug.1
+
+ insinto /lib/udev/rules.d
+ doins extras/gemplug/74-sispmctl.rules
+
+ newbashcomp extras/gemplug/gemplug-completion.sh gemplug
+
+ einfo "To be able to use the locking mechanism of gemplug(1),"
+ einfo "add the users who are designated to run gemplug to the"
+ einfo "group 'uucp' which has write permissions to /var/lock."
+ fi
+}
diff --git a/sys-power/suspend/Manifest b/sys-power/suspend/Manifest
new file mode 100644
index 000000000000..3c4fdccd2310
--- /dev/null
+++ b/sys-power/suspend/Manifest
@@ -0,0 +1,3 @@
+DIST suspend-1.0_p20120915.tar.xz 111080 SHA256 4fa7551ec5ce3ed5d7412ad14e01f5fbac3a541db9d94ad6adf20b87d9c32eca SHA512 bb714b4a7c0f5749c4b711a5c38ca5d8cb5078176a75387957123f75cfe8348adc3aa4e96335eb65c14ad1dd2f99fd6dbca3b415525dd39b3c547f9b13b775be WHIRLPOOL 6f5ea4a17572bc1e30d70258a0439b40a29ea67f0251cecec81bdd3dee92e7801645c37dbb868b0f498c093193bd574f361dc015810965c09f53d75cfb391e7f
+DIST suspend-1.0_p20150622.patch.xz 6052 SHA256 bc05a8896b89520b70a5c3b1a9903d94b75bc82756f6edbdddf53c6d1120af14 SHA512 8ca6d51e96b4d405133b4ee3bc246d79e4270052fe10202f94a85075dad314a33bb586ebbcf3a04c2ab93c74eb5f8d4e1dfca1c88fc56467d347eda147e4d3aa WHIRLPOOL 09f07d6ece378715c0bb1017ade8b97277f818e00accec0f2b5b4573664aafb68dc3713fe1780d4b38707120c0b62c35ec6d6818aec0f59ad3c14247b4cf1a7b
+DIST suspend-utils-1.0.tar.bz2 408451 SHA256 0206ba6332860b6da57acc79cc0f8604150ef0835ff9633fd42d59d181a6c85d SHA512 481f7ab6e6d43b963cf7abf4d16a9911035dbce13d96e11eeadd50bbd2b9671c597eab0e3060536dcb0d6d848e30ac0e7ff534275fc2d66d2064b75066a4adb8 WHIRLPOOL 4321dcaeda4b5b7d822a1cade82b88094d8706d0daaa06b72d3c053a4bac14ed85b55a4681e0a52f116a63e3b8f4255c57e55fb43961f77149faf1b8aa918d58
diff --git a/sys-power/suspend/files/suspend-1.0-automake-1.13.patch b/sys-power/suspend/files/suspend-1.0-automake-1.13.patch
new file mode 100644
index 000000000000..8aacea520b32
--- /dev/null
+++ b/sys-power/suspend/files/suspend-1.0-automake-1.13.patch
@@ -0,0 +1,11 @@
+--- suspend-utils-1.0/configure.ac
++++ suspend-utils-1.0/configure.ac
+@@ -9,7 +9,7 @@
+ AC_PREREQ([2.59])
+ AC_INIT([suspend-utils], [1.0])
+ AM_INIT_AUTOMAKE([${PACKAGE_NAME}], [${PACKAGE_VERSION}])
+-AM_CONFIG_HEADER([config.h])
++AC_CONFIG_HEADERS([config.h])
+ AC_CONFIG_SRCDIR([suspend.c])
+
+ AC_CANONICAL_HOST
diff --git a/sys-power/suspend/files/suspend-1.0-bzip2.patch b/sys-power/suspend/files/suspend-1.0-bzip2.patch
new file mode 100644
index 000000000000..abe5afab819b
--- /dev/null
+++ b/sys-power/suspend/files/suspend-1.0-bzip2.patch
@@ -0,0 +1,37 @@
+--- a/Makefile.am 2011-03-07 00:24:15.000000000 +0100
++++ b/Makefile.am 2012-05-22 10:52:49.023010001 +0200
+@@ -171,7 +171,8 @@
+ fbsplash_funcs.c \
+ fbsplash-test.c
+ fbsplash_test_LDADD=\
+- $(FBSPLASH_LIBS)
++ $(FBSPLASH_LIBS) \
++ $(BZ2_LIBS)
+
+ whitelist.c: whitelist.csv
+ $(PERL) wlcsv2c.pl whitelist.csv whitelist.c
+--- a/configure.ac 2011-03-07 00:24:15.000000000 +0100
++++ b/configure.ac 2012-05-22 10:52:37.918148832 +0200
+@@ -74,6 +74,22 @@
+ ,
+ [enable_fbsplash="no"]
+ )
++BZ2_LIBS=
++AS_IF(
++ [test "x${fbsplash}" = "xyes"],
++ [
++ PKG_CHECK_MODULES(
++ [FREETYPE2],
++ [freetype2],
++ ,
++ [AC_MSG_ERROR([freetype was not found.])]
++ )
++ AC_CHECK_LIB([bz2], [BZ2_bzDecompress],
++ [BZ2_LIBS="${BZ2_LIBS} -lbz2"],
++ [AC_MSG_ERROR(['libbz2' library was not found.])]
++ )
++ ]
++)
+ AC_ARG_WITH(
+ [devdir],
+ [AC_HELP_STRING([--with-devdir=DIR], [use if --enable-create-device, put devices in this directory, default /dev])],
diff --git a/sys-power/suspend/files/suspend-1.0-errno.patch b/sys-power/suspend/files/suspend-1.0-errno.patch
new file mode 100644
index 000000000000..ea8a378a5abe
--- /dev/null
+++ b/sys-power/suspend/files/suspend-1.0-errno.patch
@@ -0,0 +1,10 @@
+--- swsusp.h.orig 2010-10-03 13:40:47.000000000 -0600
++++ swsusp.h 2010-10-04 14:38:38.000000000 -0600
+@@ -11,6 +11,7 @@
+
+ #include <stdint.h>
+ #include <linux/fs.h>
++#include <errno.h>
+
+ #include "suspend_ioctls.h"
+ #include "encrypt.h"
diff --git a/sys-power/suspend/metadata.xml b/sys-power/suspend/metadata.xml
new file mode 100644
index 000000000000..98dfbe79ca36
--- /dev/null
+++ b/sys-power/suspend/metadata.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>xmw@gentoo.org</email>
+ <name>Michael Weber</name>
+ </maintainer>
+ <maintainer>
+ <email>bircoph@gentoo.org</email>
+ <name>Andrew Savchenko</name>
+ </maintainer>
+ <use>
+ <flag name="fbsplash">Add support for framebuffer splash</flag>
+ <flag name="crypt">Allows suspend and resume from encrypted disk</flag>
+ </use>
+ <upstream>
+ <remote-id type="sourceforge">suspend</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-power/suspend/suspend-1.0.ebuild b/sys-power/suspend/suspend-1.0.ebuild
new file mode 100644
index 000000000000..22af7802da22
--- /dev/null
+++ b/sys-power/suspend/suspend-1.0.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit autotools eutils
+
+DESCRIPTION="Userspace Software Suspend and S2Ram"
+HOMEPAGE="http://suspend.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P/-/-utils-}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="fbsplash crypt threads"
+
+X86_RDEPEND="dev-libs/libx86"
+X86_DEPEND="
+ ${X86_RDEPEND}
+ >=sys-apps/pciutils-2.2.4"
+RDEPEND=">=dev-libs/lzo-2[static-libs]
+ fbsplash? ( >=media-gfx/splashutils-1.5.2 )
+ crypt? ( <dev-libs/libgcrypt-1.6.0:0[static-libs]
+ dev-libs/libgpg-error[static-libs] )
+ x86? ( ${X86_RDEPEND} )
+ amd64? ( ${X86_RDEPEND} )"
+DEPEND="${RDEPEND}
+ x86? ( ${X86_DEPEND} )
+ amd64? ( ${X86_DEPEND} )
+ virtual/pkgconfig"
+
+S="${WORKDIR}/${P/-/-utils-}"
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/${P}-errno.patch \
+ "${FILESDIR}"/${P}-bzip2.patch \
+ "${FILESDIR}"/${P}-automake-1.13.patch
+ eautoreconf
+}
+
+src_configure() {
+ econf \
+ --docdir="/usr/share/doc/${PF}" \
+ --enable-compress \
+ $(use_enable crypt encrypt) \
+ $(use_enable fbsplash) \
+ $(use_enable threads)
+}
+
+src_install() {
+ dodir etc
+ emake DESTDIR="${D}" install
+}
+
+pkg_postinst() {
+ elog "In order to make this package work with genkernel see:"
+ elog "http://bugs.gentoo.org/show_bug.cgi?id=156445"
+}
diff --git a/sys-power/suspend/suspend-1.0_p20150622.ebuild b/sys-power/suspend/suspend-1.0_p20150622.ebuild
new file mode 100644
index 000000000000..330716ff6b8d
--- /dev/null
+++ b/sys-power/suspend/suspend-1.0_p20150622.ebuild
@@ -0,0 +1,58 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit autotools eutils
+
+BASE_PV="1.0_p20120915"
+
+DESCRIPTION="Userspace Software Suspend and S2Ram"
+HOMEPAGE="http://suspend.sourceforge.net/"
+SRC_URI="http://dev.gentoo.org/~bircoph/distfiles/${PN}-${BASE_PV}.tar.xz
+ http://dev.gentoo.org/~bircoph/patches/${P}.patch.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="crypt fbsplash +lzo threads"
+
+RDEPEND="
+ dev-libs/libx86
+ crypt? (
+ >=dev-libs/libgcrypt-1.6.3:0[static-libs]
+ dev-libs/libgpg-error[static-libs] )
+ fbsplash? ( >=media-gfx/splashutils-1.5.2 )
+ lzo? ( >=dev-libs/lzo-2[static-libs] ) "
+DEPEND="${RDEPEND}
+ >=dev-lang/perl-5.10
+ >=sys-apps/pciutils-2.2.4
+ virtual/pkgconfig"
+
+S="${WORKDIR}/${PN}"
+
+src_prepare() {
+ epatch "${WORKDIR}/${P}.patch"
+ eautoreconf
+}
+
+src_configure() {
+ econf \
+ --docdir="/usr/share/doc/${PF}" \
+ $(use_enable crypt encrypt) \
+ $(use_enable fbsplash) \
+ $(use_enable lzo compress) \
+ $(use_enable threads)
+}
+
+src_install() {
+ dodir etc
+ emake DESTDIR="${D}" install
+ rm "${D}/usr/share/doc/${PF}"/COPYING* || die
+}
+
+pkg_postinst() {
+ elog "In order to make this package work with genkernel see:"
+ elog "http://bugs.gentoo.org/show_bug.cgi?id=156445"
+}
diff --git a/sys-power/thermald/Manifest b/sys-power/thermald/Manifest
new file mode 100644
index 000000000000..0b96ef6ccb99
--- /dev/null
+++ b/sys-power/thermald/Manifest
@@ -0,0 +1,2 @@
+DIST thermald-1.3.tar.gz 77733 SHA256 c85c2e3400456302ee754a747e17a99871e3ddf3f0f82273de9ff6935d893af2 SHA512 6f2087de52d0f8614de1002701efba748fef114ac2161c0fe3325d545da91386f89eab4c1e218aff4acc099351acd6db747cc401444db7283961df450d94a4e4 WHIRLPOOL bc2b772bea1a6fa46e2dbbbd91217f534c9a3be420de850ab06163ae9a36cd60e6d95862167e7e242110916946f265e9214738ea4c972c6c6b99c8e0be9aad3b
+DIST thermald-1.4.2.tar.gz 89080 SHA256 4be5e1105f8b24af17d19357eda97b6edd3d74284c3ee762060d487158997f8b SHA512 373620679df7db242770ae2b5c6e2b9015cfb480539889c43b8f20f52faa139ea307985c8f7369daf14c41d987f7c5af4baecc9dd460ef63556ac982eb4bcd47 WHIRLPOOL 6abde17fc60f30dda58935663084e53cbc26ba8b59bc058b3b6f8fc03af538d6f2e363d578fcbbfb38a02bf3cda0856abcb361fb63fd2e5ce0bc2c63a4d42484
diff --git a/sys-power/thermald/files/thermald b/sys-power/thermald/files/thermald
new file mode 100644
index 000000000000..73643a27a686
--- /dev/null
+++ b/sys-power/thermald/files/thermald
@@ -0,0 +1,19 @@
+#!/sbin/runscript
+
+depend() {
+ need dbus
+ after logger
+}
+
+start() {
+ ebegin "Starting thermald"
+
+ start-stop-daemon --start --quiet --name thermald --exec /usr/sbin/thermald -- --dbus-enable
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping thermald"
+ /usr/bin/dbus-send --system --dest=org.freedesktop.thermald /org/freedesktop/thermald org.freedesktop.thermald.Terminate
+ eend $?
+}
diff --git a/sys-power/thermald/files/thermald-1.4.2-terminate-r1.patch b/sys-power/thermald/files/thermald-1.4.2-terminate-r1.patch
new file mode 100644
index 000000000000..96ba91ffe5ec
--- /dev/null
+++ b/sys-power/thermald/files/thermald-1.4.2-terminate-r1.patch
@@ -0,0 +1,65 @@
+commit 14bf458675a735975c6b9bf7394682e93398a8e0
+Author: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
+Date: Tue Jul 14 17:46:45 2015 -0700
+
+ Fix regression in exit via dbus message
+
+ Terminate via dbus terminate message is broken. Fixed this.
+ Thanks to Yixun Lan <yixun.lan@gmail.com> for finding this.
+
+diff --git a/src/main.cpp b/src/main.cpp
+index 2cf4864..d692cf3 100644
+--- a/src/main.cpp
++++ b/src/main.cpp
+@@ -50,7 +50,7 @@
+ #define TD_DIST_VERSION PACKAGE_VERSION
+ #endif
+
+-extern int thd_dbus_server_init();
++extern int thd_dbus_server_init(void (*exit_handler)(int));
+
+ // Default log level
+ static int thd_log_level = G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL
+@@ -263,7 +263,7 @@ int main(int argc, char *argv[]) {
+ }
+
+ if (dbus_enable)
+- thd_dbus_server_init();
++ thd_dbus_server_init(sig_int_handler);
+
+ if (!no_daemon) {
+ printf("Ready to serve requests: Daemonizing.. %d\n", thd_daemonize);
+diff --git a/src/thd_dbus_interface.cpp b/src/thd_dbus_interface.cpp
+index 021bce2..7926101 100644
+--- a/src/thd_dbus_interface.cpp
++++ b/src/thd_dbus_interface.cpp
+@@ -187,8 +187,12 @@ gboolean thd_dbus_interface_get_current_preference(PrefObject *obj,
+ return TRUE;
+ }
+
++void (*thd_dbus_exit_callback)(int);
+ gboolean thd_dbus_interface_terminate(PrefObject *obj, GError **error) {
+ thd_engine->thd_engine_terminate();
++ if (thd_dbus_exit_callback)
++ thd_dbus_exit_callback(0);
++
+ return TRUE;
+ }
+
+@@ -561,13 +565,15 @@ gboolean thd_dbus_interface_get_sensor_temperature(PrefObject *obj, int index,
+ }
+
+ // Setup dbus server
+-int thd_dbus_server_init() {
++int thd_dbus_server_init(void (*exit_handler)(int)) {
+ DBusGConnection *bus;
+ DBusGProxy *bus_proxy;
+ GError *error = NULL;
+ guint result;
+ PrefObject *value_obj;
+
++ thd_dbus_exit_callback = exit_handler;
++
+ bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
+ if (error != NULL) {
+ thd_log_error("Couldn't connect to session bus: %s:\n", error->message);
diff --git a/sys-power/thermald/metadata.xml b/sys-power/thermald/metadata.xml
new file mode 100644
index 000000000000..9c025f0fed98
--- /dev/null
+++ b/sys-power/thermald/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>dlan@gentoo.org</email>
+ <name>Yixun Lan</name>
+ </maintainer>
+ <longdescription lang="en">
+Thermald is a Linux user mode daemon to system developers, reducing time to market with
+controlled thermal management using P-states, T-states, and the Intel power clamp driver.
+The Thermal Daemon uses the existing Linux kernel infrastructure and can be easily enhanced
+</longdescription>
+ <upstream>
+ <remote-id type="github">01org/thermal_daemon</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sys-power/thermald/thermald-1.3.ebuild b/sys-power/thermald/thermald-1.3.ebuild
new file mode 100644
index 000000000000..de4ce55140e2
--- /dev/null
+++ b/sys-power/thermald/thermald-1.3.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=1
+AUTOTOOLS_IN_SOURCE_BUILD=1
+inherit autotools-utils systemd
+
+DESCRIPTION="Thermal daemon for Intel architectures"
+HOMEPAGE="https://01.org/linux-thermal-daemon"
+SRC_URI="https://github.com/01org/thermal_daemon/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+IUSE=""
+S=${WORKDIR}/thermal_daemon-${PV}
+
+CDEPEND="dev-libs/dbus-glib
+ dev-libs/libxml2"
+DEPEND="${CDEPEND}
+ sys-apps/sed"
+RDEPEND="${CDEPEND}"
+
+DOCS=( thermal_daemon_usage.txt README.txt )
+
+src_configure() {
+ local myeconfargs=(
+ --with-systemdsystemunitdir=$(systemd_get_unitdir)
+ )
+ autotools-utils_src_configure
+}
+
+src_install() {
+ autotools-utils_src_install
+ rm -rf "${D}"/etc/init || die
+ doinitd "${FILESDIR}"/thermald
+}
diff --git a/sys-power/thermald/thermald-1.4.2-r1.ebuild b/sys-power/thermald/thermald-1.4.2-r1.ebuild
new file mode 100644
index 000000000000..c7e6e28b5cbc
--- /dev/null
+++ b/sys-power/thermald/thermald-1.4.2-r1.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=1
+AUTOTOOLS_IN_SOURCE_BUILD=1
+inherit autotools-utils systemd
+
+DESCRIPTION="Thermal daemon for Intel architectures"
+HOMEPAGE="https://01.org/linux-thermal-daemon"
+SRC_URI="https://github.com/01org/thermal_daemon/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+IUSE=""
+S=${WORKDIR}/thermal_daemon-${PV}
+
+CDEPEND="dev-libs/dbus-glib
+ dev-libs/libxml2"
+DEPEND="${CDEPEND}
+ sys-apps/sed"
+RDEPEND="${CDEPEND}"
+
+DOCS=( thermal_daemon_usage.txt README.txt )
+
+PATCHES=(
+ "${FILESDIR}/${P}-terminate-r1.patch"
+)
+
+src_configure() {
+ local myeconfargs=(
+ --with-systemdsystemunitdir=$(systemd_get_unitdir)
+ )
+ autotools-utils_src_configure
+}
+
+src_install() {
+ autotools-utils_src_install
+ rm -rf "${D}"/etc/init || die
+ doinitd "${FILESDIR}"/thermald
+}
diff --git a/sys-power/upower-pm-utils/Manifest b/sys-power/upower-pm-utils/Manifest
new file mode 100644
index 000000000000..2e70655c960f
--- /dev/null
+++ b/sys-power/upower-pm-utils/Manifest
@@ -0,0 +1 @@
+DIST upower-0.9.23.tar.xz 425804 SHA256 433252b0a8e9ab4bed7e17ee3ee5b7cef6d527b1f5401ee32212d82a9682981b SHA512 526ef95e43faf61744ba2bbf80bae23bc5c8672130563a87a7f18f00d85b16e2069814ad70dd66ce6ce698037b522d78579cc2135e2af0c2a636230cfa662c6d WHIRLPOOL 1599739198767ea6c70e133d50302a62a5b0b07c3786057b75636167c80b02d8e0ab6cc4781ac08994b249ffb57875bf186923d441e0b10e73c238b6be5b3538
diff --git a/sys-power/upower-pm-utils/files/upower-pm-utils-0.9.23-always_use_pm-utils_backend.patch b/sys-power/upower-pm-utils/files/upower-pm-utils-0.9.23-always_use_pm-utils_backend.patch
new file mode 100644
index 000000000000..b1cb5c7334e0
--- /dev/null
+++ b/sys-power/upower-pm-utils/files/upower-pm-utils-0.9.23-always_use_pm-utils_backend.patch
@@ -0,0 +1,27 @@
+Description: Always use the pm-utils backend for now
+ Redirecting the suspend / hibernate request to logind requires systemd
+ to be running, as logind tries to start the suspend.target /
+ hibernate.target via the D-Bus interface provided by systemd.
+ The availability of logind does not necessarily imply that systemd is
+ available since we made logind D-Bus activatable under sysvinit.
+ Also, the systemd version currently in unstable (v44) is too old and
+ doesn't provide that functionality yet.
+ Ubuntu ships a very basic implementation of that D-Bus inferface in
+ systemd-shim which can be run under sysvinit. But we don't have that
+ package in Debian (yet).
+ For now, it's the safest option to just continue using the old
+ pm-utils backend always.
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=718493
+diff --git a/src/linux/up-backend.c b/src/linux/up-backend.c
+index b9f75f5..595a1b2 100644
+--- a/src/linux/up-backend.c
++++ b/src/linux/up-backend.c
+@@ -51,7 +51,7 @@
+
+ #ifdef ENABLE_DEPRECATED
+
+-#define LOGIND_AVAILABLE() (access("/run/systemd/seats/", F_OK) >= 0)
++#define LOGIND_AVAILABLE() (FALSE)
+
+ #define SD_HIBERNATE_COMMAND "gdbus call --system --dest org.freedesktop.login1 --object-path /org/freedesktop/login1 --method org.freedesktop.login1.Manager.Hibernate 'true'"
+ #define SD_SUSPEND_COMMAND "gdbus call --system --dest org.freedesktop.login1 --object-path /org/freedesktop/login1 --method org.freedesktop.login1.Manager.Suspend 'true'"
diff --git a/sys-power/upower-pm-utils/files/upower-pm-utils-0.9.23-clamp_percentage_for_overfull_batt.patch b/sys-power/upower-pm-utils/files/upower-pm-utils-0.9.23-clamp_percentage_for_overfull_batt.patch
new file mode 100644
index 000000000000..6e643c42de5e
--- /dev/null
+++ b/sys-power/upower-pm-utils/files/upower-pm-utils-0.9.23-clamp_percentage_for_overfull_batt.patch
@@ -0,0 +1,72 @@
+From b8fe9902f3c6c50ca6a23e24fcea99582beebc65 Mon Sep 17 00:00:00 2001
+From: Martin Pitt <martinpitt@gnome.org>
+Date: Tue, 22 Oct 2013 08:02:51 +0000
+Subject: linux: Clamp percentage for overfull batteries
+
+Some batteries report energy > energy_full and a percentage ("capacity"
+attribute) > 100%. Clamp these within 0 and 100% for both plausibility as well
+as to avoid setting an out-of-range property which would then become 0%.
+
+https://launchpad.net/bugs/1240673
+---
+diff --git a/src/linux/integration-test b/src/linux/integration-test
+index 8489bf3..4be1922 100755
+--- a/src/linux/integration-test
++++ b/src/linux/integration-test
+@@ -442,6 +442,39 @@ class Tests(unittest.TestCase):
+ self.assertEqual(self.get_dbus_property('OnLowBattery'), False)
+ self.stop_daemon()
+
++ def test_battery_overfull(self):
++ '''battery which reports a > 100% percentage for a full battery'''
++
++ self.testbed.add_device('power_supply', 'BAT0', None,
++ ['type', 'Battery',
++ 'present', '1',
++ 'status', 'Full',
++ 'current_now', '1000',
++ 'charge_now', '11000000',
++ 'charge_full', '10000000',
++ 'charge_full_design', '11000000',
++ 'capacity', '110',
++ 'voltage_now', '12000000'], [])
++
++ self.start_daemon()
++ devs = self.proxy.EnumerateDevices()
++ self.assertEqual(len(devs), 1)
++ bat0_up = devs[0]
++
++ # should clamp percentage
++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'Percentage'), 100.0)
++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'IsPresent'), True)
++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'State'),
++ UP_DEVICE_STATE_FULLY_CHARGED)
++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'Energy'), 132.0)
++ # should adjust EnergyFull to reality, not what the battery claims
++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'EnergyFull'), 132.0)
++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'EnergyFullDesign'), 132.0)
++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'Voltage'), 12.0)
++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'PowerSupply'), True)
++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'Type'), 2)
++ self.stop_daemon()
++
+ def test_battery_temperature(self):
+ '''battery which reports temperature'''
+
+diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c
+index 8020277..b953d65 100644
+--- a/src/linux/up-device-supply.c
++++ b/src/linux/up-device-supply.c
+@@ -708,6 +708,10 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply)
+ /* get a precise percentage */
+ if (sysfs_file_exists (native_path, "capacity")) {
+ percentage = sysfs_get_double (native_path, "capacity");
++ if (percentage < 0.0f)
++ percentage = 0.0f;
++ if (percentage > 100.0f)
++ percentage = 100.0f;
+ /* for devices which provide capacity, but not {energy,charge}_now */
+ if (energy < 0.1f && energy_full > 0.0f)
+ energy = energy_full * percentage / 100;
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/sys-power/upower-pm-utils/files/upower-pm-utils-0.9.23-create-dir-runtime.patch b/sys-power/upower-pm-utils/files/upower-pm-utils-0.9.23-create-dir-runtime.patch
new file mode 100644
index 000000000000..34340d44ec30
--- /dev/null
+++ b/sys-power/upower-pm-utils/files/upower-pm-utils-0.9.23-create-dir-runtime.patch
@@ -0,0 +1,34 @@
+From b9cff29978113aefe3ad18521f383f12ab099a34 Mon Sep 17 00:00:00 2001
+From: Cosimo Cecchi <cosimo@endlessm.com>
+Date: Tue, 25 Feb 2014 09:43:04 +0000
+Subject: Create the history directory at runtime
+
+In addition to build time - this increases compatibilty with OSTree,
+which starts out with an empty /var.
+
+Signed-off-by: Richard Hughes <richard@hughsie.com>
+---
+diff --git a/src/up-history.c b/src/up-history.c
+index f9d0fdf..795b093 100644
+--- a/src/up-history.c
++++ b/src/up-history.c
+@@ -414,6 +414,7 @@ up_history_set_directory (UpHistory *history, const gchar *dir)
+ {
+ g_free (history->priv->dir);
+ history->priv->dir = g_strdup (dir);
++ g_mkdir_with_parents (dir, 0755);
+ }
+
+ /**
+@@ -887,7 +888,8 @@ up_history_init (UpHistory *history)
+ history->priv->data_time_full = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
+ history->priv->data_time_empty = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
+ history->priv->max_data_age = UP_HISTORY_DEFAULT_MAX_DATA_AGE;
+- history->priv->dir = g_build_filename (HISTORY_DIR, NULL);
++
++ up_history_set_directory (history, HISTORY_DIR);
+ }
+
+ /**
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/sys-power/upower-pm-utils/files/upower-pm-utils-0.9.23-fix-segfault.patch b/sys-power/upower-pm-utils/files/upower-pm-utils-0.9.23-fix-segfault.patch
new file mode 100644
index 000000000000..3e8976320777
--- /dev/null
+++ b/sys-power/upower-pm-utils/files/upower-pm-utils-0.9.23-fix-segfault.patch
@@ -0,0 +1,24 @@
+From 0d64bbddaa0078ef148d609a3cfad854cf00d7de Mon Sep 17 00:00:00 2001
+From: Martin Pitt <martinpitt@gnome.org>
+Date: Fri, 08 Nov 2013 13:59:50 +0000
+Subject: lib: Fix segfault on getting property when daemon is not running
+
+This fixes "upower --version" when the daemon is not running, and thus the
+client proxy is NULL.
+---
+diff --git a/libupower-glib/up-client.c b/libupower-glib/up-client.c
+index 35d7b5d..17fb02d 100644
+--- a/libupower-glib/up-client.c
++++ b/libupower-glib/up-client.c
+@@ -322,6 +322,9 @@ up_client_get_property (GObject *object,
+ UpClient *client;
+ client = UP_CLIENT (object);
+
++ if (client->priv->proxy == NULL)
++ return;
++
+ switch (prop_id) {
+ case PROP_DAEMON_VERSION:
+ g_value_set_string (value, up_client_glue_get_daemon_version (client->priv->proxy));
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/sys-power/upower-pm-utils/metadata.xml b/sys-power/upower-pm-utils/metadata.xml
new file mode 100644
index 000000000000..c03b663ea9ff
--- /dev/null
+++ b/sys-power/upower-pm-utils/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>freedesktop</herd>
+ <maintainer>
+ <email>freedesktop-bugs@gentoo.org</email>
+ </maintainer>
+</pkgmetadata>
diff --git a/sys-power/upower-pm-utils/upower-pm-utils-0.9.23-r2.ebuild b/sys-power/upower-pm-utils/upower-pm-utils-0.9.23-r2.ebuild
new file mode 100644
index 000000000000..bc9b8a762f01
--- /dev/null
+++ b/sys-power/upower-pm-utils/upower-pm-utils-0.9.23-r2.ebuild
@@ -0,0 +1,102 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils systemd
+
+DESCRIPTION="The upstream upower 0.9 git branch for use with sys-power/pm-utils"
+HOMEPAGE="http://upower.freedesktop.org/"
+SRC_URI="http://upower.freedesktop.org/releases/upower-${PV}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ia64 ~mips ppc ppc64 sparc x86 ~x86-fbsd"
+IUSE="+introspection ios kernel_FreeBSD kernel_linux"
+
+COMMON_DEPEND=">=dev-libs/dbus-glib-0.100
+ >=dev-libs/glib-2.22
+ sys-apps/dbus
+ >=sys-auth/polkit-0.110
+ introspection? ( dev-libs/gobject-introspection )
+ kernel_linux? (
+ virtual/libusb:1
+ virtual/libgudev:=
+ virtual/udev
+ ios? (
+ >=app-pda/libimobiledevice-1:=
+ >=app-pda/libplist-1:=
+ )
+ )
+ !sys-power/upower"
+RDEPEND="${COMMON_DEPEND}
+ kernel_linux? ( >=sys-power/pm-utils-1.4.1-r2 )"
+DEPEND="${COMMON_DEPEND}
+ dev-libs/libxslt
+ app-text/docbook-xsl-stylesheets
+ dev-util/intltool
+ >=sys-devel/gettext-0.17
+ virtual/pkgconfig"
+
+QA_MULTILIB_PATHS="usr/lib/upower/.*"
+
+DOCS="AUTHORS HACKING NEWS README"
+
+S=${WORKDIR}/upower-${PV}
+
+src_prepare() {
+ sed -i -e '/DISABLE_DEPRECATED/d' configure || die
+
+ # http://bugs.freedesktop.org/show_bug.cgi?id=79565
+ # http://bugzilla.xfce.org/show_bug.cgi?id=10931
+ # Same effect as Debian -no_deprecation_define.patch, they patch .h, we patch .pc
+ sed -i -e 's|Cflags: |&-DUPOWER_ENABLE_DEPRECATED |' upower-glib.pc.in || die
+
+ # From upstream 0.9 git branch:
+ epatch \
+ "${FILESDIR}"/${P}-create-dir-runtime.patch \
+ "${FILESDIR}"/${P}-fix-segfault.patch \
+ "${FILESDIR}"/${P}-clamp_percentage_for_overfull_batt.patch
+
+ # From Debian:
+ epatch "${FILESDIR}"/${P}-always_use_pm-utils_backend.patch
+}
+
+src_configure() {
+ local backend myconf
+
+ if use kernel_linux; then
+ backend=linux
+ myconf="--enable-deprecated"
+ elif use kernel_FreeBSD; then
+ backend=freebsd
+ else
+ backend=dummy
+ fi
+
+ econf \
+ --libexecdir="${EPREFIX}"/usr/lib/upower \
+ --localstatedir="${EPREFIX}"/var \
+ $(use_enable introspection) \
+ --disable-static \
+ ${myconf} \
+ --enable-man-pages \
+ --disable-tests \
+ --with-html-dir="${EPREFIX}"/usr/share/doc/${PF}/html \
+ --with-backend=${backend} \
+ $(use_with ios idevice) \
+ "$(systemd_with_utildir)" \
+ "$(systemd_with_unitdir)"
+}
+
+src_install() {
+ default
+
+ # http://bugs.gentoo.org/487400
+ insinto /usr/share/doc/${PF}/html/UPower
+ doins doc/html/*
+ dosym /usr/share/doc/${PF}/html/UPower /usr/share/gtk-doc/html/UPower
+
+ keepdir /var/lib/upower #383091
+ prune_libtool_files
+}
diff --git a/sys-power/upower/Manifest b/sys-power/upower/Manifest
new file mode 100644
index 000000000000..74588556428b
--- /dev/null
+++ b/sys-power/upower/Manifest
@@ -0,0 +1,2 @@
+DIST upower-0.99.2.tar.xz 428668 SHA256 e9dc453adf96b89c92ccccd33f2b6543258344f7c8ba89460dc0a92a8180946f SHA512 a7859c91078140f460556ecf998a706b403d5ed2ff073fffa93730c95e62a8ec00b91f6669d74afd8d0ada73d75b27320d52a3589765712dc078f78a28ea527b WHIRLPOOL 42abf07947bcd1709045d3a0c945161b98a422e90c31ebda7a69783ee8915ecd9d048713412b3f1e26d4db96f85a4bf6e1d63b310f9fc5aa20519bb2e3c51f32
+DIST upower-0.99.3.tar.xz 429252 SHA256 697199bcc113bb069e6fb6bf4135536a702ba9847e46c5fc6df87d19624ddd38 SHA512 665b5b03605910b3a2d3f32e4846c2b2ab4c91ba91c55dde8c5b8ab3856f3d6fea5efac20fdb608050b57979ed344ef630c76acc0b3f858e8c5168f6adeb2d64 WHIRLPOOL c6543518d64c1628763695a10f81d6ae9b48f252c7a7ee68deb1249489329414101a620c1f529c8f76e460713faeb0077c75489466c6aeb54008590b49441181
diff --git a/sys-power/upower/metadata.xml b/sys-power/upower/metadata.xml
new file mode 100644
index 000000000000..c03b663ea9ff
--- /dev/null
+++ b/sys-power/upower/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>freedesktop</herd>
+ <maintainer>
+ <email>freedesktop-bugs@gentoo.org</email>
+ </maintainer>
+</pkgmetadata>
diff --git a/sys-power/upower/upower-0.99.2-r1.ebuild b/sys-power/upower/upower-0.99.2-r1.ebuild
new file mode 100644
index 000000000000..faab47840580
--- /dev/null
+++ b/sys-power/upower/upower-0.99.2-r1.ebuild
@@ -0,0 +1,85 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils systemd
+
+DESCRIPTION="D-Bus abstraction for enumerating power devices and querying history and statistics"
+HOMEPAGE="http://upower.freedesktop.org/"
+SRC_URI="http://${PN}.freedesktop.org/releases/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0/3" # based on SONAME of libupower-glib.so
+KEYWORDS="alpha amd64 arm ia64 ~mips ppc ppc64 sparc x86 ~x86-fbsd"
+IUSE="+introspection ios kernel_FreeBSD kernel_linux selinux"
+
+COMMON_DEPS=">=dev-libs/dbus-glib-0.100
+ >=dev-libs/glib-2.34
+ sys-apps/dbus:=
+ introspection? ( dev-libs/gobject-introspection )
+ kernel_linux? (
+ virtual/libusb:1
+ virtual/libgudev:=
+ virtual/udev
+ ios? (
+ >=app-pda/libimobiledevice-1:=
+ >=app-pda/libplist-1:=
+ )
+ )"
+RDEPEND="
+ ${COMMON_DEPS}
+ selinux? ( sec-policy/selinux-devicekit )
+"
+DEPEND="${COMMON_DEPS}
+ dev-libs/libxslt
+ app-text/docbook-xsl-stylesheets
+ dev-util/intltool
+ >=sys-devel/gettext-0.17
+ virtual/pkgconfig"
+
+QA_MULTILIB_PATHS="usr/lib/${PN}/.*"
+
+DOCS="AUTHORS HACKING NEWS README"
+
+src_prepare() {
+ sed -i -e '/DISABLE_DEPRECATED/d' configure || die
+}
+
+src_configure() {
+ local backend myconf
+
+ if use kernel_linux; then
+ backend=linux
+ elif use kernel_FreeBSD; then
+ backend=freebsd
+ else
+ backend=dummy
+ fi
+
+ econf \
+ --libexecdir="${EPREFIX}"/usr/lib/${PN} \
+ --localstatedir="${EPREFIX}"/var \
+ $(use_enable introspection) \
+ --disable-static \
+ ${myconf} \
+ --enable-man-pages \
+ --disable-tests \
+ --with-html-dir="${EPREFIX}"/usr/share/doc/${PF}/html \
+ --with-backend=${backend} \
+ $(use_with ios idevice) \
+ "$(systemd_with_utildir)" \
+ "$(systemd_with_unitdir)"
+}
+
+src_install() {
+ default
+
+ # http://bugs.gentoo.org/487400
+ insinto /usr/share/doc/${PF}/html/UPower
+ doins doc/html/*
+ dosym /usr/share/doc/${PF}/html/UPower /usr/share/gtk-doc/html/UPower
+
+ keepdir /var/lib/upower #383091
+ prune_libtool_files
+}
diff --git a/sys-power/upower/upower-0.99.3.ebuild b/sys-power/upower/upower-0.99.3.ebuild
new file mode 100644
index 000000000000..e6cacaf47942
--- /dev/null
+++ b/sys-power/upower/upower-0.99.3.ebuild
@@ -0,0 +1,85 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils systemd
+
+DESCRIPTION="D-Bus abstraction for enumerating power devices and querying history and statistics"
+HOMEPAGE="http://upower.freedesktop.org/"
+SRC_URI="http://${PN}.freedesktop.org/releases/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0/3" # based on SONAME of libupower-glib.so
+KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
+
+# gtk-doc files are not available as prebuilt in the tarball
+IUSE="doc +introspection ios kernel_FreeBSD kernel_linux selinux"
+
+COMMON_DEPS="
+ >=dev-libs/dbus-glib-0.100
+ >=dev-libs/glib-2.34:2
+ sys-apps/dbus:=
+ introspection? ( dev-libs/gobject-introspection:= )
+ kernel_linux? (
+ virtual/libusb:1
+ virtual/libgudev:=
+ virtual/udev
+ ios? (
+ >=app-pda/libimobiledevice-1:=
+ >=app-pda/libplist-1:=
+ )
+ )
+"
+RDEPEND="
+ ${COMMON_DEPS}
+ selinux? ( sec-policy/selinux-devicekit )
+"
+DEPEND="${COMMON_DEPS}
+ doc? ( dev-util/gtk-doc )
+ dev-libs/libxslt
+ app-text/docbook-xsl-stylesheets
+ dev-util/intltool
+ >=sys-devel/gettext-0.17
+ virtual/pkgconfig
+"
+
+QA_MULTILIB_PATHS="usr/lib/${PN}/.*"
+
+DOCS="AUTHORS HACKING NEWS README"
+
+src_prepare() {
+ sed -i -e '/DISABLE_DEPRECATED/d' configure || die
+}
+
+src_configure() {
+ local backend myconf
+
+ if use kernel_linux; then
+ backend=linux
+ elif use kernel_FreeBSD; then
+ backend=freebsd
+ else
+ backend=dummy
+ fi
+
+ econf \
+ $(use_enable doc gtk-doc) \
+ --libexecdir="${EPREFIX}"/usr/lib/${PN} \
+ --localstatedir="${EPREFIX}"/var \
+ $(use_enable introspection) \
+ --disable-static \
+ ${myconf} \
+ --enable-man-pages \
+ --disable-tests \
+ --with-backend=${backend} \
+ $(use_with ios idevice) \
+ "$(systemd_with_utildir)" \
+ "$(systemd_with_unitdir)"
+}
+
+src_install() {
+ default
+ keepdir /var/lib/upower #383091
+ prune_libtool_files
+}
diff --git a/sys-power/yacpi/Manifest b/sys-power/yacpi/Manifest
new file mode 100644
index 000000000000..4d9aa08aaef6
--- /dev/null
+++ b/sys-power/yacpi/Manifest
@@ -0,0 +1 @@
+DIST yacpi-3.0.1.tar.gz 14508 SHA256 65148a7394d898edc64bcf9f866fe2e47dfdd1cb62c581623084d12946d56fae
diff --git a/sys-power/yacpi/metadata.xml b/sys-power/yacpi/metadata.xml
new file mode 100644
index 000000000000..c2d865517c00
--- /dev/null
+++ b/sys-power/yacpi/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>ssuominen@gentoo.org</email>
+ <name>Samuli Suominen</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/sys-power/yacpi/yacpi-3.0.1.ebuild b/sys-power/yacpi/yacpi-3.0.1.ebuild
new file mode 100644
index 000000000000..af6a002cd2a2
--- /dev/null
+++ b/sys-power/yacpi/yacpi-3.0.1.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=3
+inherit toolchain-funcs
+
+DESCRIPTION="Yet Another Configuration and Power Interface"
+HOMEPAGE="http://www.ngolde.de/yacpi.html"
+SRC_URI="http://www.ngolde.de/download/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND="sys-libs/libacpi
+ sys-libs/ncurses"
+
+src_prepare() {
+ sed -i \
+ -e 's:= -O2 -Wall -g:+= -Wall:' \
+ -e 's:${CC} -Wall:${CC} ${LDFLAGS} ${CFLAGS}:' \
+ -e '/strip/d' \
+ -e 's:COPYING::' \
+ Makefile || die
+}
+
+src_compile() {
+ emake CC="$(tc-getCC)" || die
+}
+
+src_install() {
+ emake \
+ prefix="${D}/usr" \
+ DOCPATH="${D}/usr/share/doc/${PF}" \
+ install || die
+
+ prepalldocs
+}