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.

83 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.8.1
  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:=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. $(STAGING_DIR_HOSTPKG)/bin/npm --prefix=$(1)/opt/mozilla-iot/gateway install $(1)/opt/mozilla-iot/gateway
  56. # Clean up of old build files that confuse OpenWrt's dependency checker
  57. $(RM) -r $(1)/opt/mozilla-iot/gateway/node_modules/sqlite3/lib/binding/node-v57-linux-x64
  58. $(RM) -r $(1)/opt/mozilla-iot/gateway/node_modules/ursa/build/Release/ursaNative.node
  59. $(RM) -r $(1)/opt/mozilla-iot/gateway/node_modules/ursa/build/Release/obj.target/ursaNative.node
  60. $(INSTALL_DIR) $(1)/opt/mozilla-iot/gateway/node_modules/sqlite3/lib/binding/node-v57-linux-$(CPU)/
  61. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/webthings-gateway/node_modules/sqlite3/lib/binding/node-v57-linux-$(CPU)/node_sqlite3.node \
  62. $(1)/opt/mozilla-iot/gateway/node_modules/sqlite3/lib/binding/node-v57-linux-$(CPU)/
  63. $(INSTALL_DIR) $(1)/etc/init.d
  64. $(INSTALL_BIN) ./files/mozilla-iot-gateway.init $(1)/etc/init.d/mozilla-iot-gateway
  65. endef
  66. $(eval $(call BuildPackage,node-mozilla-iot-gateway))