gpsd: update to version 3.5 from cerowrt + chrpath removal patch
gpsd: update to version 3.5 from cerowrt + chrpath removal patch

git-svn-id: svn://svn.openwrt.org/openwrt/packages@31621 3c298f89-4303-0410-b956-a3cf2f4a3e73

--- a/net/gpsd/Makefile
+++ b/net/gpsd/Makefile
@@ -8,54 +8,123 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=gpsd
-PKG_VERSION:=2.94
-PKG_RELEASE:=4
+PKG_REV:=ffcc14068ada0d565f237efa56c7cd723847ca04
+PKG_VERSION:=3.5-20120414
+#PKG_VERSION:=20110917
+PKG_RELEASE:=5
 
+#PKG_SOURCE_URL:=http://download-mirror.savannah.gnu.org/releases/gpsd/
+#PKG_MD5SUM:=c01353459faa68834309109d4e868460
+
+#PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=git://git.sv.gnu.org/gpsd.git
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=$(PKG_REV)
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://download.berlios.de/gpsd/
-PKG_MD5SUM:=ce70bcd707ac1df861d4c72f503c09d1
-
-PKG_INSTALL:=1
-PKG_FIXUP:=libtool
-PKG_REMOVE_FILES:=aclocal.m4 ltmain.sh
 
 PKG_BUILD_DEPENDS:=libncurses
 
 include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/scons.mk
+
+define Package/gpsd/Default
+  DEPENDS:=+librt
+  URL:=http://catb.org/gpsd/
+endef
+
+define Package/gpsd/Default/description
+  gpsd is a userland daemon acting as a translator between GPS and AIS receivers
+  and their clients. gpsd listens on port 2947 for clients requesting
+  position/time/velocity information.  The receivers are expected to generate
+  position information in a well-known format -- as NMEA-0183 sentences, SiRF
+  binary, Rockwell binary, Garmin binary format, or other vendor binary
+  protocols.  gpsd takes this information from the GPS and translates it into
+  something uniform and easier to understand for clients.
+endef
 
 define Package/gpsd
+  $(call Package/gpsd/Default)
   SECTION:=net
   CATEGORY:=Network
-  DEPENDS:=+libpthread +librt +libusb-1.0
+  DEPENDS+= +libgps +libgpsd
   TITLE:=An interface daemon for GPS receivers
-  URL:=http://gpsd.berlios.de/
 endef
 
-CONFIGURE_CMD =./autogen.sh
+define Package/gpsd/conffiles
+/etc/config/gpsd
+endef
 
-CONFIGURE_ARGS += \
-        --disable-dbus \
-        --disable-tsip \
-        --disable-fv18 \
-        --disable-tripmate \
-        --disable-earthmate \
-        --disable-itrax \
-        --disable-navcom \
-        --disable-ubx \
-        --disable-evermore \
-        --disable-ntrip \
-	--disable-libgpsmm \
-        --without-x \
+define Package/gpsd/description
+  $(call Package/gpsd/Default/description)
+  This package contains the GPS daemon.
+endef
 
