gpsd: update to newer version

This one won't run docbook tools, so won't try and hit the network.

BUG=chromium-os:31096
TEST=`emerge-amd64-generic gpsd` works
TEST=`emerge-arm-generic gpsd` works
TEST=`emerge-x86-generic gpsd` works
TEST=`cbuildbot {amd64,arm,x86}-generic-full` worked

Change-Id: I064eef07d26f3c1a2b27d3971cfef986c9d35ca1
Reviewed-on: https://gerrit.chromium.org/gerrit/24515
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/sci-geosciences/gpsd/Manifest b/sci-geosciences/gpsd/Manifest
index aceff56..8ccc2f1 100644
--- a/sci-geosciences/gpsd/Manifest
+++ b/sci-geosciences/gpsd/Manifest
@@ -1 +1 @@
-DIST gpsd-3.3.tar.gz 1401206 RMD160 73442e2bccac87a7ba4349ec63c443edbf05a131 SHA1 82a2ffe825c30c2152f2696221dbeeb82a4e9dd5 SHA256 1dbc1813f94f7f05fbf3341bf0154bae26903d1fb90c33b63d5458373ea931b9
+DIST gpsd-3.4.tar.gz 1422890 RMD160 f7cddc018b5b6834a097bbefbddb2b0a3844b203 SHA1 b942902479238f8a3eaa1955299d97461e93081a SHA256 79f7de9ead63c7f5d2c9a92e85b5f82e53323c4d451ef8e27ea265ac3ef9a70f
diff --git a/sci-geosciences/gpsd/files/gpsd-3.3-msocks-init.patch b/sci-geosciences/gpsd/files/gpsd-3.3-msocks-init.patch
deleted file mode 100644
index 6b06864..0000000
--- a/sci-geosciences/gpsd/files/gpsd-3.3-msocks-init.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-fix from upstream git repo
-
-From e3d7f8b3f35442ae71dc95d776c900d2c29b215c Mon Sep 17 00:00:00 2001
-From: Yufeng Shen <miletus@chromium.org>
-Date: Tue, 15 Nov 2011 17:29:49 -0500
-Subject: [PATCH] Initialize msocks[2] to -1
-
-When SOCKET_EXPORT_ENABLE is not defined, msocks[2] can reach the
-point where it is used (put into all_fds to be monitored by select()),
-without initilization.
-
-Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
----
- gpsd.c |    3 ++-
- 1 files changed, 2 insertions(+), 1 deletions(-)
-
-diff --git a/gpsd.c b/gpsd.c
-index 2d4090f..d342f5a 100644
---- a/gpsd.c
-+++ b/gpsd.c
-@@ -1762,7 +1762,8 @@ int main(int argc, char *argv[])
-     static char *pid_file = NULL;
-     struct gps_device_t *device;
-     fd_set rfds;
--    int i, option, msocks[2], dfd;
-+    int i, option, dfd;
-+    int msocks[2] = {-1, -1};
-     bool go_background = true;
-     struct timeval tv;
-     const struct gps_type_t **dp;
--- 
-1.7.6.1
-
diff --git a/sci-geosciences/gpsd/files/gpsd-3.3-pkg-config.patch b/sci-geosciences/gpsd/files/gpsd-3.3-pkg-config.patch
deleted file mode 100644
index 0bb4b3c..0000000
--- a/sci-geosciences/gpsd/files/gpsd-3.3-pkg-config.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From b6ef265b49d973acc2295f46f0518e0644ba7dbb Mon Sep 17 00:00:00 2001
-From: Mike Frysinger <vapier@gentoo.org>
-Date: Mon, 21 Nov 2011 16:05:27 -0500
-Subject: [PATCH] respect PKG_CONFIG in the build env
-
-Signed-off-by: Mike Frysinger <vapier@gentoo.org>
----
- SConstruct |    9 +++++----
- 1 files changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/SConstruct b/SConstruct
-index cb578fe..5bb0fed 100644
---- a/SConstruct
-+++ b/SConstruct
-@@ -214,8 +214,9 @@ env['PYTHON'] = sys.executable
- # explicitly quote them or (better yet) use the "=" form of GNU option
- # settings.
- env['STRIP'] = "strip"
-+env['PKG_CONFIG'] = "pkg-config"
- env['CHRPATH'] = 'chrpath'
--for i in ["AR", "ARFLAGS", "CCFLAGS", "CFLAGS", "CC", "CXX", "CXXFLAGS", "STRIP", "CHRPATH", "LD", "TAR"]:
-+for i in ["AR", "ARFLAGS", "CCFLAGS", "CFLAGS", "CC", "CXX", "CXXFLAGS", "STRIP", "PKG_CONFIG", "CHRPATH", "LD", "TAR"]:
-     if os.environ.has_key(i):
-         j = i
-         if i == "LD":
-@@ -407,9 +408,9 @@ cxx = config.CheckCXX()
- # define a helper function for pkg-config - we need to pass
- # --static for static linking, too.
- if env["shared"]:
--    pkg_config = lambda pkg: ['!pkg-config --cflags --libs %s' %(pkg, )]
-+    pkg_config = lambda pkg: ['!%s --cflags --libs %s' %(env['PKG_CONFIG'], pkg, )]
- else:
--    pkg_config = lambda pkg: ['!pkg-config --cflags --libs --static %s' %(pkg, )]
-+    pkg_config = lambda pkg: ['!%s --cflags --libs --static %s' %(env['PKG_CONFIG'], pkg, )]
- 
- # GCC isn't always named gcc, alas.
- if env['CC'] == 'gcc' or (sys.platform.startswith('freebsd') and env['CC'] == 'cc'):
-@@ -339,7 +340,7 @@ if "help" in ARGLIST:
- 
- def CheckPKG(context, name):
-     context.Message( 'Checking for %s... ' % name )
--    ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0]
-+    ret = context.TryAction('%s --exists \'%s\'' % (env['PKG_CONFIG'], name))[0]
-     context.Result( ret )
-     return ret
- 
--- 
-1.7.6.1
-
diff --git a/sci-geosciences/gpsd/files/gpsd-3.3-release-rev.patch b/sci-geosciences/gpsd/files/gpsd-3.3-release-rev.patch
deleted file mode 100644
index 2941559..0000000
--- a/sci-geosciences/gpsd/files/gpsd-3.3-release-rev.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-taken from upstream repo & tweaked; drop with 3.4 release
-
-From c96ffb7733b56a8c5c20d473d8fd83b62b6abfde Mon Sep 17 00:00:00 2001
-From: Bernd Zeimetz <bernd@bzed.de>
-Date: Thu, 10 Nov 2011 22:18:07 +0100
-Subject: [PATCH] SConstruct: Use gpsd_version as revision for releases.
-
----
- SConstruct |   13 ++++++++-----
- 1 files changed, 8 insertions(+), 5 deletions(-)
-
-diff --git a/SConstruct b/SConstruct
-index d367403..3d95e7e 100644
---- a/SConstruct
-+++ b/SConstruct
-@@ -978,12 +978,15 @@ env.Command(target="ais_json.i", source="jsongen.py", action='''\
-     chmod a-w $TARGET''')
- 
- # generate revision.h
--(st, rev) = commands.getstatusoutput('git describe')
--if st != 0:
--    from datetime import datetime
--    rev = datetime.now().isoformat()[:-4]
-+if 'dev' in gpsd_version:
-+    (st, rev) = commands.getstatusoutput('git describe')
-+    if st != 0:
-+        from datetime import datetime
-+        rev = datetime.now().isoformat()[:-4]
-+else:
-+    rev = gpsd_version
- revision='#define REVISION "%s"\n' %(rev.strip(),)
--env.NoClean(env.Textfile(target="revision.h", source=[revision]))
-+env.Textfile(target="revision.h", source=[revision])
- 
- # generate pps_pin.h
- pps_pin = env['pps_pin']
--- 
-1.7.6.1
-
diff --git a/sci-geosciences/gpsd/files/gpsd-3.3-setup.py b/sci-geosciences/gpsd/files/gpsd-3.3-setup.py
deleted file mode 100644
index 93cc5e8..0000000
--- a/sci-geosciences/gpsd/files/gpsd-3.3-setup.py
+++ /dev/null
@@ -1,17 +0,0 @@
-from distutils.core import setup, Extension
-
-setup(
-	name = "gps",
-	version = @VERSION@,
-	description = 'Python libraries for the gpsd service daemon',
-	url = @URL@,
-	author = 'the GPSD project',
-	author_email = @EMAIL@,
-	license = "BSD",
-	ext_modules=[
-		Extension("gps.packet", @GPS_PACKET_SOURCES@, include_dirs=["."]),
-		Extension("gps.clienthelpers", @GPS_CLIENT_SOURCES@, include_dirs=["."]),
-	],
-	packages = ['gps'],
-	scripts = @SCRIPTS@,
-)
diff --git a/sci-geosciences/gpsd/files/gpsd-3.3-udev-install.patch b/sci-geosciences/gpsd/files/gpsd-3.3-udev-install.patch
deleted file mode 100644
index ef000bc..0000000
--- a/sci-geosciences/gpsd/files/gpsd-3.3-udev-install.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From b0513cd2e44705058ffdaa7a9c3f32371e9fcd5b Mon Sep 17 00:00:00 2001
-From: Mike Frysinger <vapier@gentoo.org>
-Date: Thu, 17 Nov 2011 23:44:06 -0500
-Subject: [PATCH] use DESTDIR with udev install
-
-Signed-off-by: Mike Frysinger <vapier@gentoo.org>
----
- SConstruct |    7 ++++---
- 1 files changed, 4 insertions(+), 3 deletions(-)
-
-diff --git a/SConstruct b/SConstruct
-index 1f99740..b7a98e4 100644
---- a/SConstruct
-+++ b/SConstruct
-@@ -1505,9 +1505,10 @@ if env['python']:
- # is plugged in.
- 
- Utility('udev-install', '', [
--    'cp $SRCDIR/gpsd.rules /lib/udev/rules.d/25-gpsd.rules',
--    'cp $SRCDIR/gpsd.hotplug /lib/udev/',
--    'chmod a+x /lib/udev/gpsd.hotplug',
-+    'mkdir -p ' + DESTDIR + '/lib/udev/rules.d',
-+    'cp $SRCDIR/gpsd.rules ' + DESTDIR + '/lib/udev/rules.d/25-gpsd.rules',
-+    'cp $SRCDIR/gpsd.hotplug ' + DESTDIR + '/lib/udev/',
-+    'chmod a+x ' + DESTDIR + '/lib/udev/gpsd.hotplug',
-         ])
- 
- Utility('udev-uninstall', '', [
--- 
-1.7.6.1
-
diff --git a/sci-geosciences/gpsd/files/gpsd-3.4-always-install-man-pages.patch b/sci-geosciences/gpsd/files/gpsd-3.4-always-install-man-pages.patch
new file mode 100644
index 0000000..c9c1c7d
--- /dev/null
+++ b/sci-geosciences/gpsd/files/gpsd-3.4-always-install-man-pages.patch
@@ -0,0 +1,36 @@
+From 918d6d8e5bac3981126cb01e673430cb7c96ec02 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Thu, 9 Feb 2012 16:51:24 -0500
+Subject: [PATCH] always install the man pages
+
+Since we maintain local copies, don't require xmlto/xsltproc in
+order to install them.  This makes packaging simpler.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ SConstruct |    9 ++++-----
+ 1 files changed, 4 insertions(+), 5 deletions(-)
+
+diff --git a/SConstruct b/SConstruct
+index ab85b7d..fb08779 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -1186,11 +1186,10 @@ if qt_env:
+ 
+ 
+ maninstall = []
+-if manbuilder:
+-    for manpage in base_manpages.keys() + python_manpages.keys():
+-        section = manpage.split(".")[1]
+-        dest = os.path.join(installdir('mandir'), "man"+section, manpage)
+-        maninstall.append(env.InstallAs(source=manpage, target=dest))
++for manpage in base_manpages.keys() + python_manpages.keys():
++    section = manpage.split(".")[1]
++    dest = os.path.join(installdir('mandir'), "man"+section, manpage)
++    maninstall.append(env.InstallAs(source=manpage, target=dest))
+ install = env.Alias('install', binaryinstall + maninstall + python_install + pc_install + headerinstall)
+ 
+ def Uninstall(nodes):
+-- 
+1.7.8.4
+
diff --git a/sci-geosciences/gpsd/files/gpsd-3.4-cfgetispeed.patch b/sci-geosciences/gpsd/files/gpsd-3.4-cfgetispeed.patch
new file mode 100644
index 0000000..02abcb0
--- /dev/null
+++ b/sci-geosciences/gpsd/files/gpsd-3.4-cfgetispeed.patch
@@ -0,0 +1,47 @@
+From 38702bf0f4aaafdddde51393106eeaf720c1fc63 Mon Sep 17 00:00:00 2001
+From: Manuel Lauss <manuel.lauss@googlemail.com>
+Date: Fri, 13 Jan 2012 11:59:55 -0500
+Subject: [PATCH] serial: use cfgetispeed helpers
+
+Rather than poking c_ispeed directly, use the cfgetispeed helper.  This
+is part of POSIX, and we already use cfsetispeed, so there shouldn't be
+any portability issues here.
+
+Signed-off-by: Manuel Lauss <manuel.lauss@googlemail.com>
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ serial.c |    9 +--------
+ 1 files changed, 1 insertions(+), 8 deletions(-)
+
+diff --git a/serial.c b/serial.c
+index c1464dd..8eb03ce 100644
+--- a/serial.c
++++ b/serial.c
+@@ -594,13 +594,8 @@ void gpsd_close(struct gps_device_t *session)
+ 	 * them the first time.  Economical, and avoids tripping over an
+ 	 * obscure Linux 2.6 kernel bug that disables threaded
+ 	 * ioctl(TIOCMWAIT) on a device after tcsetattr() is called.
+-         *
+-         * Unfortunately the termios struct doesn't have c_ispeed/c_ospeed
+-         * on all architectures. Its missing on sparc, mips/mispel and hurd-i386 at least.
+ 	 */
+-#if defined(_HAVE_STRUCT_TERMIOS_C_ISPEED)
+-	if (session->ttyset_old.c_ispeed != session->ttyset.c_ispeed || (session->ttyset_old.c_cflag & CSTOPB) != (session->ttyset.c_cflag & CSTOPB)) {
+-#endif
++	if (cfgetispeed(&session->ttyset_old) != cfgetispeed(&session->ttyset) || (session->ttyset_old.c_cflag & CSTOPB) != (session->ttyset.c_cflag & CSTOPB)) {
+ 	    /*@ ignore @*/
+ 	    (void)cfsetispeed(&session->ttyset_old,
+ 			      (speed_t) session->gpsdata.dev.baudrate);
+@@ -609,9 +604,7 @@ void gpsd_close(struct gps_device_t *session)
+ 	    /*@ end @*/
+ 	    (void)tcsetattr(session->gpsdata.gps_fd, TCSANOW,
+ 			    &session->ttyset_old);
+-#if defined(_HAVE_STRUCT_TERMIOS_C_ISPEED)
+ 	}
+-#endif
+ 	gpsd_report(LOG_SPIN, "close(%d) in gpsd_close(%s)\n",
+ 		    session->gpsdata.gps_fd, session->gpsdata.dev.path);
+ 	(void)close(session->gpsdata.gps_fd);
+-- 
+1.7.8.3
+
diff --git a/sci-geosciences/gpsd/files/gpsd-3.4-chrpath.patch b/sci-geosciences/gpsd/files/gpsd-3.4-chrpath.patch
new file mode 100644
index 0000000..c509e2d
--- /dev/null
+++ b/sci-geosciences/gpsd/files/gpsd-3.4-chrpath.patch
@@ -0,0 +1,69 @@
+From 63a44d0cb5494ed1078de411b55cb1c9a8307cec Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Fri, 18 Nov 2011 19:09:27 -0500
+Subject: [PATCH] make chrpath optional
+
+There's no reason to require chrpath for distributions who only want to
+compile locally and then install elsewhere for packaging.  So allow them
+to specify CHRPATH='' via the env to disable this requirement.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ SConstruct |   27 ++++++++++++++-------------
+ 1 files changed, 14 insertions(+), 13 deletions(-)
+
+diff --git a/SConstruct b/SConstruct
+index ccaca7d..68bf367 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -270,7 +270,7 @@ def installdir(dir, add_destdir=True):
+ 
+ # Honor the specified installation prefix in link paths.
+ env.Prepend(LIBPATH=[installdir('libdir')])
+-if env["shared"]:
++if env["shared"] and env['CHRPATH']:
+     env.Prepend(RPATH=[installdir('libdir')])
+ 
+ # Give deheader a way to set compiler flags
+@@ -390,17 +390,18 @@ config = Configure(env, custom_tests = { 'CheckPKG' : CheckPKG,
+                                          'CheckXsltproc' : CheckXsltproc})
+ 
+ env.Prepend(LIBPATH=[os.path.realpath(os.curdir)])
+-if config.CheckExecutable('$CHRPATH -v', 'chrpath'):
+-    # Tell generated binaries to look in the current directory for
+-    # shared libraries so we can run tests without hassle. Should be
+-    # handled sanely by scons on all systems.  Not good to use '.' or
+-    # a relative path here; it's a security risk.  At install time we
+-    # use chrpath to edit this out of RPATH.
+-    if env["shared"]:
+-        env.Prepend(RPATH=[os.path.realpath(os.curdir)])
+-else:
+-    print "chrpath is not available, forcing static linking."
+-    env["shared"] = False
++if env['CHRPATH']:
++    if config.CheckExecutable('$CHRPATH -v', 'chrpath'):
++        # Tell generated binaries to look in the current directory for
++        # shared libraries so we can run tests without hassle. Should be
++        # handled sanely by scons on all systems.  Not good to use '.' or
++        # a relative path here; it's a security risk.  At install time we
++        # use chrpath to edit this out of RPATH.
++        if env["shared"]:
++            env.Prepend(RPATH=[os.path.realpath(os.curdir)])
++    else:
++        print "chrpath is not available, forcing static linking."
++        env["shared"] = False
+ 
+ confdefs = ["/* gpsd_config.h.  Generated by scons, do not hand-hack.  */\n"]
+ 
+@@ -1140,7 +1141,7 @@ if qt_env:
+     binaryinstall.append(LibraryInstall(qt_env, installdir('libdir'), compiled_qgpsmmlib))
+ 
+ # We don't use installdir here in order to avoid having DESTDIR affect the rpath
+-if env["shared"]:
++if env['CHRPATH']:
+     env.AddPostAction(binaryinstall, '$CHRPATH -r "%s" "$TARGET"' \
+                       % (installdir('libdir', False), ))
+ 
+-- 
+1.7.8.3
+
diff --git a/sci-geosciences/gpsd/files/gpsd-3.4-gpsmon-lm.patch b/sci-geosciences/gpsd/files/gpsd-3.4-gpsmon-lm.patch
new file mode 100644
index 0000000..a749fcf
--- /dev/null
+++ b/sci-geosciences/gpsd/files/gpsd-3.4-gpsmon-lm.patch
@@ -0,0 +1,29 @@
+From 55131187b6a0290f99d1dd70b5cce48040bba7bb Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Fri, 13 Jan 2012 11:53:39 -0500
+Subject: [PATCH] gpsmon: always link with -lm
+
+Since the gpsmon pkg uses math funcs itself (and not just via libgps),
+we need to link in -lm for the app.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ SConstruct |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/SConstruct b/SConstruct
+index 68bf367..a5249c1 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -851,7 +851,7 @@ gpsdctl = env.Program('gpsdctl', ['gpsdctl.c'], parse_flags=gpslibs)
+ env.Depends(gpsdctl, compiled_gpslib)
+ 
+ gpsmon = env.Program('gpsmon', gpsmon_sources,
+-                     parse_flags=gpsdlibs + ncurseslibs)
++                     parse_flags=gpsdlibs + ncurseslibs + ['-lm'])
+ env.Depends(gpsmon, [compiled_gpsdlib, compiled_gpslib])
+ 
+ gpspipe = env.Program('gpspipe', ['gpspipe.c'], parse_flags=gpslibs)
+-- 
+1.7.8.3
+
diff --git a/sci-geosciences/gpsd/files/gpsd-3.4-no-man-gen.patch b/sci-geosciences/gpsd/files/gpsd-3.4-no-man-gen.patch
new file mode 100644
index 0000000..20a3b70
--- /dev/null
+++ b/sci-geosciences/gpsd/files/gpsd-3.4-no-man-gen.patch
@@ -0,0 +1,13 @@
+the scons logic is dumb and will always regenerate the man pages.
+forcibly disable that as the releases contain the man pages.
+
+--- a/SConstruct
++++ b/SConstruct
+@@ -575,6 +575,7 @@
+     manbuilder = "xmlto man $SOURCE; mv `basename $TARGET` $TARGET"
+ else:
+     announce("Neither xsltproc nor xmlto found, documentation cannot be built.")
++manbuilder = htmlbuilder = False
+ if manbuilder:
+     env['BUILDERS']["Man"] = Builder(action=manbuilder)
+     env['BUILDERS']["HTML"] = Builder(action=htmlbuilder,
diff --git a/sci-geosciences/gpsd/files/gpsd-3.4-strptime.patch b/sci-geosciences/gpsd/files/gpsd-3.4-strptime.patch
new file mode 100644
index 0000000..50a2b27
--- /dev/null
+++ b/sci-geosciences/gpsd/files/gpsd-3.4-strptime.patch
@@ -0,0 +1,26 @@
+From 083ee79e5b6acbd08008965cbca496eb61957fa4 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Fri, 13 Jan 2012 11:56:12 -0500
+Subject: [PATCH] fix missing strptime prototype
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ gpsutils.c |    2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+diff --git a/gpsutils.c b/gpsutils.c
+index a1530ec..cc47d52 100644
+--- a/gpsutils.c
++++ b/gpsutils.c
+@@ -3,6 +3,8 @@
+  * This file is Copyright (c) 2010 by the GPSD project
+  * BSD terms apply: see the file COPYING in the distribution root for details.
+  */
++#define _XOPEN_SOURCE 700
++
+ #include <stdio.h>
+ #include <time.h>
+ #include <sys/time.h>
+-- 
+1.7.8.3
+
diff --git a/sci-geosciences/gpsd/gpsd-3.3-r1.ebuild b/sci-geosciences/gpsd/gpsd-3.4.ebuild
similarity index 80%
rename from sci-geosciences/gpsd/gpsd-3.3-r1.ebuild
rename to sci-geosciences/gpsd/gpsd-3.4.ebuild
index adbc649..485e11e 100644
--- a/sci-geosciences/gpsd/gpsd-3.3-r1.ebuild
+++ b/sci-geosciences/gpsd/gpsd-3.4.ebuild
@@ -1,6 +1,6 @@
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sci-geosciences/gpsd/gpsd-3.3-r1.ebuild,v 1.3 2011/12/07 16:17:42 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/sci-geosciences/gpsd/gpsd-3.4.ebuild,v 1.3 2012/05/21 22:36:22 vapier Exp $
 
 EAPI="4"
 
@@ -11,13 +11,19 @@
 
 inherit eutils user multilib distutils scons-utils toolchain-funcs
 
+if [[ ${PV} == "9999" ]] ; then
+	EGIT_REPO_URI="git://git.savannah.nongnu.org/gpsd.git"
+	inherit git-2
+else
+	SRC_URI="mirror://nongnu/${PN}/${P}.tar.gz"
+	KEYWORDS="amd64 arm ppc ppc64 x86"
+fi
+
 DESCRIPTION="GPS daemon and library to support USB/serial GPS devices and various GPS/mapping clients"
 HOMEPAGE="http://catb.org/gpsd/"
-SRC_URI="mirror://nongnu/${PN}/${P}.tar.gz"
 
 LICENSE="BSD"
 SLOT="0"
-KEYWORDS="amd64 arm ~ppc ~ppc64 x86"
 
 GPSD_PROTOCOLS=(
 	ashtech aivdm clientdebug earthmate evermore fv18 garmin
@@ -39,27 +45,32 @@
 	)
 	ntp? ( net-misc/ntp )
 	qt4? ( x11-libs/qt-gui )"
-# xml packages are for man page generation
 DEPEND="${RDEPEND}
-	app-text/xmlto
-	=app-text/docbook-xml-dtd-4.1*
 	test? ( sys-devel/bc )"
 
+# xml packages are for man page generation
+if [[ ${PV} == "9999" ]] ; then
+	DEPEND+="
+		app-text/xmlto
+		=app-text/docbook-xml-dtd-4.1*"
+fi
+
 pkg_setup() {
 	use python && python_pkg_setup
 }
 
 src_prepare() {
-	epatch "${FILESDIR}"/${P}-release-rev.patch
-	epatch "${FILESDIR}"/${P}-udev-install.patch
-	epatch "${FILESDIR}"/${P}-pkg-config.patch
-	epatch "${FILESDIR}"/${P}-ldflags.patch
-	epatch "${FILESDIR}"/${P}-msocks-init.patch
+	epatch "${FILESDIR}"/${PN}-3.3-ldflags.patch
+	epatch "${FILESDIR}"/${PN}-3.4-cfgetispeed.patch #393515
+	epatch "${FILESDIR}"/${PN}-3.4-gpsmon-lm.patch
+	epatch "${FILESDIR}"/${PN}-3.4-strptime.patch
+	epatch "${FILESDIR}"/${PN}-3.4-chrpath.patch
+	epatch "${FILESDIR}"/${PN}-3.4-always-install-man-pages.patch
+	epatch "${FILESDIR}"/${PN}-3.4-no-man-gen.patch
 
 	# Avoid useless -L paths to the install dir
 	sed -i \
-		-e '/env.Prepend.*LIBPATH=.*installdir/s:env.*:pass:' \
-		-e '/env.Prepend.*RPATH=/s:env.*:pass:' \
+		-e '/^env.Prepend(LIBPATH=.installdir(.libdir.).)$/d' \
 		-e 's:\<STAGING_PREFIX\>:SYSROOT:g' \
 		SConstruct || die
 
@@ -113,7 +124,7 @@
 }
 
 src_compile() {
-	export CHRPATH=true
+	export CHRPATH=
 	tc-export CC CXX PKG_CONFIG
 	export SHLINKFLAGS=${LDFLAGS} LINKFLAGS=${LDFLAGS}
 	escons