You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.6 KiB

  1. #
  2. # Copyright (C) 2015 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NPM_NAME:=hid
  9. PKG_NAME:=node-$(PKG_NPM_NAME)
  10. PKG_VERSION:=0.4.0
  11. PKG_RELEASE:=1
  12. PKG_SOURCE_PROTO:=git
  13. PKG_SOURCE_URL:=https://github.com/node-hid/node-hid.git
  14. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  15. PKG_SOURCE_VERSION:=c56c8aa5d113c6f2574d1f7e64d41745702965bb
  16. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
  17. PKG_BUILD_DEPENDS:=node
  18. PKG_NODE_VERSION:=0.12.7
  19. PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
  20. PKG_LICENSE:=Custom
  21. PKG_LICENSE_FILE:=
  22. include $(INCLUDE_DIR)/package.mk
  23. define Package/node-hid
  24. DEPENDS:=+node
  25. SUBMENU:=Node.js
  26. SECTION:=lang
  27. CATEGORY:=Languages
  28. DEPENDS:=+libusb-1.0 +hidapi +libstdcpp
  29. TITLE:=Node.js package to access HID devices
  30. URL:=https://github.com/node-hid/node-hid
  31. endef
  32. define Package/node-hid/description
  33. Node.js package to access HID devices
  34. endef
  35. EXTRA_LDFLAGS+="-lhidapi-libusb"
  36. EXTRA_CFLAGS+="-I$(STAGING_DIR)/usr/include/hidapi/"
  37. define Build/Compile
  38. $(MAKE_VARS) \
  39. $(MAKE_FLAGS) \
  40. npm_config_arch=$(CONFIG_ARCH) \
  41. npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \
  42. PREFIX="$(PKG_INSTALL_DIR)/usr/" \
  43. $(STAGING_DIR)/host/bin/npm install -g $(PKG_BUILD_DIR)
  44. endef
  45. define Package/node-hid/install
  46. mkdir -p $(1)/usr/lib/node/node-hid/
  47. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/node-hid/{index.js,package.json,build,node_modules} $(1)/usr/lib/node/node-hid/
  48. endef
  49. $(eval $(call BuildPackage,node-hid))