-EXTRA_CFLAGS:=-I$(STAGING_DIR)/usr/include/libusb-1.0
+define Package/cgps
+  $(call Package/gpsd/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS+= +libgps +libncurses
+  TITLE:=Test client for gpsd
+endef
 
-EXTRA_LDFLAGS:=-lusb-1.0
+define Package/cgps/description
+  $(call Package/gpsd/Default/description)
+  This package contains a GPS test client.
+endef
+
+define Package/libgps
+  $(call Package/gpsd/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=C service library for communicating with the GPS daemon
+endef
+
+define Package/libgps/description
+  $(call Package/gpsd/Default/description)
+  This package contains the libgps library.
+endef
+
+define Package/libgpsd
+  $(call Package/gpsd/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=C service library for GPS applications
+endef
+
+define Package/libgpsd/description
+  $(call Package/gpsd/Default/description)
+  This package contains the libgpsd library.
+endef
+
+SCONS_OPTIONS += \
+	dbus_export=no \
+	tsip=no \
+	fv18=no \
+	tripmate=no \
+	earthmate=no \
+	itrax=no \
+	navcom=no \
+	ubx=no \
+	evermore=no \
+	ntrip=no \
+	libgpsmm=no \
+	libQgpsmm=no \
+	bluez=no \
+	strip=no \
+	python=no \
+	usb=no \
+	implicit_link=no
 
 define Build/InstallDev
 	$(INSTALL_DIR) $(1)/usr/include
 	$(CP) $(PKG_INSTALL_DIR)/usr/include/gps.h $(1)/usr/include/
 	$(INSTALL_DIR) $(1)/usr/lib
-	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libgps*.{a,so*} $(1)/usr/lib/
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libgps*.so* $(1)/usr/lib/
+	$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+	$(CP) \
+		$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libgps*.pc \
+		$(1)/usr/lib/pkgconfig/
 endef
 
 define Package/gpsd/install
@@ -65,15 +134,27 @@
 	$(INSTALL_BIN) ./files/gpsd.init $(1)/etc/init.d/gpsd
 	$(INSTALL_DIR) $(1)/etc/hotplug.d/usb
 	$(INSTALL_DATA) ./files/gpsd.hotplug $(1)/etc/hotplug.d/usb/20-gpsd
-	$(INSTALL_DIR) $(1)/usr/lib
-	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libgps*.so* $(1)/usr/lib/
 	$(INSTALL_DIR) $(1)/usr/sbin
 	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/gpsd $(1)/usr/sbin/
 endef
 
-define Package/gpsd/conffiles
-/etc/config/gpsd
+define Package/cgps/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/cgps $(1)/usr/bin/
+endef
+
+define Package/libgps/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libgps.so.* $(1)/usr/lib/
+endef
+
+define Package/libgpsd/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libgpsd.so.* $(1)/usr/lib/
 endef
 
 $(eval $(call BuildPackage,gpsd))
+$(eval $(call BuildPackage,cgps))
+$(eval $(call BuildPackage,libgps))
+$(eval $(call BuildPackage,libgpsd))
 

--- a/net/gpsd/files/gpsd.config
+++ b/net/gpsd/files/gpsd.config
@@ -1,5 +1,6 @@
 config gpsd core
     option device    "/dev/ttyUSB0"
     option port    "2947"
+    option listen_globally    "false"
     option enabled    "true"
 

--- a/net/gpsd/files/gpsd.init
+++ b/net/gpsd/files/gpsd.init
@@ -1,5 +1,5 @@
 #!/bin/sh /etc/rc.common
-# Copyright (C) 2009 OpenWrt.org
+# Copyright (C) 2009-2011 OpenWrt.org
 START=50
 
 NAME=gpsd
@@ -10,6 +10,7 @@
     config_load gpsd
     config_get device core device
     config_get port core port
+    config_get_bool listen_globally core listen_globally
     config_get_bool enabled core enabled
     [ "$enabled" != "1" ] && exit
     logger -t "$NAME" "Starting..."
@@ -17,7 +18,8 @@
         logger -t "$NAME" "Unable to find device $device. Exiting."
         exit 1
     }
-    $PROG -n -P $PIDF -S $port $device
+    [ "$listen_globally" != "0" ] && append args "-G"
+    $PROG -n -P $PIDF -S $port $args $device
 }
 
 stop() {

--- /dev/null
+++ b/net/gpsd/patches/0001-_XOPEN_SOURCE-breaks-CLOCK_REALTIME-in-uclibc.patch
@@ -1,1 +1,36 @@
+From c7a6bf126c17e997428ee925aad62b2fd70dc316 Mon Sep 17 00:00:00 2001
+From: Dave Taht <dave.taht@bufferbloat.net>
+Date: Fri, 13 Apr 2012 23:14:06 -0700
+Subject: [PATCH] _XOPEN_SOURCE breaks CLOCK_REALTIME in uclibc
 
+Since you can't tell what library you are using...
+until after you include features.h
+which after you would set _XOPEN_SOURCE
+and if you set _XOPEN_SOURCE you can't re-include features.h
+we have a recursive dependency.
+
+I have no idea how to handle this, so I'll just carry a patch
+in openwrt.
+---
+ gpsutils.c |    4 ----
+ 1 files changed, 0 insertions(+), 4 deletions(-)
+
+diff --git a/gpsutils.c b/gpsutils.c
+index 60c4ae9..95ab456 100644
+--- a/gpsutils.c
++++ b/gpsutils.c
+@@ -4,10 +4,6 @@
+  * BSD terms apply: see the file COPYING in the distribution root for details.
+  */
+ 
+-/* The strptime prototype is not provided unless explicitly requested.
+- *  So add the define that POSIX says to to avoid: */
+-#define _XOPEN_SOURCE
+-
+ #include <stdio.h>
+ #include <time.h>
+ #include <sys/time.h>
+-- 
+1.7.5.4
+
+

--- /dev/null
+++ b/net/gpsd/patches/001-add-staging-dir.patch
@@ -1,1 +1,11 @@
+--- a/SConstruct
++++ b/SConstruct
+@@ -199,6 +199,7 @@ import_env = (
+     'PATH',            # Required for ccache and Coverity scan-build
+     'PKG_CONFIG_PATH', # Set .pc file directory in a crossbuild
+     'STAGING_PREFIX',  # Required by the OpenWRT build.
++    'STAGING_DIR',     # Required by the OpenWRT build.
+     )
+ envs = {}
+ for var in import_env:
 

--- /dev/null
+++ b/net/gpsd/patches/002-no_chrpath.patch
@@ -1,1 +1,42 @@
+--- a/SConstruct
++++ b/SConstruct
+@@ -270,8 +270,6 @@ def installdir(dir, add_destdir=True):
+ 
+ # Honor the specified installation prefix in link paths.
+ env.Prepend(LIBPATH=[installdir('libdir')])
+-if env["shared"]:
+-    env.Prepend(RPATH=[installdir('libdir')])
+ 
+ # Give deheader a way to set compiler flags
+ if 'MORECFLAGS' in os.environ:
+@@ -390,17 +388,6 @@ config = Configure(env, custom_tests = {
+                                          '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
+ 
+ confdefs = ["/* gpsd_config.h.  Generated by scons, do not hand-hack.  */\n"]
+ 
+@@ -1147,11 +1134,6 @@ binaryinstall.append(LibraryInstall(env,
+ 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"]:
+-    env.AddPostAction(binaryinstall, '$CHRPATH -r "%s" "$TARGET"' \
+-                      % (installdir('libdir', False), ))
+-
+ if not env['debug'] and not env['profiling'] and env['strip']:
+     env.AddPostAction(binaryinstall, '$STRIP $TARGET')
+ 
 

--- a/net/gpsd/patches/100-cross-compile.patch
+++ /dev/null
@@ -1,55 +1,1 @@
-Index: gpsd-2.94/configure.ac
-===================================================================
---- gpsd-2.94.orig/configure.ac	2010-04-20 19:55:08.000000000 +0200
-+++ gpsd-2.94/configure.ac	2011-01-27 15:34:47.002000063 +0100
-@@ -233,30 +233,10 @@
- 	AC_DEFINE([HAVE_LIBPTHREAD], [], [pthread libraries are present])])
- AC_SUBST(LIBPTHREAD)
- 
--#
--# We want libusb-1.x or later.  Checking for this is messy in 2010
--# since many Linux systems ship with .0,1.x versions and that's 
--# what you get if you check naively for -lusb.  
--#
--# We use the fact that the obsolete versions put their include file in
--# /usr/include/usb.h, while the newer ones have it in 
--# /usr/include/libusb-*/libusb.h
--#
- AC_MSG_CHECKING([for libusb version >= 1.0.0])
--if test -f /usr/include/libusb-*/libusb.h ;
--then
--    usb=$(basename /usr/lib/libusb-*.so | sed -e s/\.so// -e s/^lib//)
--    AC_DEFINE([HAVE_LIBUSB], [], [will link with -l$usb; ])
--    LIBUSB=-l${usb}
--    INCUSB=-I/usr/include/lib${usb}
--    ac_libusb=yes
--    AC_MSG_RESULT([found.])
--else
--    ac_libusb=yes
--    AC_MSG_RESULT([not found.])
--fi
--AC_SUBST(LIBUSB)
--AC_SUBST(INCUSB)
-+AC_DEFINE([HAVE_LIBUSB], [], [will link with -lusb-1.0; ])
-+ac_libusb=yes
-+AC_MSG_RESULT([OpenWRT: Crosscompile])
- 
- AH_VERBATIM([_GNU_SOURCE],
- 	  [/* Some libc's don't have strlcat/strlcpy. Local copies are provided */
-Index: gpsd-2.94/Makefile.am
-===================================================================
---- gpsd-2.94.orig/Makefile.am	2010-04-20 11:37:21.000000000 +0200
-+++ gpsd-2.94/Makefile.am	2011-01-27 15:34:08.125000006 +0100
-@@ -245,9 +245,9 @@
- # Warning: This overrides autoconf's normal link-line generation process
- if LIBGPSMM_ENABLE
- libgps_la_SOURCES += libgpsmm.cpp
--libgps_la_LINK = /bin/sh ./libtool --tag=CXX --mode=link g++ $(libgps_la_LDFLAGS) -o $@
-+libgps_la_LINK = $(LIBTOOL) --tag=CXX --mode=link $(CXX) $(libgps_la_LDFLAGS) -o $@
- else
--libgps_la_LINK = /bin/sh ./libtool --tag=CC --mode=link gcc $(libgps_la_LDFLAGS) -o $@
-+libgps_la_LINK = $(LIBTOOL) --tag=CC --mode=link $(CC) $(libgps_la_LDFLAGS) -o $@
- endif
- 
- nodist_libgpsd_la_SOURCES = packet_names.h ais_json.i
 

comments