2
0

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:=2017-05-24
  7. PKG_SOURCE_VERSION:=453da8e540b1c53d357b897d6c70372cd4633390
  8. PKG_MIRROR_HASH:=b4a7132b940192f2e9a74bd890bd7008ede701e1d52284c3ade0cdc7d663929f
  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:=20170205
  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:=e2dcfd9d28928d8d8f03381571a23442b3c50d48d343bc40a1a07d01662738d1
  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))