summaryrefslogtreecommitdiff
blob: 151362c8601b19e3a3e38293c4c7ceeadb5b0856 (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
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-geosciences/gpsd/gpsd-2.39.ebuild,v 1.2 2009/07/28 03:22:29 nerdboy Exp $

inherit autotools eutils distutils flag-o-matic

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="~amd64 ~arm ~hppa ~ppc ~ppc64 ~sparc ~x86"

IUSE="dbus garmin minimal ntp ocean python tntc usb X"

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
	)
	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 )
	sys-libs/ncurses"

DEPEND="${RDEPEND}
	X? (
		x11-proto/xproto
		x11-proto/xextproto
	)
	!minimal? (
		dev-libs/libxslt
	)"

src_unpack() {
	unpack ${A}
	cd "${S}"
	# add -lm to setup.py again (see bug #250757)
	sed -i \
	    -e "s:, gpspacket_sources:, gpspacket_sources, libraries=['m']:g" \
	    -e "s:geoid.c\"]:geoid.c\"], libraries=['m']:g" \
	    setup.py || die "sed 1 failed"
	# fix Garmin text struct
	sed -i -e "s:RTCM2_PACKET;:RTCM2_PACKET,:g" \
	    drivers.c || die "sed 2 failed"
	# add missing include file (see bug #162361)
	sed -i -e "s:gps.h libgpsmm.h:gps.h libgpsmm.h gpsd_config.h:g" \
	    Makefile.am || die "sed 3 failed"

	eautoreconf
}

src_compile() {

	local my_conf="--enable-shared --with-pic --enable-static"
		# --enable-superstar2 is missing a header file

	use python && distutils_python_version

	if ! use ntp; then
		my_conf="${my_conf} --disable-pps --disable-ntpshm"
	fi

	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} \
		$(use_enable dbus) $(use_enable ocean oceanserver) \
		$(use_enable tntc tnt) $(use_enable python) \
		$(use_enable garmin garmintxt) || die "econf failed"
	else
		econf ${my_conf} $(use_enable dbus) $(use_enable tntc tnt) \
		$(use_enable ocean oceanserver) $(use_enable python) \
		$(use_enable garmin garmintxt) $(use_with X x) \
		|| die "econf failed"
	fi

	# still needs an explicit link flag (bug #250757)
	append-ldflags -Wl,-z,-defs -Wl,--no-undefined

	emake -j1 || die "emake failed"
}

src_install() {

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

	if ! test -x "${D}"usr/sbin/gpsd; then
	    ewarn "gpsd link error detected; please re-emerge gpsd."
	fi

	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

	use python && distutils_src_install

	dodoc INSTALL README TODO

	# add missing dgpsip-servers and capabilities files
	insinto /usr/share/${PN}
	doins dgpsip-servers gpscap.ini

	if use minimal; then
		doman gpsctl.1 gpsd.8 gps.1 cgps.1 gpxlogger.1 gpspipe.1
		use python && doman gpsprof.1
	else
		diropts "-m0644"
		dobin logextract
		use python && dobin striplog
	fi
}

pkg_postinst() {
	elog ""
	elog "This version of gpsd has broken support for the SuperStarII"
	elog "chipset which is currently disabled."
	elog ""
	elog "Other than the above, all default devices are enabled, and all"
	elog "optional devices and formats are controlled via USE flags."
	elog ""
	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 "Certain GPS devices also 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 ""
	elog "Please see this post about the new capabilities database:"
	elog ""
	elog "http://lists.berlios.de/pipermail/gpsd-dev/2009-January/006333.html"
	elog ""
	elog "on current hardware, adding new hardware, etc.  Read the above"
	elog "and the INSTALL doc for more information on supported hardware,"
	elog "and make sure udev has the right group permissions set on the"
	elog "devices if using USB (it should Do The Right Thing (TM))..."
	elog ""
}