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.

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