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.

71 lines
2.1 KiB

  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. include $(TOPDIR)/rules.mk
  8. PKG_NPM_NAME:=serialport
  9. PKG_NAME:=node-$(PKG_NPM_NAME)
  10. PKG_VERSION:=7.1.4
  11. PKG_RELEASE:=1
  12. PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz
  13. PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_NPM_NAME)/-/
  14. PKG_HASH:=d6f60bd81fe94578dee8e82887a66c5b007ec3f346b13d8156dd94a46f2b4849
  15. PKG_BUILD_DEPENDS:=node/host
  16. PKG_USE_MIPS16:=0
  17. PKG_MAINTAINER:=Hirokazu MORIKAWA <morikw2@gmail.com>
  18. PKG_LICENSE:=MIT
  19. PKG_LICENSE_FILES:=LICENSE
  20. include $(INCLUDE_DIR)/package.mk
  21. define Package/node-serialport
  22. SUBMENU:=Node.js
  23. SECTION:=lang
  24. CATEGORY:=Languages
  25. TITLE:=Node.js package to access serial ports
  26. URL:=https://serialport.io/
  27. DEPENDS:=+node +node-npm
  28. endef
  29. define Package/node-serialport/description
  30. Node.js package to access serial ports for reading and writing OR Welcome your robotic JavaScript overlords. Better yet, program them!
  31. endef
  32. TAR_OPTIONS+= --strip-components 1
  33. TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
  34. NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))))
  35. define Build/Compile
  36. $(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 \
  44. npm_config_tmp=$(TMP_DIR)/npm-tmp \
  45. npm install -g --build-from-source $(PKG_BUILD_DIR)
  46. rm -rf $(TMP_DIR)/npm-tmp
  47. rm -rf $(TMP_DIR)/npm-cache
  48. endef
  49. define Package/node-serialport/install
  50. $(INSTALL_DIR) $(1)/usr/lib/node/$(PKG_NPM_NAME)
  51. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{package.json,LICENSE,*.md} \
  52. $(1)/usr/lib/node/$(PKG_NPM_NAME)/
  53. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/test.js \
  54. $(1)/usr/lib/node/$(PKG_NPM_NAME)/
  55. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{node_modules,lib} \
  56. $(1)/usr/lib/node/$(PKG_NPM_NAME)/
  57. endef
  58. $(eval $(call BuildPackage,node-serialport))