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.

105 lines
3.3 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:=cylon
  9. PKG_NAME:=node-$(PKG_NPM_NAME)
  10. PKG_VERSION:=0.24.0
  11. PKG_RELEASE:=2
  12. PKG_SOURCE_PROTO:=git
  13. PKG_SOURCE_URL:=https://github.com/hybridgroup/cylon-firmata.git
  14. PKG_SOURCE_VERSION:=a930f8446f23ec2cb28aadeff54b79ab7704e3a0
  15. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
  16. PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
  17. PKG_MIRROR_HASH:=dceb75539d32f402db0a5f68f2c7e2b52e5547a5ac2dec875d34fd3cc95cce00
  18. PKG_BUILD_DEPENDS:=node/host
  19. PKG_NODE_VERSION:=`$(STAGING_DIR_HOSTPKG)/bin/node --version`
  20. PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
  21. PKG_LICENSE:=Apache-2.0
  22. PKG_LICENSE_FILES:=LICENSE
  23. include $(INCLUDE_DIR)/package.mk
  24. define Package/node-cylon/default
  25. SUBMENU:=Node.js
  26. SECTION:=lang
  27. CATEGORY:=Languages
  28. TITLE:=CylonJS - $(1)
  29. URL:=https://www.npmjs.org/package/cylon
  30. DEPENDS:=+node +node-npm $(2)
  31. endef
  32. define Package/node-cylon
  33. $(call Package/node-cylon/default,Core)
  34. endef
  35. define Package/node-cylon-i2c
  36. $(call Package/node-cylon/default,I2C,+node-cylon)
  37. endef
  38. define Package/node-cylon-gpio
  39. $(call Package/node-cylon/default,GPIO,+node-cylon)
  40. endef
  41. define Package/node-cylon-firmata
  42. $(call Package/node-cylon/default,Firmata,+node-cylon-gpio +node-cylon-i2c +node-arduino-firmata)
  43. endef
  44. define Package/node-cylon/description
  45. JavaScript Robotics, By Your Command Next generation robotics framework with support for 36 different platforms Get Started
  46. endef
  47. define Build/Prepare
  48. /bin/tar xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) --strip-components 1
  49. $(Build/Patch)
  50. endef
  51. EXTRA_LDFLAGS="-L$(TOOLCHAIN_DIR)/lib/ -Wl,-rpath-link $(TOOLCHAIN_DIR)/lib/" \
  52. define Build/Compile
  53. cd $(PKG_BUILD_DIR) ; \
  54. $(MAKE_FLAGS) \
  55. npm_config_arch=$(CONFIG_ARCH) \
  56. npm_config_nodedir=$(BUILD_DIR)/node-$(PKG_NODE_VERSION)/ \
  57. npm_config_cache=$(BUILD_DIR)/node-$(PKG_NODE_VERSION)/npm-cache \
  58. PREFIX="$(PKG_INSTALL_DIR)/usr/" \
  59. npm install -g `npm pack $(PKG_BUILD_DIR) | tail -n 1`
  60. endef
  61. define Package/node-cylon/install
  62. mkdir -p $(1)/usr/lib/node/cylon
  63. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon/* $(1)/usr/lib/node/cylon/
  64. endef
  65. define Package/node-cylon-i2c/install
  66. mkdir -p $(1)/usr/lib/node/cylon-i2c
  67. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon-i2c/* $(1)/usr/lib/node/cylon-i2c/
  68. endef
  69. define Package/node-cylon-gpio/install
  70. mkdir -p $(1)/usr/lib/node/cylon-gpio
  71. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon-gpio/* $(1)/usr/lib/node/cylon-gpio/
  72. endef
  73. define Package/node-cylon-firmata/install
  74. mkdir -p $(1)/usr/lib/node/cylon-firmata
  75. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/{index.js,lib,LICENSE,package.json,README.md,RELEASES.md,spec} $(1)/usr/lib/node/cylon-firmata/
  76. # Strip PKG_BUILD_DIR from useless metadata inserted by npm install
  77. # https://github.com/npm/npm/issues/10393
  78. # https://github.com/npm/npm/issues/12110
  79. find $(1)/usr/lib/node -name package.json -exec sed -i -e 's,$(PKG_BUILD_DIR),,g' {} +
  80. endef
  81. $(eval $(call BuildPackage,node-cylon))
  82. $(eval $(call BuildPackage,node-cylon-i2c))
  83. $(eval $(call BuildPackage,node-cylon-gpio))
  84. $(eval $(call BuildPackage,node-cylon-firmata))