1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 )
7 GENTOO_DEPEND_ON_PERL="no"
9 inherit eutils linux-info perl-module python-r1 base
11 DESCRIPTION="Takes control of the G15 keyboard, through the linux kernel uinput device driver"
12 HOMEPAGE="https://sourceforge.net/projects/g15daemon/"
13 SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
18 IUSE="perl python static-libs"
20 DEPEND="virtual/libusb:0
21 >=dev-libs/libg15-9999
22 >=dev-libs/libg15render-1.2
28 python? ( ${PYTHON_DEPS} )"
30 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
33 "${FILESDIR}/${P}-forgotten-open-mode.patch"
34 "${FILESDIR}/${P}-overflow-fix.patch"
35 "${FILESDIR}/${P}-g510-keys.patch"
39 ebegin "Checking for uinput support"
41 linux_config_exists && linux_chkconfig_present INPUT_UINPUT
44 if [[ $rc -ne 0 ]] ; then
45 eerror "To use g15daemon, you need to compile your kernel with uinput support."
46 eerror "Please enable uinput support in your kernel config, found at:"
48 eerror "Device Drivers -> Input Device ... -> Miscellaneous devices -> User level driver support."
50 eerror "Once enabled, you should have the /dev/input/uinput device."
51 eerror "g15daemon will not work without the uinput device."
63 unpack "./${P}/lang-bindings/perl-G15Daemon-0.2.tar.gz"
66 unpack "./${P}/lang-bindings/pyg15daemon-0.0.tar.bz2"
72 perl-module_src_prepare
74 -e '1i#!/usr/bin/perl' \
75 "${S}"/contrib/testbindings.pl
77 # perl-module_src_prepare always calls base_src_prepare
84 --docdir="${EPREFIX}/usr/share/doc/${PF}" \
85 $(use_enable static-libs static)
88 cd "${WORKDIR}/G15Daemon-0.2"
89 perl-module_src_configure
97 cd "${WORKDIR}/G15Daemon-0.2"
98 perl-module_src_compile
105 find "${ED}" -name '*.la' -exec rm -f {} +
107 # remove odd docs installed my make
108 rm "${ED}/usr/share/doc/${PF}/"{LICENSE,README.usage}
110 insinto /usr/share/${PN}/contrib
111 doins contrib/xmodmaprc
112 doins contrib/xmodmap.sh
114 doins contrib/testbindings.pl
117 newconfd "${FILESDIR}/${PN}-1.2.7.confd" ${PN}
118 newinitd "${FILESDIR}/${PN}-1.9.5.3.initd" ${PN}
119 dobin "${FILESDIR}/g15daemon-hotplug"
120 insinto /lib/udev/rules.d
121 doins "${FILESDIR}/99-g15daemon.rules"
124 doins "${FILESDIR}"/g15daemon.conf
126 # Gentoo bug #301340, debian bug #611649
127 exeinto /usr/lib/pm-utils/sleep.d
128 doexe "${FILESDIR}"/20g15daemon
131 ebegin "Installing Perl Bindings (G15Daemon.pm)"
132 cd "${WORKDIR}/G15Daemon-0.2"
134 perl-module_src_install
138 ebegin "Installing Python Bindings (g15daemon.py)"
139 cd "${WORKDIR}/pyg15daemon"
141 python_foreach_impl python_domodule g15daemon.py
149 elog "To use g15daemon, you need to add g15daemon to the default runlevel."
150 elog "This can be done with:"
151 elog "# /sbin/rc-update add g15daemon default"
152 elog "You can edit some g15daemon options at /etc/conf.d/g15daemon"
154 elog "To have all new keys working in X11, you'll need create a "
155 elog "specific xmodmap in your home directory or edit the existent one."
157 elog "Create the xmodmap:"
158 elog "cp /usr/share/g15daemon/contrib/xmodmaprc ~/.Xmodmap"
160 elog "Adding keycodes to an existing xmodmap:"
161 elog "cat /usr/share/g15daemon/contrib/xmodmaprc >> ~/.Xmodmap"