summaryrefslogtreecommitdiff
blob: 989d498d1ce1c313a658c4cbf2708242818d6a6f (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
73
74
75
76
77
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=5

if [[ ${PV} == "9999" ]]; then
	EGIT_REPO_URI="git://github.com/abstrakraft/cwiid.git"
	SRC_URI=""
	KEYWORDS=""
	inherit git
else
	# git archive --prefix=cwiid-$(date +%Y%m%d)/ \
	#	--format=tar HEAD | bzip2 > cwiid-$(date +%Y%m%d).tar.bz2
	SRC_URI="https://dev.gentoo.org/~lxnay/cwiid/cwiid-${PV}.tar.bz2"
	KEYWORDS="~x86 ~amd64"
fi

PYTHON_COMPAT=( python2_7 )

inherit eutils linux-mod autotools python-single-r1

DESCRIPTION="Library, input driver, and utilities for the Nintendo Wiimote"
HOMEPAGE="http://abstrakraft.org/cwiid"

LICENSE="GPL-2"
SLOT="0"
IUSE="python"

DEPEND="virtual/awk
	sys-apps/sed
	sys-devel/bison
	>=sys-devel/flex-2.5.35
	virtual/pkgconfig
	python? ( ${PYTHON_DEPS} )"

RDEPEND="net-wireless/bluez
	x11-libs/gtk+:2
	python? ( ${PYTHON_DEPS} )"

REQUIRED_USE=${PYTHON_REQUIRED_USE}

pkg_setup() {
	CONFIG_CHECK="~BT_L2CAP ~INPUT_UINPUT"
	linux-mod_pkg_setup
	use python && python-single-r1_pkg_setup
}

src_unpack() {
	if [[ ${PV} == "9999" ]]; then
		git_src_unpack
	else
		unpack ${A}
	fi
}

src_prepare() {
	# Fix broken build system
	sed -i "s:--disable-ldconfig:--without-ldconfig:g" "${S}"/configure.ac || die
	sed -i "s:enable_ldconfig:with_ldconfig:g" "${S}"/configure.ac || die
	epatch "${FILESDIR}"/${P}-underlinking.patch
	eautoreconf
}
src_configure() {
	econf $(use_with python) --without-ldconfig || die "configure failed"
}

src_compile() {
	emake || die "emake failed"
}

src_install() {
	emake DESTDIR="${D}" install || die "emake install failed"
	dodoc AUTHORS ChangeLog NEWS README
	insinto /lib/udev/rules.d
	doins "${FILESDIR}/60-${PN}.rules"
}