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.

65 lines
1.7 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.5.1
  11. PKG_RELEASE:=3
  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:=35d830b7810c87d32484d0a346621568c4849441
  16. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
  17. PKG_BUILD_DEPENDS:=node/host
  18. PKG_NODE_VERSION:=4.4.4
  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. CPU:=$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))
  36. EXTRA_CFLAGS+=-I$(STAGING_DIR)/usr/include/libusb-1.0
  37. define Build/Compile
  38. git init $(PKG_BUILD_DIR)
  39. $(MAKE_VARS) \
  40. $(MAKE_FLAGS) \
  41. npm_config_arch=$(CONFIG_ARCH) \
  42. npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \
  43. npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache \
  44. PREFIX="$(PKG_INSTALL_DIR)/usr/" \
  45. $(STAGING_DIR)/host/bin/npm install --build-from-source --target_arch=$(CPU) -g $(PKG_BUILD_DIR)
  46. endef
  47. define Package/node-hid/install
  48. mkdir -p $(1)/usr/lib/node/node-hid/
  49. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node/
  50. endef
  51. $(eval $(call BuildPackage,node-hid))