app-misc/spacenavd-0.6-r0: amd64 stable
[gentoo.git] / app-misc / spacenavd / spacenavd-0.5-r6.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="5"
5
6 inherit eutils linux-info systemd toolchain-funcs udev
7
8 MY_PN='spacenav'
9 DESCRIPTION="The spacenavd daemon provides free alternative to the 3dxserv daemon"
10 HOMEPAGE="http://spacenav.sourceforge.net/"
11 SRC_URI="mirror://sourceforge/project/${MY_PN}/${MY_PN}%20daemon/${PN}%20${PV}/${P}.tar.gz"
12 LICENSE="GPL-3"
13 SLOT="0"
14 KEYWORDS="~amd64 ~ppc64 ~x86"
15 IUSE="X"
16
17 RDEPEND="X? ( x11-apps/xdpyinfo )"
18 DEPEND="${RDEPEND}"
19
20 pkg_setup() {
21         CONFIG_CHECK="~INPUT_EVDEV"
22         ERROR_CFG="Your kernel needs INPUT_EVDEV for the spacenavd to work properly"
23         check_extra_config
24 }
25
26 src_prepare() {
27         epatch "${FILESDIR}"/${P}-destdir.patch
28         epatch "${FILESDIR}"/${P}-custom-flags.patch
29         epatch "${FILESDIR}"/${P}-no-x11.patch
30 }
31
32 src_configure() {
33         econf \
34                 --enable-opt --enable-ldopt \
35                 $(use_enable X x11)
36 }
37
38 src_compile() {
39         emake CC="$(tc-getCC)"
40 }
41
42 src_install() {
43         # Config file
44         insinto /etc
45         newins "${S}/doc/example-spnavrc" spnavrc.sample
46
47         # Init script
48         newinitd "${FILESDIR}/spnavd" spacenavd
49         systemd_dounit "${FILESDIR}/spacenavd.service"
50
51         # Install udev rule but leave activiation to the user
52         # since Xorg may be configured to grab the device already
53         udev_newrules "${FILESDIR}"/99-space-navigator.rules-r1 99-space-navigator.rules.ignored
54
55         # Daemon
56         dobin "${S}/spacenavd"
57         use X && dobin "${S}/spnavd_ctl"
58 }
59
60 pkg_postinst() {
61         elog "To start the Spacenav daemon system-wide by default"
62         elog "you should add it to the default runlevel :"
63         elog "\`rc-update add spacenavd default\` (for openRC)"
64         elog "\`systemctl enable spacenavd\` (for systemd)"
65         elog
66         if use X; then
67                 elog "To start generating Spacenav X events by default"
68                 elog "you should add this command in your user startup"
69                 elog "scripts such as .gnomerc or .xinitrc :"
70                 elog "\`spnavd_ctl x11 start\`"
71                 elog
72         fi
73         elog
74         elog "If you want to auto-start the daemon when you plug in"
75         elog "a SpaceNavigator device, activate the related udev rule :"
76         elog "\`sudo ln -s $(get_udevdir)/rules.d/99-space-navigator.rules.ignored /etc/udev/rules.d\`"
77         ewarn "You must restart spnavd \`/etc/init.d/spacenavd restart\` to run"
78         ewarn "the new version of the daemon or \`systemctl restart spacenavd\`"
79         ewarn "if using systemd."
80 }