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.

65 lines
1.8 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:=3.0.0
  11. PKG_RELEASE:=3
  12. PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz
  13. PKG_SOURCE_URL:=http://registry.npmjs.org/$(PKG_NPM_NAME)/-/
  14. PKG_MD5SUM:=ea20a17746dd64e72d5f6f2019d9e28d
  15. PKG_BUILD_DEPENDS:=node/host
  16. PKG_NODE_VERSION:=4.4.5
  17. PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
  18. PKG_LICENSE:=Custom
  19. PKG_LICENSE_FILES:=LICENSE
  20. include $(INCLUDE_DIR)/package.mk
  21. define Package/node-serialport
  22. DEPENDS:=+node
  23. SUBMENU:=Node.js
  24. SECTION:=lang
  25. CATEGORY:=Languages
  26. TITLE:=Node.js package to access serial ports for reading and writing
  27. URL:=https://www.npmjs.org/package/serialport
  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. define Build/Prepare
  33. /bin/tar xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) --strip-components 1
  34. $(Build/Patch)
  35. endef
  36. CPU:=$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))
  37. EXTRA_LDFLAGS="-L$(TOOLCHAIN_DIR)/lib/ -Wl,-rpath-link $(TOOLCHAIN_DIR)/lib/" \
  38. define Build/Compile
  39. $(MAKE_FLAGS) \
  40. npm_config_arch=$(CONFIG_ARCH) \
  41. npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \
  42. npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache \
  43. PREFIX="$(PKG_INSTALL_DIR)/usr/" \
  44. $(STAGING_DIR)/host/bin/npm install --build-from-source --target_arch=$(CPU) -g $(PKG_BUILD_DIR)
  45. endef
  46. define Package/node-serialport/install
  47. mkdir -p $(1)/usr/lib/node/
  48. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node/
  49. endef
  50. $(eval $(call BuildPackage,node-serialport))