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"
38 ### Add kernel 2.6.x stuff for 3.x as well
39 epatch "${FILESDIR}/${PN}-0.8.1-laptopmode.sh.patch"
40 epatch "${FILESDIR}/${PN}-0.8.1-cpufreq.patch"
46 # Fix crash bug on some systems
51 elif use x86 || use amd64; then
57 # Default to PowerBook
62 econf laptop=$laptop \
64 $(use_with doc doxygen_docs) \
68 || die "Sorry, failed to configure pbbuttonsd"
70 # Thanks to Stefan Bruda for this workaround
71 # Using -j1 fixes a parallel build issue with the docs
73 emake -j1 || die "Sorry, failed to compile pbbuttonsd"
75 emake || die "Sorry, failed to compile pbbuttonsd"
81 use ibam && dodir /var/lib/ibam
82 make DESTDIR="${D}" install || die "failed to install"
83 newinitd "${FILESDIR}/pbbuttonsd.rc6" pbbuttonsd
85 use doc && dohtml -r doc/*
87 dodir /etc/power/resume.d
88 dodir /etc/power/suspend.d
89 dodir /etc/power/scripts.d
90 exeinto "/etc/power/scripts.d"
91 doexe "${FILESDIR}/wireless"
92 ln -s "${D}/etc/power/scripts.d/wireless" "${D}/etc/power/resume.d/wireless"
96 if [ -e /etc/pbbuttonsd.conf ]; then
97 ewarn "The pbbuttonsd.cnf file replaces /etc/pbuttonsd.conf with a new"
98 ewarn "file (/etc/pbbuttonsd.conf) and a new format. Please check the"
99 ewarn "manual page with 'man pbbuttonsd.cnf' for details."
104 ewarn "Macbook and Macbook Pro users should make sure to have applesmc"
105 ewarn "loaded before starting pbbuttonsdm otherwise auto-adjustments"
106 ewarn "will not work and pbbuttonsd may segfault."
109 ewarn "Ensure that the evdev kernel module is loaded otherwise"
110 ewarn "pbbuttonsd won't work. SysV IPC is also required."
112 ewarn "If you need extra security, you can tell pbbuttonsd to only accept"
113 ewarn "input from one user. You can set the userallowed option in"
114 ewarn "/etc/pbbuttonsd.cnf to limit access."
118 elog "To properly initialize the IBaM battery database, you will"
119 elog "need to perform a full discharge/charge cycle. For more"
120 elog "details, please see the pbbuttonsd man page."
124 elog "A script is now available to reset your wirless connection on resume."
125 elog "Simply uncomment the commented command and set the correct device to"
126 elog "use it. You can find the script in /etc/power/resume.d/wireless"