1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
4 inherit autotools flag-o-matic eutils
6 DESCRIPTION="Handles power management and special keys on laptops"
7 HOMEPAGE="http://pbbuttons.berlios.de"
8 SRC_URI="mirror://sourceforge/pbbuttons/${P}.tar.gz"
12 KEYWORDS="~amd64 ppc ~x86"
13 IUSE="acpi alsa debug doc ibam macbook oss"
20 doc? ( app-doc/doxygen )"
21 RDEPEND="alsa? ( >=media-libs/alsa-lib-1.0 )
28 epatch "${FILESDIR}/${PN}-0.8.1-pmcs.patch"
29 ### Don't link with g++ if we don't use ibam
31 epatch "${FILESDIR}/${PN}-0.8.1-g++.patch"
33 ### Fix macbook -lz issue
34 epatch "${FILESDIR}/${PN}-0.8.1-lz.patch"
35 epatch "${FILESDIR}/${PN}-0.8.1-lm.patch"
36 ### Fix new apple hid fnmode issue
37 epatch "${FILESDIR}/${PN}-0.8.1-fnmode.patch"
42 # Fix crash bug on some systems
47 elif use x86 || use amd64; then
53 # Default to PowerBook
58 econf laptop=$laptop \
60 $(use_with doc doxygen_docs) \
64 || die "Sorry, failed to configure pbbuttonsd"
66 # Thanks to Stefan Bruda for this workaround
67 # Using -j1 fixes a parallel build issue with the docs
69 emake -j1 || die "Sorry, failed to compile pbbuttonsd"
71 emake || die "Sorry, failed to compile pbbuttonsd"
77 use ibam && dodir /var/lib/ibam
78 make DESTDIR="${D}" install || die "failed to install"
79 newinitd "${FILESDIR}/pbbuttonsd.rc6" pbbuttonsd
81 use doc && dohtml -r doc/*
83 dodir /etc/power/resume.d
84 dodir /etc/power/suspend.d
85 dodir /etc/power/scripts.d
86 exeinto "/etc/power/scripts.d"
87 doexe "${FILESDIR}/wireless"
88 ln -s "${D}/etc/power/scripts.d/wireless" "${D}/etc/power/resume.d/wireless"
92 if [ -e /etc/pbbuttonsd.conf ]; then
93 ewarn "The pbbuttonsd.cnf file replaces /etc/pbuttonsd.conf with a new"
94 ewarn "file (/etc/pbbuttonsd.conf) and a new format. Please check the"
95 ewarn "manual page with 'man pbbuttonsd.cnf' for details."
100 ewarn "Macbook and Macbook Pro users should make sure to have applesmc"
101 ewarn "loaded before starting pbbuttonsdm otherwise auto-adjustments"
102 ewarn "will not work and pbbuttonsd may segfault."
105 ewarn "Ensure that the evdev kernel module is loaded otherwise"
106 ewarn "pbbuttonsd won't work. SysV IPC is also required."
108 ewarn "If you need extra security, you can tell pbbuttonsd to only accept"
109 ewarn "input from one user. You can set the userallowed option in"
110 ewarn "/etc/pbbuttonsd.cnf to limit access."
114 elog "To properly initialize the IBaM battery database, you will"
115 elog "need to perform a full discharge/charge cycle. For more"
116 elog "details, please see the pbbuttonsd man page."
120 elog "A script is now available to reset your wirless connection on resume."
121 elog "Simply uncomment the commented command and set the correct device to"
122 elog "use it. You can find the script in /etc/power/resume.d/wireless"