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
:=serialport
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
:=e19fe993ad16ae0e03fc42e24cfe4babf8fd90f8358e1885d5e216277dda1086
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
26 include $(INCLUDE_DIR
)/package.mk
28 define Package
/node-serialport
32 TITLE
:=Node.js package to access serial ports
33 URL
:=https
://serialport.io
/
34 DEPENDS
:=+node
+node-npm
+node-serialport-bindings
37 define Package
/node-serialport
/description
38 Node.js package to access serial ports for reading and writing OR Welcome your robotic JavaScript overlords. Better yet
, program them
!
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
)
50 NPM_FLAGS
=$(MAKE_VARS
) \
52 npm_config_arch
=$(NODEJS_CPU
) \
53 npm_config_target_arch
=$(NODEJS_CPU
) \
54 npm_config_build_from_source
=true \
55 npm_config_nodedir
=$(STAGING_DIR
)/usr
/ \
56 npm_config_prefix
=$(PKG_INSTALL_DIR
)/usr
/ \
57 npm_config_cache
=$(TMP_DIR
)/npm-cache-
$(TMPNPM
) \
58 npm_config_tmp
=$(TMP_DIR
)/npm-tmp-
$(TMPNPM
)
61 $(NPM_FLAGS
) npm i
-g
--production
$(PKG_BUILD_DIR
)
62 $(NPM_FLAGS
) npm i
--production
--prefix=$(PKG_BUILD_DIR
) --target_arch
=$(NODEJS_CPU
) --prefer-dedupe
63 rm -rf
$(TMP_DIR
)/npm-tmp-
$(TMPNPM
)
64 rm -rf
$(TMP_DIR
)/npm-cache-
$(TMPNPM
)
67 define Package
/node-serialport
/install
68 $(INSTALL_DIR
) $(1)/usr
/lib
/node
/$(PKG_NPM_NAME
)
69 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/node_modules
/$(PKG_NPM_NAME
)/{package.json
,LICENSE
,*.md
} \
70 $(1)/usr
/lib
/node
/$(PKG_NPM_NAME
)/
71 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/node_modules
/$(PKG_NPM_NAME
)/*.js \
72 $(1)/usr
/lib
/node
/$(PKG_NPM_NAME
)/
73 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/node_modules
/$(PKG_NPM_NAME
)/{node_modules
,lib
} \
74 $(1)/usr
/lib
/node
/$(PKG_NPM_NAME
)/
77 $(eval
$(call BuildPackage
,node-serialport
))