replace usb-modeswitch with a rewrite that should be more reliable
[openwrt/svn-archive/archive.git] / package / system / utils / usbmode / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_NAME:=usbmode
4 PKG_VERSION:=2013-05-31
5 PKG_RELEASE=$(PKG_SOURCE_VERSION)
6
7 PKG_SOURCE_PROTO:=git
8 PKG_SOURCE_URL:=git://git.openwrt.org/project/usbmode.git
9 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
10 PKG_SOURCE_VERSION:=b62a33af03c39a8970249ce7afe7baec7ea9b91b
11 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
12 CMAKE_INSTALL:=1
13
14 PKG_LICENSE:=GPLv2
15 PKG_LICENSE_FILES:=
16
17 PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
18
19 PKG_DATA_VERSION:=20121109
20 PKG_DATA_URL:=http://www.draisberghof.de/usb_modeswitch
21 PKG_DATA_PATH:=usb-modeswitch-data-$(PKG_DATA_VERSION)
22 PKG_DATA_FILENAME:=$(PKG_DATA_PATH).tar.bz2
23
24 include $(INCLUDE_DIR)/package.mk
25 include $(INCLUDE_DIR)/cmake.mk
26
27 define Download/data
28 FILE:=$(PKG_DATA_FILENAME)
29 URL:=$(PKG_DATA_URL)
30 MD5SUM:=a7d23a03157871013a0d708ab2b1b6df
31 endef
32 $(eval $(call Download,data))
33
34 define Package/usb-modeswitch
35 SECTION:=utils
36 CATEGORY:=Utilities
37 DEPENDS:=+libubox +libblobmsg-json +libusb-1.0
38 TITLE:=USB mode switching utility
39 endef
40
41 define Build/Prepare
42 $(Build/Prepare/Default)
43 tar xvfj $(DL_DIR)/$(PKG_DATA_FILENAME) -C $(PKG_BUILD_DIR)
44 rm -f \
45 $(PKG_BUILD_DIR)/$(PKG_DATA_PATH)/usb_modeswitch.d/05c6:1000:sVe=GT
46 endef
47
48 define Package/usb-modeswitch/install
49 $(INSTALL_DIR) $(1)/etc/hotplug.d/usb $(1)/sbin
50 perl $(PKG_BUILD_DIR)/convert-modeswitch.pl \
51 $(PKG_BUILD_DIR)/$(PKG_DATA_PATH)/usb_modeswitch.d/* \
52 > $(1)/etc/usb-mode.json
53 $(CP) ./files/usbmode.hotplug $(1)/etc/hotplug.d/usb/
54 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/usbmode $(1)/sbin/
55 endef
56
57 $(eval $(call BuildPackage,usb-modeswitch))