2 # Copyright (C) 2015 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
11 PKG_NAME:=node-$(PKG_NPM_NAME)
16 PKG_SOURCE_URL:=https://github.com/node-hid/node-hid.git
17 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
18 PKG_SOURCE_VERSION:=35d830b7810c87d32484d0a346621568c4849441
19 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
21 PKG_BUILD_DEPENDS:=node/host
22 PKG_NODE_VERSION:=4.4.5
24 PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
28 include $(INCLUDE_DIR)/package.mk
30 define Package/node-hid
35 DEPENDS:=+libusb-1.0 +hidapi +libstdcpp
36 TITLE:=Node.js package to access HID devices
37 URL:=https://github.com/node-hid/node-hid
40 define Package/node-hid/description
41 Node.js package to access HID devices
44 CPU:=$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))
46 EXTRA_CFLAGS+=-I$(STAGING_DIR)/usr/include/libusb-1.0
49 git init $(PKG_BUILD_DIR)
52 npm_config_arch=$(CONFIG_ARCH) \
53 npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \
54 npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache \
55 PREFIX="$(PKG_INSTALL_DIR)/usr/" \
56 npm install --build-from-source --target_arch=$(CPU) -g $(PKG_BUILD_DIR)
59 define Package/node-hid/install
60 mkdir -p $(1)/usr/lib/node/node-hid/
61 $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node/
64 $(eval $(call BuildPackage,node-hid))