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:=7
  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_MIRROR_HASH:=125f752d491ac10d32bab0f0d660f6f150c6a9a168b2b56bfddc2cb1d65166fc
  18. PKG_BUILD_DEPENDS:=node/host
  19. PKG_NODE_VERSION:=6.11.2
  20. PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
  21. PKG_LICENSE:=Custom
  22. PKG_LICENSE_FILES:=
  23. include $(INCLUDE_DIR)/package.mk
  24. define Package/node-hid
  25. SUBMENU:=Node.js
  26. SECTION:=lang
  27. CATEGORY:=Languages
  28. TITLE:=Node.js package to access HID devices
  29. URL:=https://github.com/node-hid/node-hid
  30. DEPENDS:=+node +node-npm +libusb-1.0 +hidapi +libstdcpp
  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. 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))