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.

72 lines
2.0 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:=0.4.48
  8. PKG_RELEASE:=2
  9. PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz
  10. PKG_SOURCE_URL:=http://registry.npmjs.org/$(PKG_NPM_NAME)/-/
  11. PKG_HASH:=020a4d882c04ed26a3c96b8a5e82768b29309cf461aa9a17f330887ed12e3e6b
  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. endef
  30. NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))))
  31. TMPNPM:=$(shell mktemp -u XXXXXXXXXX)
  32. TARGET_CFLAGS+=$(FPIC)
  33. define Build/Prepare
  34. $(INSTALL_DIR) $(PKG_BUILD_DIR)
  35. endef
  36. define Build/Compile
  37. $(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. npm install -g $(DL_DIR)/$(PKG_SOURCE)
  47. rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM)
  48. rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM)
  49. endef
  50. define Package/node-homebridge/install
  51. $(INSTALL_DIR) $(1)/usr/lib/node
  52. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node/
  53. $(INSTALL_DIR) $(1)/usr/bin
  54. $(LN) ../lib/node/homebridge/bin/homebridge $(1)/usr/bin/homebridge
  55. $(INSTALL_DIR) $(1)/etc/init.d
  56. $(INSTALL_BIN) ./files/homebridge.init $(1)/etc/init.d/homebridge
  57. endef
  58. $(eval $(call BuildPackage,node-homebridge))