summaryrefslogtreecommitdiff
blob: 287e5ef71fa7fb8d0a6d9fecac63031a804a97a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-misc/razertool/razertool-0.0.7.ebuild,v 1.4 2009/05/16 09:14:30 robbat2 Exp $

inherit eutils

DESCRIPTION="Unofficial tool for controlling the Razer Copperhead mouse"
HOMEPAGE="http://razertool.sourceforge.net/"
SRC_URI="mirror://sourceforge/${PN}/${P/-/_}.orig.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="gtk hal"

RDEPEND="=virtual/libusb-0*
	hal? ( >=sys-apps/hal-0.5.7 )
	gtk? (
		>=gnome-base/librsvg-2.0
		>=x11-libs/cairo-1.0.0
		>=x11-libs/gtk+-2.8.0 )"
DEPEND="${RDEPEND}
	dev-util/pkgconfig"

src_unpack() {
	unpack ${A}
	cd "${S}"

	sed -i razertool.rules.example \
		-e 's:ACTION=="add", ::' \
		|| die "sed razertool.rules.example action failed"

	if ! use hal ; then
		# plugdev group might not exist (created by hal)
		sed -i razertool.rules.example \
			-e 's:plugdev:root:' \
			|| die "sed razertool.rules.example plugdev failed"
	fi
}

src_compile() {
	econf $(use_enable gtk) || die "econf failed"
	emake || die "emake failed"
}

src_install() {
	emake DESTDIR="${D}" install || die "emake install failed"

	insinto /etc/udev/rules.d
	newins razertool.rules.example 90-razertool.rules \
		|| die "newins failed"

	dodoc AUTHORS ChangeLog NEWS README

	# Icon and desktop entry
	dosym /usr/share/${PN}/pixmaps/${PN}-icon.png /usr/share/pixmaps/${PN}-icon.png
	make_desktop_entry "razertool-gtk" "RazerTool" ${PN}-icon "GTK;Settings;HardwareSettings"
}

pkg_postinst() {
	elog "Razer Copperhead mice need firmware version 6.20 or higher"
	elog "to work properly. Running ${PN} on mice with older firmwares"
	elog "might lead to random USB-disconnects."
	if use hal ; then
		elog "To run as non-root, add yourself to the plugdev group:"
		elog "   gpasswd -a <user> plugdev"
	else
		elog "To run as non-root, adapt permissions/owner/group in:"
		elog "   /etc/udev/rules.d/90-razertool.rules"
	fi
	elog "Then unplug and plug in the mouse."
}