packages: remove dependency on obsolete LINUX_2_4 symbol
[packages.git] / net / usbip / Makefile
1 #
2 # Copyright (C) 2010-2011 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=usbip
12 PKG_VERSION:=0.1.7
13 PKG_RELEASE:=2
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=@SF/usbip
17 PKG_MD5SUM:=d1094b6d4449787864f8be001639232c
18
19 PKG_BUILD_DEPENDS:=glib2 sysfsutils
20 PKG_FIXUP:=libtool autoreconf
21 PKG_INSTALL:=1
22
23 include $(INCLUDE_DIR)/package.mk
24 include $(INCLUDE_DIR)/nls.mk
25
26 define Package/usbip/Common
27   TITLE:=USB-over-IP
28   URL:=http://usbip.sourceforge.net/
29   DEPENDS:=@USB_SUPPORT
30   MAINTAINER:=Nuno Goncalves <nunojpg@gmail.com>
31 endef
32
33 define Package/usbip/Default
34 $(call Package/usbip/Common)
35   SECTION:=net
36   CATEGORY:=Network
37 endef
38
39 define Package/usbip
40 $(call Package/usbip/Default)
41   TITLE+= (common)
42   DEPENDS+= +libsysfs +libwrap +kmod-usbip
43 endef
44
45 define Package/usbip-client
46 $(call Package/usbip/Default)
47   TITLE+= (client)
48   DEPENDS+= usbip +glib2 +kmod-usbip-client
49 endef
50
51 define Package/usbip-server
52 $(call Package/usbip/Default)
53   TITLE+= (server)
54   DEPENDS+= usbip +glib2 +kmod-usbip-server
55 endef
56
57 define KernelPackage/usbip/Default
58 $(call Package/usbip/Common)
59   SUBMENU:=USB Support
60 endef
61
62 define KernelPackage/usbip
63 $(call KernelPackage/usbip/Default)
64   TITLE+= (kernel support)
65   DEPENDS+= +kmod-usb-core
66   KCONFIG:= \
67         CONFIG_USB_IP_COMMON CONFIG_USB_IP_DEBUG_ENABLE=n \
68         CONFIG_USBIP_CORE CONFIG_USBIP_DEBUG=n
69  ifeq ($(strip $(call CompareKernelPatchVer,$(KERNEL_PATCHVER),le,2.6.39)),1)
70   FILES:=$(LINUX_DIR)/drivers/staging/usbip/usbip_common_mod.$(LINUX_KMOD_SUFFIX)
71   AUTOLOAD:=$(call AutoLoad,98,usbip_common_mod)
72  else
73   FILES:=$(LINUX_DIR)/drivers/staging/usbip/usbip-core.ko
74   AUTOLOAD:=$(call AutoLoad,98,usbip-core)
75  endif
76 endef
77
78 define KernelPackage/usbip-client
79 $(call KernelPackage/usbip/Default)
80   TITLE+= (kernel client driver)
81   DEPENDS+= kmod-usbip
82   KCONFIG:= CONFIG_USB_IP_VHCI_HCD CONFIG_USBIP_VHCI_HCD
83   FILES:=$(LINUX_DIR)/drivers/staging/usbip/vhci-hcd.$(LINUX_KMOD_SUFFIX)
84   AUTOLOAD:=$(call AutoLoad,99,vhci-hcd)
85 endef
86
87 define KernelPackage/usbip-server
88 $(call KernelPackage/usbip/Default)
89   TITLE+= (kernel host driver)
90   DEPENDS+= kmod-usbip
91   KCONFIG:= CONFIG_USB_IP_HOST CONFIG_USBIP_HOST
92  ifeq ($(strip $(call CompareKernelPatchVer,$(KERNEL_PATCHVER),le,2.6.39)),1)
93   FILES:=$(LINUX_DIR)/drivers/staging/usbip/usbip.$(LINUX_KMOD_SUFFIX)
94   AUTOLOAD:=$(call AutoLoad,99,usbip)
95  else
96   FILES:=$(LINUX_DIR)/drivers/staging/usbip/usbip-host.ko
97   AUTOLOAD:=$(call AutoLoad,99,usbip-host)
98  endif
99 endef
100
101 include $(INCLUDE_DIR)/kernel-defaults.mk
102
103 CONFIGURE_PATH:=./src
104 MAKE_PATH:=./src
105 LIBTOOL_PATHS:=./src
106
107 CFLAGS+="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include"
108
109 define Build/Compile/kmod
110         $(MAKE) $(KERNEL_MAKEOPTS) \
111                 SUBDIRS="$(LINUX_DIR)/drivers/staging/usbip" \
112                 CONFIG_USB_IP_COMMON=m \
113                 CONFIG_USB_IP_VHCI_HCD=m \
114                 CONFIG_USB_IP_HOST=m \
115                 CONFIG_USBIP_CORE=m \
116                 CONFIG_USBIP_VHCI_HCD=m \
117                 CONFIG_USBIP_HOST=m \
118                 modules
119 endef
120
121 define Build/Compile
122 $(call Build/Compile/Default)
123 $(call Build/Compile/kmod)
124 endef
125
126 define Package/usbip/install
127         $(INSTALL_DIR) $(1)/usr/lib
128         $(CP) \
129                 $(PKG_INSTALL_DIR)/usr/lib/libusbip.so.* \
130                 $(1)/usr/lib/
131         $(INSTALL_DIR) $(1)/usr/share/usbip
132         $(CP) \
133                 $(PKG_INSTALL_DIR)/usr/share/usbip/usb.ids \
134                 $(1)/usr/share/usbip/
135 endef
136
137 define Package/usbip-client/install
138         $(INSTALL_DIR) $(1)/usr/bin
139         $(CP) \
140                 $(PKG_INSTALL_DIR)/usr/bin/usbip \
141                 $(1)/usr/bin/
142 endef
143
144 define Package/usbip-server/install
145         $(INSTALL_DIR) $(1)/usr/bin
146         $(CP) \
147                 $(PKG_INSTALL_DIR)/usr/bin/usbipd \
148                 $(1)/usr/bin/
149         $(CP) \
150                 $(PKG_INSTALL_DIR)/usr/bin/bind_driver \
151                 $(1)/usr/bin/usbip_bind_driver
152 endef
153
154 $(eval $(call BuildPackage,usbip))
155 $(eval $(call BuildPackage,usbip-client))
156 $(eval $(call BuildPackage,usbip-server))
157 $(eval $(call KernelPackage,usbip))
158 $(eval $(call KernelPackage,usbip-client))
159 $(eval $(call KernelPackage,usbip-server))