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.

78 lines
2.5 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:=1
  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. define Build/Compile
  38. $(MAKE_VARS) \
  39. $(MAKE_FLAGS) \
  40. npm_config_arch=$(NODEJS_CPU) \
  41. npm_config_target_arch=$(NODEJS_CPU) \
  42. npm_config_build_from_source=true \
  43. npm_config_nodedir=$(STAGING_DIR)/usr/ \
  44. npm_config_prefix=$(PKG_INSTALL_DIR)/usr/ \
  45. npm_config_cache=$(TMP_DIR)/npm-cache-$(TMPNPM) \
  46. npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM) \
  47. npm install -g $(PKG_BUILD_DIR)
  48. rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM)
  49. rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM)
  50. endef
  51. define Package/node-homebridge/install
  52. $(INSTALL_DIR) $(1)/usr/lib/node/$(PKG_NPM_NAME)
  53. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{*.json,*.md} \
  54. $(1)/usr/lib/node/$(PKG_NPM_NAME)/
  55. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{node_modules,lib} \
  56. $(1)/usr/lib/node/$(PKG_NPM_NAME)/
  57. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{LICENSE,bin} \
  58. $(1)/usr/lib/node/$(PKG_NPM_NAME)/
  59. $(INSTALL_DIR) $(1)/usr/bin
  60. $(LN) ../lib/node/$(PKG_NPM_NAME)/bin/homebridge $(1)/usr/bin/homebridge
  61. $(INSTALL_DIR) $(1)/etc/init.d
  62. $(INSTALL_BIN) ./files/homebridge.init $(1)/etc/init.d/homebridge
  63. endef
  64. $(eval $(call BuildPackage,node-homebridge))