Makefile 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. include $(TOPDIR)/rules.mk
  2. PKG_NAME:=usbmode
  3. PKG_RELEASE:=1
  4. PKG_SOURCE_PROTO:=git
  5. PKG_SOURCE_URL=$(LEDE_GIT)/project/usbmode.git
  6. PKG_SOURCE_DATE:=2014-08-26
  7. PKG_SOURCE_VERSION:=993a9a542791953c4804f7ddbb3a07756738e37a
  8. PKG_MIRROR_HASH:=dc4daa80a0d51524b41c6bf67cb368ca51fcfba1217adedd6823b24a68be5bf4
  9. CMAKE_INSTALL:=1
  10. PKG_LICENSE:=GPL-2.0
  11. PKG_LICENSE_FILES:=
  12. PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  13. PKG_DATA_VERSION:=20150115
  14. PKG_DATA_URL:=http://www.draisberghof.de/usb_modeswitch
  15. PKG_DATA_PATH:=usb-modeswitch-data-$(PKG_DATA_VERSION)
  16. PKG_DATA_FILENAME:=$(PKG_DATA_PATH).tar.bz2
  17. include $(INCLUDE_DIR)/package.mk
  18. include $(INCLUDE_DIR)/cmake.mk
  19. define Download/data
  20. FILE:=$(PKG_DATA_FILENAME)
  21. URL:=$(PKG_DATA_URL)
  22. HASH:=90549f589835a68279369c3dc0d47eb7338ee3bad09d737e7b85e1ab15bd2d8b
  23. endef
  24. $(eval $(call Download,data))
  25. define Package/usb-modeswitch
  26. SECTION:=utils
  27. CATEGORY:=Utilities
  28. DEPENDS:=+libubox +libblobmsg-json +libusb-1.0
  29. TITLE:=USB mode switching utility
  30. endef
  31. define Build/Prepare
  32. $(Build/Prepare/Default)
  33. tar xvfj $(DL_DIR)/$(PKG_DATA_FILENAME) -C $(PKG_BUILD_DIR)
  34. rm -f \
  35. $(PKG_BUILD_DIR)/$(PKG_DATA_PATH)/usb_modeswitch.d/05c6:1000:sVe=GT
  36. cp ./data/* $(PKG_BUILD_DIR)/$(PKG_DATA_PATH)/usb_modeswitch.d/
  37. #in order to keep the Lede GIT repo free of filenames with colons,
  38. #we name the files xxxx-yyyy
  39. # and rename here after copying to the build directory
  40. for filevar in $(PKG_BUILD_DIR)/$(PKG_DATA_PATH)/usb_modeswitch.d/*-* ; \
  41. do \
  42. [ -f "$$$$filevar" ] || continue ; \
  43. FILENAME=$$$$(basename $$$$filevar) ; \
  44. NEWNAME=$$$${FILENAME//-/:} ; \
  45. rm "$(PKG_BUILD_DIR)/$(PKG_DATA_PATH)/usb_modeswitch.d/$$$$NEWNAME" ; \
  46. mv "$(PKG_BUILD_DIR)/$(PKG_DATA_PATH)/usb_modeswitch.d/$$$$FILENAME" "$(PKG_BUILD_DIR)/$(PKG_DATA_PATH)/usb_modeswitch.d/$$$$NEWNAME" ; \
  47. done
  48. endef
  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. $(eval $(call BuildPackage,usb-modeswitch))