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.

71 lines
2.5 KiB

  1. #
  2. # Copyright (C) 2018 Sartura Ltd.
  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:=mozilla-iot-gateway
  9. PKG_NAME:=node-$(PKG_NPM_NAME)
  10. PKG_VERSION:=0.3.1
  11. PKG_RELEASE:=1
  12. PKG_SOURCE_PROTO:=git
  13. PKG_SOURCE_URL:=https://github.com/mozilla-iot/gateway.git
  14. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  15. PKG_SOURCE_VERSION:=v$(PKG_VERSION)
  16. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  17. PKG_MIRROR_HASH:=ba05bc3e93c36768244df922434e7132c2dae85a1ff9e3213beea087a4844d11
  18. PKG_BUILD_DEPENDS:=node/host openzwave
  19. PKG_MAINTAINER:=Marko Ratkaj <marko.ratkaj@sartura.hr>
  20. PKG_LICENSE:=MPL-2.0
  21. PKG_LICENSE_FILES:=LICENSE
  22. include $(INCLUDE_DIR)/package.mk
  23. define Package/node-mozilla-iot-gateway
  24. SUBMENU:=Node.js
  25. SECTION:=lang
  26. CATEGORY:=Languages
  27. TITLE:=Things Gateway by Mozilla
  28. URL:=https://iot.mozilla.org/gateway/
  29. DEPENDS:=+node +node-npm +libopenzwave +python +openssl-util
  30. endef
  31. define Package/node-mozilla-iot-gateway/description
  32. Build Your Own Web of Things Gateway. The "Web of Things" (WoT) is the
  33. idea of taking the lessons learned from the World Wide Web and applying
  34. them to IoT. It's about creating a decentralized Internet of Things by
  35. giving Things URLs on the web to make them linkable and discoverable,
  36. and defining a standard data model and APIs to make them interoperable.
  37. endef
  38. CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))))
  39. define Build/Compile
  40. $(MAKE_VARS) \
  41. $(MAKE_FLAGS) \
  42. npm_config_arch=$(CONFIG_ARCH) \
  43. npm_config_nodedir=$(STAGING_DIR)/usr/ \
  44. npm_config_cache=$(TMP_DIR)/npm-cache \
  45. npm_config_tmp=$(TMP_DIR)/npm-tmp \
  46. PREFIX="$(PKG_INSTALL_DIR)/usr/" \
  47. $(STAGING_DIR_HOSTPKG)/bin/npm install --build-from-source --target_arch=$(CPU) -g $(DL_DIR)/$(PKG_SOURCE)
  48. endef
  49. define Package/node-mozilla-iot-gateway/install
  50. $(INSTALL_DIR) $(1)/opt/mozilla-iot/gateway
  51. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/things-gateway/* $(1)/opt/mozilla-iot/gateway
  52. $(STAGING_DIR_HOSTPKG)/bin/npm --prefix=$(1)/opt/mozilla-iot/gateway install $(1)/opt/mozilla-iot/gateway
  53. $(LN) ../constants.js $(1)/opt/mozilla-iot/gateway/src/addons/addon-constants.js
  54. $(LN) /tmp/mozilla-iot/gateway/run-app.log $(1)/opt/mozilla-iot/gateway/run-app.log
  55. $(INSTALL_DIR) $(1)/etc/init.d
  56. $(INSTALL_BIN) ./files/mozilla-iot-gateway.init $(1)/etc/init.d/mozilla-iot-gateway
  57. endef
  58. $(eval $(call BuildPackage,node-mozilla-iot-gateway))