gpsd: Fix crosscompile and libtool issues
authormb <mb@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Thu, 27 Jan 2011 14:26:38 +0000 (14:26 +0000)
committermb <mb@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Thu, 27 Jan 2011 14:26:38 +0000 (14:26 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/packages@25149 3c298f89-4303-0410-b956-a3cf2f4a3e73

net/gpsd/Makefile
net/gpsd/patches/100-cross-compile.patch [new file with mode: 0644]

index 10015e1..12606c9 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006-2010 OpenWrt.org
+# Copyright (C) 2006-2011 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -9,13 +9,15 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=gpsd
 PKG_VERSION:=2.94
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 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
 
@@ -24,7 +26,7 @@ include $(INCLUDE_DIR)/package.mk
 define Package/gpsd
   SECTION:=net
   CATEGORY:=Network
-  DEPENDS:=+libpthread
+  DEPENDS:=+libpthread +libusb-1.0
   TITLE:=An interface daemon for GPS receivers
   URL:=http://gpsd.berlios.de/
 endef
@@ -43,6 +45,10 @@ CONFIGURE_ARGS += \
        --disable-libgpsmm \
         --without-x \
 
+EXTRA_CFLAGS:=-I$(STAGING_DIR)/usr/include/libusb-1.0
+
+EXTRA_LDFLAGS:=-lusb-1.0
+
 define Build/InstallDev
        $(INSTALL_DIR) $(1)/usr/include
        $(CP) $(PKG_INSTALL_DIR)/usr/include/gps.h $(1)/usr/include/
diff --git a/net/gpsd/patches/100-cross-compile.patch b/net/gpsd/patches/100-cross-compile.patch
new file mode 100644 (file)
index 0000000..9b3639e
--- /dev/null
@@ -0,0 +1,53 @@
+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:22:04.720000026 +0100
+@@ -233,30 +233,9 @@
+       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_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:22:28.557999857 +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