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.

107 lines
3.2 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_SRC_NAME:=$(PKG_NPM_NAME)-firmata
  11. PKG_VERSION:=0.24.0
  12. PKG_RELEASE:=3
  13. PKG_SOURCE:=$(PKG_SRC_NAME)-$(PKG_VERSION).tgz
  14. PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_SRC_NAME)/-/
  15. PKG_HASH:=06ac7a8e2e6012577d2f4b043af766bf28a1d3e2a0d50e46629dab4f0bb65104
  16. PKG_SOURCE_SUBDIR:=$(PKG_SRC_NAME)-$(PKG_VERSION)
  17. PKG_BUILD_DEPENDS:=node/host
  18. PKG_USE_MIPS16:=0
  19. PKG_MAINTAINER:=Hirokazu MORIKAWA <morikw2@gmail.com>
  20. PKG_LICENSE:=Apache-2.0
  21. PKG_LICENSE_FILES:=LICENSE
  22. include $(INCLUDE_DIR)/package.mk
  23. define Package/node-cylon/default
  24. SUBMENU:=Node.js
  25. SECTION:=lang
  26. CATEGORY:=Languages
  27. TITLE:=CylonJS - $(1)
  28. URL:=https://www.npmjs.org/package/cylon-firmata
  29. DEPENDS:=+node +node-npm $(2)
  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. TAR_OPTIONS+= --strip-components 1
  47. TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
  48. NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))))
  49. define Build/Compile
  50. $(MAKE_VARS) \
  51. $(MAKE_FLAGS) \
  52. npm_config_arch=$(NODEJS_CPU) \
  53. npm_config_target_arch=$(NODEJS_CPU) \
  54. npm_config_build_from_source=true \
  55. npm_config_nodedir=$(STAGING_DIR)/usr/ \
  56. npm_config_prefix=$(PKG_INSTALL_DIR)/usr/ \
  57. npm_config_cache=$(TMP_DIR)/npm-cache \
  58. npm_config_tmp=$(TMP_DIR)/npm-tmp \
  59. npm install -g $(PKG_BUILD_DIR)
  60. rm -rf $(TMP_DIR)/npm-tmp
  61. rm -rf $(TMP_DIR)/npm-cache
  62. endef
  63. define Package/node-cylon/install
  64. $(INSTALL_DIR) $(1)/usr/lib/node/cylon
  65. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon/* $(1)/usr/lib/node/cylon/
  66. endef
  67. define Package/node-cylon-i2c/install
  68. $(INSTALL_DIR) $(1)/usr/lib/node/cylon-i2c
  69. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon-i2c/* $(1)/usr/lib/node/cylon-i2c/
  70. endef
  71. define Package/node-cylon-gpio/install
  72. $(INSTALL_DIR) $(1)/usr/lib/node/cylon-gpio
  73. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon-gpio/* $(1)/usr/lib/node/cylon-gpio/
  74. endef
  75. define Package/node-cylon-firmata/install
  76. $(INSTALL_DIR) $(1)/usr/lib/node/cylon-firmata
  77. $(CP) $(PKG_BUILD_DIR)/{package.json,LICENSE,*.md} \
  78. $(1)/usr/lib/node/cylon-firmata/
  79. $(CP) $(PKG_BUILD_DIR)/{docs,examples,*.js} \
  80. $(1)/usr/lib/node/cylon-firmata/
  81. $(CP) $(PKG_BUILD_DIR)/{lib,spec} \
  82. $(1)/usr/lib/node/cylon-firmata/
  83. endef
  84. $(eval $(call BuildPackage,node-cylon))
  85. $(eval $(call BuildPackage,node-cylon-i2c))
  86. $(eval $(call BuildPackage,node-cylon-gpio))
  87. $(eval $(call BuildPackage,node-cylon-firmata))