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.

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