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.

74 lines
2.6 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.2
  9. PKG_RELEASE:=1
  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:=03e28d0ef191f3e3f2cf9215c2f2f43106e85638a8d3bd210127781cb73ed50a
  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. define Build/Compile
  37. $(MAKE_VARS) \
  38. $(MAKE_FLAGS) \
  39. npm_config_arch=$(NODEJS_CPU) \
  40. npm_config_target_arch=$(NODEJS_CPU) \
  41. npm_config_build_from_source=true \
  42. npm_config_nodedir=$(STAGING_DIR)/usr/ \
  43. npm_config_prefix=$(PKG_INSTALL_DIR)/usr/ \
  44. npm_config_cache=$(TMP_DIR)/npm-cache-$(TMPNPM) \
  45. npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM) \
  46. npm install -g --build-from-source $(PKG_BUILD_DIR)
  47. rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM)
  48. rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM)
  49. endef
  50. define Package/node-serialport-bindings/install
  51. $(INSTALL_DIR) $(1)/usr/lib/node/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME)
  52. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME)/{package.json,LICENSE,*.md} \
  53. $(1)/usr/lib/node/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME)
  54. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME)/{node_modules,lib} \
  55. $(1)/usr/lib/node/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME)
  56. $(INSTALL_DIR) $(1)/usr/lib/node/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME)/build/Release
  57. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME)/build/Release/bindings.node \
  58. $(1)/usr/lib/node/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME)/build/Release/
  59. endef
  60. $(eval $(call BuildPackage,node-serialport-bindings))