pbbuttonsd-0.8.1-r4.ebuild 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. # Copyright 1999-2014 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. inherit autotools flag-o-matic eutils
  4. DESCRIPTION="Handles power management and special keys on laptops"
  5. HOMEPAGE="http://pbbuttons.berlios.de"
  6. SRC_URI="mirror://sourceforge/pbbuttons/${P}.tar.gz"
  7. LICENSE="GPL-2"
  8. SLOT="0"
  9. KEYWORDS="~amd64 ~ppc ~x86"
  10. IUSE="acpi alsa debug doc ibam macbook oss"
  11. DEPEND="macbook? (
  12. sys-libs/libsmbios
  13. sys-apps/pciutils
  14. )
  15. >=dev-libs/glib-2.6
  16. doc? ( app-doc/doxygen )"
  17. RDEPEND="alsa? ( >=media-libs/alsa-lib-1.0 )
  18. >=dev-libs/glib-2.6"
  19. src_unpack() {
  20. unpack ${A}
  21. cd "${S}"
  22. epatch "${FILESDIR}/pmcs.patch"
  23. ### Don't link with g++ if we don't use ibam
  24. if ! use ibam; then
  25. epatch "${FILESDIR}/g++.patch"
  26. fi
  27. ### Fix macbook -lz issue
  28. epatch "${FILESDIR}/lz.patch"
  29. epatch "${FILESDIR}/lm.patch"
  30. ### Fix new apple hid fnmode issue
  31. epatch "${FILESDIR}/fnmode.patch"
  32. ### Add kernel 2.6.x stuff for 3.x as well
  33. epatch "${FILESDIR}/laptopmode.sh.patch"
  34. epatch "${FILESDIR}/cpufreq.patch"
  35. eautoconf
  36. }
  37. src_compile() {
  38. # Fix crash bug on some systems
  39. replace-flags -O? -O1
  40. if use macbook; then
  41. laptop=macbook
  42. elif use x86 || use amd64; then
  43. if use acpi; then
  44. laptop=acpi
  45. else
  46. laptop=i386
  47. fi
  48. # Default to PowerBook
  49. else
  50. laptop=powerbook
  51. fi
  52. econf laptop=$laptop \
  53. $(use_enable debug) \
  54. $(use_with doc doxygen_docs) \
  55. $(use_with alsa) \
  56. $(use_with oss) \
  57. $(use_with ibam) \
  58. || die "Sorry, failed to configure pbbuttonsd"
  59. # Thanks to Stefan Bruda for this workaround
  60. # Using -j1 fixes a parallel build issue with the docs
  61. if use doc; then
  62. emake -j1 || die "Sorry, failed to compile pbbuttonsd"
  63. else
  64. emake || die "Sorry, failed to compile pbbuttonsd"
  65. fi
  66. }
  67. src_install() {
  68. dodir /etc/power
  69. use ibam && dodir /var/lib/ibam
  70. make DESTDIR="${D}" install || die "failed to install"
  71. newinitd "${FILESDIR}/pbbuttonsd.rc6" pbbuttonsd
  72. dodoc README
  73. use doc && dohtml -r doc/*
  74. dodir /etc/power/resume.d
  75. dodir /etc/power/suspend.d
  76. dodir /etc/power/scripts.d
  77. exeinto "/etc/power/scripts.d"
  78. doexe "${FILESDIR}/wireless"
  79. ln -s "${D}/etc/power/scripts.d/wireless" "${D}/etc/power/resume.d/wireless"
  80. }
  81. pkg_postinst() {
  82. if [ -e /etc/pbbuttonsd.conf ]; then
  83. ewarn "The pbbuttonsd.cnf file replaces /etc/pbuttonsd.conf with a new"
  84. ewarn "file (/etc/pbbuttonsd.conf) and a new format. Please check the"
  85. ewarn "manual page with 'man pbbuttonsd.cnf' for details."
  86. ewarn
  87. fi
  88. if use macbook; then
  89. ewarn "Macbook and Macbook Pro users should make sure to have applesmc"
  90. ewarn "loaded before starting pbbuttonsdm otherwise auto-adjustments"
  91. ewarn "will not work and pbbuttonsd may segfault."
  92. fi
  93. ewarn "Ensure that the evdev kernel module is loaded otherwise"
  94. ewarn "pbbuttonsd won't work. SysV IPC is also required."
  95. ewarn
  96. ewarn "If you need extra security, you can tell pbbuttonsd to only accept"
  97. ewarn "input from one user. You can set the userallowed option in"
  98. ewarn "/etc/pbbuttonsd.cnf to limit access."
  99. ewarn
  100. if use ibam; then
  101. elog "To properly initialize the IBaM battery database, you will"
  102. elog "need to perform a full discharge/charge cycle. For more"
  103. elog "details, please see the pbbuttonsd man page."
  104. elog
  105. fi
  106. elog "A script is now available to reset your wirless connection on resume."
  107. elog "Simply uncomment the commented command and set the correct device to"
  108. elog "use it. You can find the script in /etc/power/resume.d/wireless"
  109. }