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
2.6 KiB

  1. # This is free software, licensed under the GNU General Public License v2.
  2. # See /LICENSE for more information.
  3. #
  4. include $(TOPDIR)/rules.mk
  5. PKG_NPM_NAME:=homebridge
  6. PKG_NAME:=node-$(PKG_NPM_NAME)
  7. PKG_VERSION:=1.2.4
  8. PKG_RELEASE:=2
  9. PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz
  10. PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_NPM_NAME)/-/
  11. PKG_HASH:=f91ab0058707a0498d97d87f45f19682065f80660fac942e0985caf9bb205f2a
  12. PKG_BUILD_DEPENDS:=node/host
  13. PKG_USE_MIPS16:=0
  14. PKG_MAINTAINER:=Hirokazu MORIKAWA <morikw2@gmail.com>
  15. PKG_LICENSE:=ISC Apache-2.0
  16. PKG_LICENSE_FILES:=LICENSE
  17. include $(INCLUDE_DIR)/package.mk
  18. define Package/node-homebridge
  19. SUBMENU:=Node.js
  20. SECTION:=lang
  21. CATEGORY:=Languages
  22. TITLE:=Node.js HomeKit Server
  23. URL:=https://www.npmjs.org/package/homebridge
  24. DEPENDS:=+node +node-npm
  25. USERID:=homebridge:homebridge
  26. endef
  27. define Package/node-homebridge/description
  28. Homebridge is a lightweight Node.js server you can run on your home network that emulates the iOS HomeKit API
  29. *** You need to install avahi-nodbus-daemon or avahi-dbus-daemon or umdns or mdnsd package. ***
  30. endef
  31. TAR_OPTIONS+= --strip-components 1
  32. TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
  33. NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))))
  34. TMPNPM:=$(shell mktemp -u XXXXXXXXXX)
  35. TARGET_CFLAGS+=$(FPIC)
  36. TARGET_CPPFLAGS+=$(FPIC)
  37. NPM_FLAGS=$(MAKE_VARS) \
  38. $(MAKE_FLAGS) \
  39. npm_config_arch=$(NODEJS_CPU) \
  40. npm_config_target_arch=$(NODEJS_CPU) \
  41. npm_config_build_from_source=true \
  42. npm_config_nodedir=$(STAGING_DIR)/usr/ \
  43. npm_config_prefix=$(PKG_INSTALL_DIR)/usr/ \
  44. npm_config_cache=$(TMP_DIR)/npm-cache-$(TMPNPM) \
  45. npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM)
  46. define Build/Compile
  47. $(NPM_FLAGS) npm i -g --production $(PKG_BUILD_DIR)
  48. $(NPM_FLAGS) npm i --production --prefix=$(PKG_BUILD_DIR) --target_arch=$(NODEJS_CPU) --prefer-dedupe
  49. npm install -g $(PKG_BUILD_DIR)
  50. rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM)
  51. rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM)
  52. endef
  53. define Package/node-homebridge/install
  54. $(INSTALL_DIR) $(1)/usr/lib/node/$(PKG_NPM_NAME)
  55. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{*.json,*.md} \
  56. $(1)/usr/lib/node/$(PKG_NPM_NAME)/
  57. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{node_modules,lib} \
  58. $(1)/usr/lib/node/$(PKG_NPM_NAME)/
  59. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{LICENSE,bin} \
  60. $(1)/usr/lib/node/$(PKG_NPM_NAME)/
  61. $(INSTALL_DIR) $(1)/usr/bin
  62. $(LN) ../lib/node/$(PKG_NPM_NAME)/bin/homebridge $(1)/usr/bin/homebridge
  63. $(INSTALL_DIR) $(1)/etc/init.d
  64. $(INSTALL_BIN) ./files/homebridge.init $(1)/etc/init.d/homebridge
  65. endef
  66. $(eval $(call BuildPackage,node-homebridge))