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.

100 lines
3.0 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:=6
  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_MIRROR_HASH:=e531d3c92965518c60d52bc497bfa9be563ee68c3cf65c77fa55d5e9c2627367
  18. PKG_BUILD_DEPENDS:=node/host
  19. PKG_NODE_VERSION:=4.4.5
  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. DEPENDS:=+node +node-npm $(2)
  26. SUBMENU:=Node.js
  27. SECTION:=lang
  28. CATEGORY:=Languages
  29. TITLE:=CylonJS - $(1)
  30. URL:=https://www.npmjs.org/package/cylon
  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. $(MAKE_FLAGS) \
  54. npm_config_arch=$(CONFIG_ARCH) \
  55. npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \
  56. npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache \
  57. PREFIX="$(PKG_INSTALL_DIR)/usr/" \
  58. npm install -g $(PKG_BUILD_DIR)
  59. endef
  60. define Package/node-cylon/install
  61. mkdir -p $(1)/usr/lib/node/cylon
  62. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon/* $(1)/usr/lib/node/cylon/
  63. endef
  64. define Package/node-cylon-i2c/install
  65. mkdir -p $(1)/usr/lib/node/cylon-i2c
  66. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon-i2c/* $(1)/usr/lib/node/cylon-i2c/
  67. endef
  68. define Package/node-cylon-gpio/install
  69. mkdir -p $(1)/usr/lib/node/cylon-gpio
  70. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon-gpio/* $(1)/usr/lib/node/cylon-gpio/
  71. endef
  72. define Package/node-cylon-firmata/install
  73. mkdir -p $(1)/usr/lib/node/cylon-firmata
  74. $(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/
  75. endef
  76. $(eval $(call BuildPackage,node-cylon))
  77. $(eval $(call BuildPackage,node-cylon-i2c))
  78. $(eval $(call BuildPackage,node-cylon-gpio))
  79. $(eval $(call BuildPackage,node-cylon-firmata))