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:=6.1.1
  11. PKG_RELEASE:=1
  12. PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz
  13. PKG_SOURCE_URL:=http://registry.npmjs.org/$(PKG_NPM_NAME)/-/
  14. PKG_HASH:=b58c326d217fb0af1639e4ea834d9fca4be16934c486499e2ddac6e52b8dd560
  15. PKG_BUILD_DEPENDS:=node/host
  16. PKG_NODE_VERSION:=8.10.0
  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. SUBMENU:=Node.js
  23. SECTION:=lang
  24. CATEGORY:=Languages
  25. TITLE:=Node.js package to access serial ports for reading and writing
  26. URL:=https://www.npmjs.org/package/serialport
  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. 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. 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))