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.

99 lines
2.9 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.22.0
  11. PKG_RELEASE:=4
  12. PKG_SOURCE_PROTO:=git
  13. PKG_SOURCE_URL:=https://github.com/hybridgroup/cylon-firmata.git
  14. PKG_SOURCE_VERSION:=0c37da77e48b3e2cc3a8d566822a17689de91b40
  15. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
  16. PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
  17. PKG_BUILD_DEPENDS:=node/host
  18. PKG_NODE_VERSION:=4.4.5
  19. PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
  20. PKG_LICENSE:=Apache-2.0
  21. PKG_LICENSE_FILE:=LICENSE
  22. include $(INCLUDE_DIR)/package.mk
  23. define Package/node-cylon/default
  24. DEPENDS:=+node $(2)
  25. SUBMENU:=Node.js
  26. SECTION:=lang
  27. CATEGORY:=Languages
  28. TITLE:=CylonJS - $(1)
  29. URL:=https://www.npmjs.org/package/cylon
  30. endef
  31. define Package/node-cylon
  32. $(call Package/node-cylon/default,Core)
  33. endef
  34. define Package/node-cylon-i2c
  35. $(call Package/node-cylon/default,I2C,+node-cylon)
  36. endef
  37. define Package/node-cylon-gpio
  38. $(call Package/node-cylon/default,GPIO,+node-cylon)
  39. endef
  40. define Package/node-cylon-firmata
  41. $(call Package/node-cylon/default,Firmata,+node-cylon-gpio +node-cylon-i2c +node-arduino-firmata)
  42. endef
  43. define Package/node-cylon/description
  44. JavaScript Robotics, By Your Command Next generation robotics framework with support for 36 different platforms Get Started
  45. endef
  46. define Build/Prepare
  47. /bin/tar xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) --strip-components 1
  48. $(Build/Patch)
  49. endef
  50. EXTRA_LDFLAGS="-L$(TOOLCHAIN_DIR)/lib/ -Wl,-rpath-link $(TOOLCHAIN_DIR)/lib/" \
  51. define Build/Compile
  52. $(MAKE_FLAGS) \
  53. npm_config_arch=$(CONFIG_ARCH) \
  54. npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \
  55. npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache \
  56. PREFIX="$(PKG_INSTALL_DIR)/usr/" \
  57. $(STAGING_DIR)/host/bin/npm install -g $(PKG_BUILD_DIR)
  58. endef
  59. define Package/node-cylon/install
  60. mkdir -p $(1)/usr/lib/node/cylon
  61. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon/* $(1)/usr/lib/node/cylon/
  62. endef
  63. define Package/node-cylon-i2c/install
  64. mkdir -p $(1)/usr/lib/node/cylon-i2c
  65. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon-i2c/* $(1)/usr/lib/node/cylon-i2c/
  66. endef
  67. define Package/node-cylon-gpio/install
  68. mkdir -p $(1)/usr/lib/node/cylon-gpio
  69. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon-gpio/* $(1)/usr/lib/node/cylon-gpio/
  70. endef
  71. define Package/node-cylon-firmata/install
  72. mkdir -p $(1)/usr/lib/node/cylon-firmata
  73. $(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/
  74. endef
  75. $(eval $(call BuildPackage,node-cylon))
  76. $(eval $(call BuildPackage,node-cylon-i2c))
  77. $(eval $(call BuildPackage,node-cylon-gpio))
  78. $(eval $(call BuildPackage,node-cylon-firmata))