ec595880f164eda2c4655a84af64c390a2bdf0c3
[openwrt/svn-archive/archive.git] / package / utils / usbmode / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_NAME:=usbmode
4 PKG_VERSION:=2014-08-26
5 PKG_RELEASE=$(PKG_SOURCE_VERSION)
6
7 PKG_SOURCE_PROTO:=git
8 PKG_SOURCE_URL:=http://git.openwrt.org/project/usbmode.git
9 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
10 PKG_SOURCE_VERSION:=993a9a542791953c4804f7ddbb3a07756738e37a
11 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
12 CMAKE_INSTALL:=1
13
14 PKG_LICENSE:=GPL-2.0
15 PKG_LICENSE_FILES:=
16
17 PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
18
19 PKG_DATA_VERSION:=20140529
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:=dff94177781298aaf0b3c2a3c3dea6b2
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 cp ./data/* $(PKG_BUILD_DIR)/$(PKG_DATA_PATH)/usb_modeswitch.d/
47 endef
48
49 define Package/usb-modeswitch/install
50 $(INSTALL_DIR) $(1)/etc/hotplug.d/usb $(1)/etc/init.d $(1)/sbin
51 perl $(PKG_BUILD_DIR)/convert-modeswitch.pl \
52 $(PKG_BUILD_DIR)/$(PKG_DATA_PATH)/usb_modeswitch.d/* \
53 > $(1)/etc/usb-mode.json
54 $(INSTALL_DATA) ./files/usbmode.hotplug $(1)/etc/hotplug.d/usb/20-usb_mode
55 $(INSTALL_BIN) ./files/usbmode.init $(1)/etc/init.d/usbmode
56 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/usbmode $(1)/sbin/
57 endef
58
59 $(eval $(call BuildPackage,usb-modeswitch))