aboutsummaryrefslogtreecommitdiff
blob: a7a52624b599613abf3d666709df9a214eb12113 (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-geosciences/gpsd/gpsd-2.37.ebuild,v 1.4 2008/12/21 17:56:11 nerdboy Exp $

inherit eutils distutils autotools

DESCRIPTION="GPS daemon and library to support USB/serial GPS devices and various GPS/mapping clients."
HOMEPAGE="http://gpsd.berlios.de/"
SRC_URI="mirror://berlios/gpsd/${P}.tar.gz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~arm ~amd64 ~ppc ~ppc64 ~sparc ~x86"

IUSE="dbus italk itrax minimal ntp python usb X"
# tnt support is broken in this version - add tntc back when fixed

RDEPEND="X? (
		x11-libs/libXmu
		x11-libs/libXext
		x11-libs/libXp
		x11-libs/libX11
		x11-libs/libXt
		x11-libs/libSM
		x11-libs/libICE
		x11-libs/libXpm
		x11-libs/libXaw
		x11-libs/openmotif
	)
	python? ( dev-lang/python )

	dbus? ( >=sys-apps/dbus-0.94
		>=dev-libs/glib-2.6
		dev-libs/dbus-glib )
	ntp? ( net-misc/ntp )
	usb? ( virtual/dev-manager )"

DEPEND="X? (
		x11-proto/xproto
		x11-proto/xextproto
	)
	!minimal? (
		dev-libs/libxslt
		sys-libs/ncurses
	)"

src_unpack() {
	unpack ${A}
	cd "${S}"
	sed -i -e \
	    "s:gpspacket\", extension_source)]:gpspacket\", extension_source, libraries=['m'])]:g" \
	    setup.py || die "sed failed"

	# Autotoolize pkg-config for better cross-compiling support
	epatch "${FILESDIR}/${P}-autotoolize-pkg-config.patch"

	# We need to reconfigure the whole thing because of the
	# patch above
	touch NEWS
	touch Changelog
	eautoreconf || die "Autoreconfiguration failed"
}

src_compile() {

	local my_conf=""

	use python && distutils_python_version

	myconf="${myconf}
		$(use_enable ntp  ntpshm) \
		$(use_enable ntp  pps)    \
		$(use_enable dbus)        \
		$(use_enable italk)       \
		$(use_enable itrax)       \
		$(use_enable python)      \
		--enable-shared           \
		--with-pic                \
		--enable-static"
	
	# Garmin support is broken in this version
	myconf="${myconf} --disable-garmin --disable-garmintxt"

	# Support for the TNT digital compass is currently broken
	# $(use_enable tntc tnt)

	if use minimal; then
		local max_clients="5"
		local max_devices="2"

		my_conf="${my_conf}       \
			 --enable-squelch \
			 --without-x      \
			 --enable-max-devices=${max_devices} \
			 --enable-max-clients=${max_clients}"

		WITH_XSLTPROC=no WITH_XMLTO=no econf ${my_conf} || die "econf failed"
	else
		my_conf="${my_conf} \
			 $(use_with X x)"
		
		econf ${my_conf} || die "econf failed"
	fi

	# still needs an explicit linkage with the math lib (bug #250757)
	append-ldflags -lm

	emake || die "emake failed"
}

src_install() {

	make DESTDIR="${D}" install || die "make install failed"

	if use usb ; then
		insinto /etc/hotplug/usb
		doins gpsd.usermap
		exeinto /etc/hotplug/usb
		doexe gpsd.hotplug
		insinto /etc/udev/rules.d
		doins "${FILESDIR}"/99-gpsd-usb.rules
		keepdir /var/run/usb # needed for REMOVER
	else
		newconfd "${FILESDIR}"/gpsd.conf gpsd
		newinitd "${FILESDIR}"/gpsd.init gpsd
	fi

	if use X && ! use minimal ; then
		insinto /etc/X11/app-defaults
		newins xgps.ad Xgps
		newins xgpsspeed.ad Xgpsspeed
	else
		rm "${D}usr/share/man/man1/xgpsspeed.1.bz2" \
		"${D}usr/share/man/man1/xgps.1.bz2"
	fi

	diropts "-m0644"
	dobin logextract

	if use python ; then
		exeinto /usr/$(get_libdir)/python${PYVER}/site-packages
		doexe gps.py gpsfake.py gpspacket.so
	fi

	if use minimal; then
		doman gpsctl.1 gpsflash.1 gpspipe.1 gpsd.8 gps.1
		use python && doman gpsprof.1 gpsfake.1 gpscat.1
	fi

	dodoc INSTALL README TODO

	# add missing include file (see bug #162361)
	insinto /usr/include
	doins gpsd_config.h
}

pkg_postinst() {
	elog ""
	elog "This version of gpsd has broken the support for the TNT compass"
	elog "and Garmin so they are disabled.  If you need it, stay with the"
	elog "previous version for now.  The minimal flag now removes X and"
	elog "enables the embedded device (ie, small footprint) support, but"
	elog "you'll need to modify the ebuild if you need to change either"
	elog "the number of clients or the number of devices.  Although pps"
	elog "is enabled, it still needs the correct kernel patches.  All"
	elog "recent versions of udev (>=udev-115 or so) should have correct"
	elog "usb device detection and startup of gpsd (ie, without hotplug)."
	elog ""
	elog "Different GPS devices require the corresponding kernel options"
	elog "to be enabled, such as USB_SERIAL_GARMIN, or a USB serial driver"
	elog "for an adapter such as those that come with Deluo GPS units (eg,"
	elog "USB_SERIAL_PL2303). Straight serial devices should always work,"
	elog "even without udev/hotplug support."
	elog ""
	elog "Note: the supplied gpsd udev rules are now device-specific, so"
	elog "if your device isn't detected correctly, please use lsusb or"
	elog "another suitable tool to determine the proper device IDs and"
	elog "use the commented rules to fill in the blanks for your device."
	elog "Please file a bug to get your device added to the list."
	elog ""
	elog "Read the INSTALL doc for more information on supported hardware,"
	elog "and make sure udev has the right group permissions set on the tty"
	elog "devices if using USB (it should Do The Right Thing (TM))..."
	elog ""
}