2 # Copyright (C) 2014 Arduino LLC
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
10 PKG_NPM_NAME
:=arduino-firmata
11 PKG_NAME
:=node-
$(PKG_NPM_NAME
)
15 PKG_SOURCE
:=$(PKG_NPM_NAME
)-$(PKG_VERSION
).tgz
16 PKG_SOURCE_URL
:=https
://registry.npmjs.org
/$(PKG_NPM_NAME
)/-/
17 PKG_HASH
:=d7157e02867eae82887cb5e17b90c963fe7489bacd464110bfd20c672b8d5a98
19 PKG_BUILD_DEPENDS
:=node
/host
20 PKG_BUILD_FLAGS
:=no-mips16
22 PKG_MAINTAINER
:=Hirokazu MORIKAWA
<morikw2@gmail.com
>
24 PKG_LICENSE_FILES
:=LICENSE.txt
26 include $(INCLUDE_DIR
)/package.mk
28 define Package
/node-arduino-firmata
32 TITLE
:=Arduino Firmata implementation for Node.js
33 URL
:=https
://www.npmjs.com
/package
/arduino-firmata
34 DEPENDS
:=+node
+node-npm
+node-serialport
37 define Package
/node-arduino-firmata
/description
38 Arduino Firmata protocol
(http
://firmata.org
) implementation on Node.js.
41 TAR_OPTIONS
+= --strip-components
1
42 TAR_CMD
=$(HOST_TAR
) -C
$(1) $(TAR_OPTIONS
)
44 NODEJS_CPU
:=$(subst powerpc
,ppc
,$(subst aarch64
,arm64
,$(subst x86_64
,x64
,$(subst i386
,ia32
,$(ARCH
)))))
45 TMPNPM
:=$(shell mktemp
-u XXXXXXXXXX
)
47 TARGET_CFLAGS
+=$(FPIC
)
48 TARGET_CPPFLAGS
+=$(FPIC
)
53 npm_config_arch
=$(NODEJS_CPU
) \
54 npm_config_target_arch
=$(NODEJS_CPU
) \
55 npm_config_build_from_source
=true \
56 npm_config_nodedir
=$(STAGING_DIR
)/usr
/ \
57 npm_config_prefix
=$(PKG_INSTALL_DIR
)/usr
/ \
58 npm_config_cache
=$(TMP_DIR
)/npm-cache-
$(TMPNPM
) \
59 npm_config_tmp
=$(TMP_DIR
)/npm-tmp-
$(TMPNPM
)
62 $(NPM_FLAGS
) npm i
-g
--production
$(PKG_BUILD_DIR
)
63 $(NPM_FLAGS
) npm i
--production
--prefix=$(PKG_BUILD_DIR
) --target_arch
=$(NODEJS_CPU
) --prefer-dedupe
64 rm -rf
$(TMP_DIR
)/npm-tmp-
$(TMPNPM
)
65 rm -rf
$(TMP_DIR
)/npm-cache-
$(TMPNPM
)
68 define Package
/node-arduino-firmata
/install
69 $(INSTALL_DIR
) $(1)/usr
/lib
/node
/$(PKG_NPM_NAME
)
70 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/node_modules
/$(PKG_NPM_NAME
)/{package.json
,README.md
} \
71 $(1)/usr
/lib
/node
/$(PKG_NPM_NAME
)/
72 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/node_modules
/$(PKG_NPM_NAME
)/{tests
,*.txt
} \
73 $(1)/usr
/lib
/node
/$(PKG_NPM_NAME
)/
74 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/node_modules
/$(PKG_NPM_NAME
)/{node_modules
,lib
} \
75 $(1)/usr
/lib
/node
/$(PKG_NPM_NAME
)/
79 $(eval
$(call BuildPackage
,node-arduino-firmata
))