summaryrefslogtreecommitdiff
blob: db4615ca054577f060b510b1280d20c40836db05 (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
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-libs/libhid/libhid-0.2.16-r3.ebuild,v 1.2 2010/07/28 13:15:22 flameeyes Exp $

EAPI="2"

PYTHON_DEPEND="python? 2"

inherit autotools python

DESCRIPTION="Provides a generic and flexible way to access and interact with USB HID devices"
HOMEPAGE="http://libhid.alioth.debian.org/"
SRC_URI="http://beta.magicaltux.net/${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="debug doc python"

RDEPEND="virtual/libusb:0"
DEPEND="${RDEPEND}
	doc? ( app-doc/doxygen )
	python? ( dev-lang/swig )"

pkg_setup() {
	python_set_active_version 2
}

src_prepare() {
	# Respect LDFLAGS
	export OS_LDFLAGS="${LDFLAGS}"
	# Bug #260884
	sed -i -e 's/-Werror//' m4/md_conf_compiler.m4 || die
	eautoconf
}

src_configure() {
	local myconf

	myconf="${myconf} $(use_with doc doxygen)"
	myconf="${myconf} $(use_enable debug)"
	myconf="${myconf} $(use_enable python swig)"

	if use python; then
		# libhid includes its own python detection m4 from
		# http://autoconf-archive.cryp.to/ac_python_devel.html
		# As it seems to detect python in the wrong place, we'll force it by
		# passing the right environnement variables, only if we have the python
		# flag
		PYTHON_LDFLAGS="$(python-config --ldflags)" econf ${myconf} || die
	else
		# avoid libhid running swig if it finds it automatically as long as the
		# "python" use flag is not set
		econf ${myconf} || die
	fi
}

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

	dodoc AUTHORS ChangeLog NEWS README README.licence TODO || die
	if use doc; then
		dohtml -r doc/html/* || die
	fi
	#delete .la file. Bug #313841
	rm "${D}"/$(python_get_sitedir)/${PN}/_hid.la

}