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.

81 lines
3.1 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.7.0
  11. PKG_RELEASE:=1
  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:=a5ff36942b686ea39f6d1e5d369cd783d6e2265f19262856647de7e596aa1a77
  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:=Things 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. define Build/Compile
  42. $(MAKE_VARS) \
  43. $(MAKE_FLAGS) \
  44. npm_config_arch=$(CONFIG_ARCH) \
  45. npm_config_nodedir=$(STAGING_DIR)/usr/ \
  46. npm_config_cache=$(TMP_DIR)/npm-cache \
  47. npm_config_tmp=$(TMP_DIR)/npm-tmp \
  48. PREFIX="$(PKG_INSTALL_DIR)/usr/" \
  49. $(STAGING_DIR_HOSTPKG)/bin/npm install --build-from-source --target_arch=$(CPU) -g $(DL_DIR)/$(PKG_SOURCE)
  50. endef
  51. define Package/node-mozilla-iot-gateway/install
  52. $(INSTALL_DIR) $(1)/opt/mozilla-iot/gateway/
  53. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/things-gateway/* $(1)/opt/mozilla-iot/gateway
  54. $(STAGING_DIR_HOSTPKG)/bin/npm --prefix=$(1)/opt/mozilla-iot/gateway install $(1)/opt/mozilla-iot/gateway
  55. # Clean up of old build files that confuse OpenWrt's dependency checker
  56. $(RM) -r $(1)/opt/mozilla-iot/gateway/node_modules/sqlite3/lib/binding/node-v57-linux-x64
  57. $(RM) -r $(1)/opt/mozilla-iot/gateway/node_modules/ursa-optional/build/Release/ursaNative.node
  58. $(RM) -r $(1)/opt/mozilla-iot/gateway/node_modules/ursa-optional/build/Release/obj.target/ursaNative.node
  59. $(INSTALL_DIR) $(1)/opt/mozilla-iot/gateway/node_modules/sqlite3/lib/binding/node-v57-linux-$(CPU)/
  60. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/things-gateway/node_modules/sqlite3/lib/binding/node-v57-linux-$(CPU)/node_sqlite3.node \
  61. $(1)/opt/mozilla-iot/gateway/node_modules/sqlite3/lib/binding/node-v57-linux-$(CPU)/
  62. $(INSTALL_DIR) $(1)/etc/init.d
  63. $(INSTALL_BIN) ./files/mozilla-iot-gateway.init $(1)/etc/init.d/mozilla-iot-gateway
  64. endef
  65. $(eval $(call BuildPackage,node-mozilla-iot-gateway))