Merge pull request #8518 from neheb/i
[feed/packages.git] / lang / node-arduino-firmata / Makefile
1 #
2 # Copyright (C) 2014 Arduino LLC
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NPM_NAME:=arduino-firmata
11 PKG_NAME:=node-$(PKG_NPM_NAME)
12 PKG_VERSION:=0.3.4
13 PKG_RELEASE:=3
14
15 PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz
16 PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_NPM_NAME)/-/
17 PKG_HASH:=d7157e02867eae82887cb5e17b90c963fe7489bacd464110bfd20c672b8d5a98
18
19 PKG_BUILD_DEPENDS:=node/host
20 PKG_USE_MIPS16:=0
21
22 PKG_MAINTAINER:=Hirokazu MORIKAWA <morikw2@gmail.com>
23 PKG_LICENSE:=MIT
24 PKG_LICENSE_FILES:=LICENSE.txt
25
26 include $(INCLUDE_DIR)/package.mk
27
28 define Package/node-arduino-firmata
29 SUBMENU:=Node.js
30 SECTION:=lang
31 CATEGORY:=Languages
32 TITLE:=Arduino Firmata implementation for Node.js
33 URL:=https://www.npmjs.com/package/arduino-firmata
34 DEPENDS:=+node +node-npm +node-serialport
35 endef
36
37 define Package/node-arduino-firmata/description
38 Arduino Firmata protocol (http://firmata.org) implementation on Node.js.
39 endef
40
41 TAR_OPTIONS+= --strip-components 1
42 TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
43
44 NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))))
45
46 define Build/Compile
47 $(MAKE_VARS) \
48 $(MAKE_FLAGS) \
49 npm_config_arch=$(NODEJS_CPU) \
50 npm_config_target_arch=$(NODEJS_CPU) \
51 npm_config_build_from_source=true \
52 npm_config_nodedir=$(STAGING_DIR)/usr/ \
53 npm_config_prefix=$(PKG_INSTALL_DIR)/usr/ \
54 npm_config_cache=$(TMP_DIR)/npm-cache \
55 npm_config_tmp=$(TMP_DIR)/npm-tmp \
56 npm install -g $(PKG_BUILD_DIR)
57 rm -rf $(TMP_DIR)/npm-tmp
58 rm -rf $(TMP_DIR)/npm-cache
59 endef
60
61 define Package/node-arduino-firmata/install
62 $(INSTALL_DIR) $(1)/usr/lib/node/$(PKG_NPM_NAME)
63 $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{package.json,README.md} \
64 $(1)/usr/lib/node/$(PKG_NPM_NAME)/
65 $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{tests,*.txt} \
66 $(1)/usr/lib/node/$(PKG_NPM_NAME)/
67 $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{node_modules,lib} \
68 $(1)/usr/lib/node/$(PKG_NPM_NAME)/
69 $(CP) ./files/* $(1)/
70 endef
71
72 $(eval $(call BuildPackage,node-arduino-firmata))