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.

114 lines
3.4 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:=4
  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. TMPNPM:=$(shell mktemp -u XXXXXXXXXX)
  50. TARGET_CFLAGS+=$(FPIC)
  51. TARGET_CPPFLAGS+=$(FPIC)
  52. NPM_FLAGS:= \
  53. $(MAKE_VARS) \
  54. $(MAKE_FLAGS) \
  55. npm_config_arch=$(NODEJS_CPU) \
  56. npm_config_target_arch=$(NODEJS_CPU) \
  57. npm_config_build_from_source=true \
  58. npm_config_nodedir=$(STAGING_DIR)/usr/ \
  59. npm_config_prefix=$(PKG_INSTALL_DIR)/usr/ \
  60. npm_config_cache=$(TMP_DIR)/npm-cache-$(TMPNPM) \
  61. npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM)
  62. define Build/Compile
  63. $(NPM_FLAGS) npm i -g --production $(PKG_BUILD_DIR)
  64. $(NPM_FLAGS) npm i --production --prefix=$(PKG_BUILD_DIR) --target_arch=$(NODEJS_CPU) --prefer-dedupe
  65. rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM)
  66. rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM)
  67. endef
  68. define Package/node-cylon/install
  69. $(INSTALL_DIR) $(1)/usr/lib/node/cylon
  70. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon/* $(1)/usr/lib/node/cylon/
  71. endef
  72. define Package/node-cylon-i2c/install
  73. $(INSTALL_DIR) $(1)/usr/lib/node/cylon-i2c
  74. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon-i2c/* $(1)/usr/lib/node/cylon-i2c/
  75. endef
  76. define Package/node-cylon-gpio/install
  77. $(INSTALL_DIR) $(1)/usr/lib/node/cylon-gpio
  78. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon-gpio/* $(1)/usr/lib/node/cylon-gpio/
  79. endef
  80. define Package/node-cylon-firmata/install
  81. $(INSTALL_DIR) $(1)/usr/lib/node/cylon-firmata
  82. $(CP) $(PKG_BUILD_DIR)/{package.json,LICENSE,*.md} \
  83. $(1)/usr/lib/node/cylon-firmata/
  84. $(CP) $(PKG_BUILD_DIR)/{docs,examples,*.js} \
  85. $(1)/usr/lib/node/cylon-firmata/
  86. $(CP) $(PKG_BUILD_DIR)/{lib,spec} \
  87. $(1)/usr/lib/node/cylon-firmata/
  88. endef
  89. $(eval $(call BuildPackage,node-cylon))
  90. $(eval $(call BuildPackage,node-cylon-i2c))
  91. $(eval $(call BuildPackage,node-cylon-gpio))
  92. $(eval $(call BuildPackage,node-cylon-firmata))