powertop-9999.ebuild 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="6"
  4. inherit eutils linux-info
  5. if [[ ${PV} == "9999" ]] ; then
  6. EGIT_REPO_URI="git://github.com/fenrus75/powertop.git"
  7. inherit git-r3 autotools
  8. SRC_URI=""
  9. else
  10. SRC_URI="https://01.org/sites/default/files/downloads/${PN}/${P}.tar.gz"
  11. KEYWORDS="~amd64 ~arm ~ppc ~sparc ~x86 ~amd64-linux ~x86-linux"
  12. fi
  13. DESCRIPTION="tool that helps you find what software is using the most power"
  14. HOMEPAGE="https://01.org/powertop/"
  15. LICENSE="GPL-2"
  16. SLOT="0"
  17. IUSE="nls unicode X"
  18. COMMON_DEPEND="
  19. dev-libs/libnl:3
  20. sys-apps/pciutils
  21. sys-libs/ncurses:=[unicode?]
  22. "
  23. DEPEND="${COMMON_DEPEND}
  24. virtual/pkgconfig
  25. sys-devel/gettext
  26. "
  27. RDEPEND="
  28. ${COMMON_DEPEND}
  29. X? ( x11-apps/xset )
  30. virtual/libintl
  31. "
  32. pkg_setup() {
  33. CONFIG_CHECK="
  34. ~X86_MSR
  35. ~DEBUG_FS
  36. ~PERF_EVENTS
  37. ~TRACEPOINTS
  38. ~NO_HZ
  39. ~HIGH_RES_TIMERS
  40. ~HPET_TIMER
  41. ~CPU_FREQ_STAT
  42. ~CPU_FREQ_GOV_ONDEMAND
  43. ~FTRACE
  44. ~BLK_DEV_IO_TRACE
  45. ~TIMER_STATS
  46. ~TRACING
  47. "
  48. ERROR_KERNEL_X86_MSR="X86_MSR is not enabled in the kernel, you almost certainly need it"
  49. ERROR_KERNEL_DEBUG_FS="DEBUG_FS is not enabled in the kernel, you almost certainly need it"
  50. ERROR_KERNEL_PERF_EVENTS="PERF_EVENTS should be enabled in the kernel for full powertop function"
  51. ERROR_KERNEL_TRACEPOINTS="TRACEPOINTS should be enabled in the kernel for full powertop function"
  52. ERROR_KERNEL_NO_HZ="NO_HZ should be enabled in the kernel for full powertop function"
  53. ERROR_KERNEL_HIGH_RES_TIMERS="HIGH_RES_TIMERS should be enabled in the kernel for full powertop function"
  54. ERROR_KERNEL_HPET_TIMER="HPET_TIMER should be enabled in the kernel for full powertop function"
  55. ERROR_KERNEL_CPU_FREQ_STAT="CPU_FREQ_STAT should be enabled in the kernel for full powertop function"
  56. ERROR_KERNEL_CPU_FREQ_GOV_ONDEMAND="CPU_FREQ_GOV_ONDEMAND should be enabled in the kernel for full powertop function"
  57. ERROR_KERNEL_FTRACE="FTRACE needs to be turned on to enable BLK_DEV_IO_TRACE"
  58. 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"
  59. ERROR_KERNEL_TIMER_STATS="TIMER_STATS should be enabled in the kernel for full powertop function"
  60. ERROR_KERNEL_TRACING="TRACING should be enabled in the kernel for full powertop function"
  61. linux-info_pkg_setup
  62. if linux_config_exists; then
  63. if kernel_is -lt 3 7 0; then
  64. if linux_chkconfig_present SND_HDA_INTEL; then
  65. CONFIG_CHECK="~SND_HDA_POWER_SAVE"
  66. ERROR_KERNEL_SND_HDA_POWER_SAVE="SND_HDA_POWER_SAVE should be enabled in the kernel for full powertop function"
  67. check_extra_config
  68. fi
  69. fi
  70. if kernel_is -lt 3 9 0; then
  71. CONFIG_CHECK="~EVENT_POWER_TRACING_DEPRECATED"
  72. ERROR_KERNEL_EVENT_POWER_TRACING_DEPRECATED="EVENT_POWER_TRACING_DEPRECATED should be enabled in the kernel for full powertop function"
  73. check_extra_config
  74. fi
  75. if kernel_is -lt 3 19; then
  76. CONFIG_CHECK="~PM_RUNTIME"
  77. ERROR_KERNEL_PM_RUNTIME="PM_RUNTIME should be enabled in the kernel for full powertop function"
  78. check_extra_config
  79. else
  80. CONFIG_CHECK="~PM"
  81. ERROR_KERNEL_PM="PM should be enabled in the kernel for full powertop function"
  82. check_extra_config
  83. fi
  84. fi
  85. }
  86. src_prepare() {
  87. default
  88. if [[ ${PV} == "9999" ]] ; then
  89. chmod +x scripts/version || die "Failed to make 'scripts/version' executable"
  90. scripts/version || die "Failed to extract version information"
  91. eautoreconf
  92. fi
  93. }
  94. src_configure() {
  95. export ac_cv_search_delwin=$(usex unicode -lncursesw -lncurses)
  96. econf $(use_enable nls)
  97. }