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.

66 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:=6
  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:=4.4.5
  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. DEPENDS:=+node +node-npm
  26. SUBMENU:=Node.js
  27. SECTION:=lang
  28. CATEGORY:=Languages
  29. DEPENDS:=+libusb-1.0 +hidapi +libstdcpp
  30. TITLE:=Node.js package to access HID devices
  31. URL:=https://github.com/node-hid/node-hid
  32. endef
  33. define Package/node-hid/description
  34. Node.js package to access HID devices
  35. endef
  36. CPU:=$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))
  37. EXTRA_CFLAGS+=-I$(STAGING_DIR)/usr/include/libusb-1.0
  38. define Build/Compile
  39. git init $(PKG_BUILD_DIR)
  40. $(MAKE_VARS) \
  41. $(MAKE_FLAGS) \
  42. npm_config_arch=$(CONFIG_ARCH) \
  43. npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \
  44. npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache \
  45. PREFIX="$(PKG_INSTALL_DIR)/usr/" \
  46. npm install --build-from-source --target_arch=$(CPU) -g $(PKG_BUILD_DIR)
  47. endef
  48. define Package/node-hid/install
  49. mkdir -p $(1)/usr/lib/node/node-hid/
  50. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node/
  51. endef
  52. $(eval $(call BuildPackage,node-hid))