[package] usbip: update userspace to match kernel part
authorFlorian Fainelli <florian@openwrt.org>
Fri, 27 Jul 2012 11:49:22 +0000 (11:49 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Fri, 27 Jul 2012 11:49:22 +0000 (11:49 +0000)
After kernel 2.6.39, usbip kernel and userspace are in kernel tree
The new kernel modules names have already been updated in openwrt for
kernel > 2.6.39

This patch, allow to build the new corresponding usbip userspace tool
when of the device use a kernel > 2.6.39
And continue to build version 0.1.7 for older version.

Fix #10992

Florian:
- do not use an md5sum for usb.ids since it changes often
- dropped the parts to support kernels <= 2.6.39
- make the package depend on LINUX_3_3

Signed-off-by: Mehdi Abaakouk <sileht@sileht.net>
SVN-Revision: 32887

net/usbip/Makefile

index 9af0be3021b5f471d401122e712c560def9bfbff..e1111b0a76e56aaad0726421bdeaf338187125e3 100644 (file)
@@ -1,19 +1,30 @@
 #
-# Copyright (C) 2010-2011 OpenWrt.org
+# Copyright (C) 2010-2012 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
 
 include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=usbip
-PKG_VERSION:=0.1.7
 PKG_RELEASE:=2
 
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=@SF/usbip
-PKG_MD5SUM:=d1094b6d4449787864f8be001639232c
+# Since kernel 2.6.39.1 userspace tools are inside the kernel tree
+# Package Automatic match version in kernel
+# MD5SUM is not useful kernel package already check it
+PKG_VERSION:=$(shell  sed -n -e '/^AC_INIT/s/.*\[\([[:digit:]\.]*\)\].*/\1/gp' $(LINUX_DIR)/drivers/staging/usbip/userspace/configure.ac)
+PKG_SOURCE:=
+PKG_SOURCE_URL:=
+PKG_MD5SUM:=unknown
+PATCH_DIR:=./patches-$(PKG_VERSION)
+
+define prepare_source_directory
+       rm -rf $(PKG_BUILD_DIR)
+       $(CP) $(LINUX_DIR)/drivers/staging/usbip/userspace $(PKG_BUILD_DIR)
+endef
+Hooks/Prepare/Pre += prepare_source_directory
 
 PKG_BUILD_DEPENDS:=glib2 sysfsutils
 PKG_FIXUP:=autoreconf
@@ -25,68 +36,70 @@ include $(INCLUDE_DIR)/nls.mk
 define Package/usbip/Common
   TITLE:=USB-over-IP
   URL:=http://usbip.sourceforge.net/
-  DEPENDS:=@USB_SUPPORT
+  DEPENDS:=@USB_SUPPORT @LINUX_3_3
   MAINTAINER:=Nuno Goncalves <nunojpg@gmail.com>
 endef
 
 define Package/usbip/Default
-$(call Package/usbip/Common)
+  $(call Package/usbip/Common)
   SECTION:=net
   CATEGORY:=Network
 endef
 
 define Package/usbip
-$(call Package/usbip/Default)
+  $(call Package/usbip/Default)
   TITLE+= (common)
   DEPENDS+= +libsysfs +libwrap +kmod-usbip
 endef
 
 define Package/usbip-client
-$(call Package/usbip/Default)
+  $(call Package/usbip/Default)
   TITLE+= (client)
   DEPENDS+= usbip +glib2 +kmod-usbip-client
 endef
 
 define Package/usbip-server
-$(call Package/usbip/Default)
+  $(call Package/usbip/Default)
   TITLE+= (server)
-  DEPENDS+= usbip +glib2 +kmod-usbip-server
+  DEPENDS+= usbip usbip-client +glib2 +kmod-usbip-server
 endef
 
-CONFIGURE_PATH:=./src
-MAKE_PATH:=./src
-LIBTOOL_PATHS:=./src
+CONFIGURE_PATH:=.
+MAKE_PATH:=.
+LIBTOOL_PATHS:=.
+MAKE_FLAGS+=CFLAGS="-Wno-implicit-function-declaration"
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR); ./autogen.sh );
+       $(call Build/Configure/Default)
+endef
 
 CFLAGS+="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include"
 
+define Download/usb.ids
+  URL:=http://www.linux-usb.org/
+  FILE:=usb.ids
+  MD5SUM:=
+endef
+
 define Package/usbip/install
        $(INSTALL_DIR) $(1)/usr/lib
-       $(CP) \
-               $(PKG_INSTALL_DIR)/usr/lib/libusbip.so.* \
-               $(1)/usr/lib/
-       $(INSTALL_DIR) $(1)/usr/share/usbip
-       $(CP) \
-               $(PKG_INSTALL_DIR)/usr/share/usbip/usb.ids \
-               $(1)/usr/share/usbip/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libusbip.so.* $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/share/hwdata
+       $(CP) $(DL_DIR)/usb.ids $(1)/usr/share/hwdata/
 endef
 
 define Package/usbip-client/install
-       $(INSTALL_DIR) $(1)/usr/bin
-       $(CP) \
-               $(PKG_INSTALL_DIR)/usr/bin/usbip \
-               $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/usbip $(1)/usr/sbin/
 endef
 
 define Package/usbip-server/install
-       $(INSTALL_DIR) $(1)/usr/bin
-       $(CP) \
-               $(PKG_INSTALL_DIR)/usr/bin/usbipd \
-               $(1)/usr/bin/
-       $(CP) \
-               $(PKG_INSTALL_DIR)/usr/bin/bind_driver \
-               $(1)/usr/bin/usbip_bind_driver
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/usbipd $(1)/usr/sbin/
 endef
 
+$(eval $(call Download,usb.ids))
 $(eval $(call BuildPackage,usbip))
 $(eval $(call BuildPackage,usbip-client))
 $(eval $(call BuildPackage,usbip-server))