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.

76 lines
2.7 KiB

  1. # This is free software, licensed under the GNU General Public License v2.
  2. # See /LICENSE for more information.
  3. #
  4. include $(TOPDIR)/rules.mk
  5. PKG_NPM_SCOPE:=serialport
  6. PKG_NPM_NAME:=bindings
  7. PKG_NAME:=node-$(PKG_NPM_SCOPE)-$(PKG_NPM_NAME)
  8. PKG_VERSION:=9.0.4
  9. PKG_RELEASE:=2
  10. PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz
  11. PKG_SOURCE_URL:=https://registry.npmjs.org/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME)/-/
  12. PKG_HASH:=aec200860bd175e4b14b4ab1aa56a5f750172b6c8e20ccb234846206395848d4
  13. PKG_BUILD_DEPENDS:=node/host
  14. PKG_USE_MIPS16:=0
  15. PKG_MAINTAINER:=Hirokazu MORIKAWA <morikw2@gmail.com>
  16. PKG_LICENSE:=MIT
  17. PKG_LICENSE_FILES:=LICENSE
  18. include $(INCLUDE_DIR)/package.mk
  19. define Package/node-serialport-bindings
  20. SUBMENU:=Node.js
  21. SECTION:=lang
  22. CATEGORY:=Languages
  23. TITLE:=SerialPort Bindings
  24. URL:=https://www.npmjs.com/package/@serialport/bindings
  25. DEPENDS:=+node
  26. endef
  27. define Package/node-serialport-bindings/description
  28. The Binding is how Node-SerialPort talks to the underlying system. By default, we auto detect Windows, Linux and OS X, and load the appropriate module for your system. You can assign SerialPort.Binding to any binding you like.
  29. endef
  30. TAR_OPTIONS+= --strip-components 1
  31. TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
  32. NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))))
  33. TMPNPM:=$(shell mktemp -u XXXXXXXXXX)
  34. TARGET_CFLAGS+=$(FPIC)
  35. TARGET_CPPFLAGS+=$(FPIC)
  36. NPM_FLAGS=$(MAKE_VARS) \
  37. $(MAKE_FLAGS) \
  38. npm_config_arch=$(NODEJS_CPU) \
  39. npm_config_target_arch=$(NODEJS_CPU) \
  40. npm_config_build_from_source=true \
  41. npm_config_nodedir=$(STAGING_DIR)/usr/ \
  42. npm_config_prefix=$(PKG_INSTALL_DIR)/usr/ \
  43. npm_config_cache=$(TMP_DIR)/npm-cache-$(TMPNPM) \
  44. npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM)
  45. define Build/Compile
  46. $(NPM_FLAGS) npm i -g --production $(PKG_BUILD_DIR) --ignore-scripts
  47. $(NPM_FLAGS) npm i --production --prefix=$(PKG_BUILD_DIR) --target_arch=$(NODEJS_CPU) --prefer-dedupe
  48. rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM)
  49. rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM)
  50. endef
  51. define Package/node-serialport-bindings/install
  52. $(INSTALL_DIR) $(1)/usr/lib/node/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME)
  53. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME)/{package.json,LICENSE,*.md} \
  54. $(1)/usr/lib/node/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME)
  55. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME)/{node_modules,lib} \
  56. $(1)/usr/lib/node/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME)
  57. $(INSTALL_DIR) $(1)/usr/lib/node/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME)/build/Release
  58. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME)/build/Release/bindings.node \
  59. $(1)/usr/lib/node/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME)/build/Release/
  60. endef
  61. $(eval $(call BuildPackage,node-serialport-bindings))