node-homebridge: update to 1.1.2 13219/head
authorHirokazu MORIKAWA <morikw2@gmail.com>
Wed, 26 Aug 2020 23:11:59 +0000 (08:11 +0900)
committerHirokazu MORIKAWA <morikw2@gmail.com>
Wed, 26 Aug 2020 23:15:58 +0000 (08:15 +0900)
update to 1.1.2
Add opkg package path to the homebrodge plugin module path.

Signed-off-by: Hirokazu MORIKAWA <morikw2@gmail.com>
lang/node-homebridge/Makefile
lang/node-homebridge/patches/000-add_module_search_path.patch [new file with mode: 0644]

index 748a30b86547291b7af0a012b19001e023e31b04..d786f07666a00d6d6dc8a2764170af2aa49be2bc 100644 (file)
@@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk
 
 PKG_NPM_NAME:=homebridge
 PKG_NAME:=node-$(PKG_NPM_NAME)
-PKG_VERSION:=1.1.1
+PKG_VERSION:=1.1.2
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz
-PKG_SOURCE_URL:=http://registry.npmjs.org/$(PKG_NPM_NAME)/-/
-PKG_HASH:=ccbd9e2e199a56f3b5749bb58dfad2fd629c3bc5fc55c36cc3f870061108b883
+PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_NPM_NAME)/-/
+PKG_HASH:=2cf7bf7334067fc1278644ff4981913517582817e6378583f2d54bcbd97a44f1
 
 PKG_BUILD_DEPENDS:=node/host
 PKG_USE_MIPS16:=0
@@ -34,16 +34,17 @@ endef
 
 define Package/node-homebridge/description
  Homebridge is a lightweight Node.js server you can run on your home network that emulates the iOS HomeKit API
+ *** You need to install avahi-nodbus-daemon or avahi-dbus-daemon or umdns or mdnsd package. ***
 endef
 
+TAR_OPTIONS+= --strip-components 1
+TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
+
 NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))))
 TMPNPM:=$(shell mktemp -u XXXXXXXXXX)
 
 TARGET_CFLAGS+=$(FPIC)
-
-define Build/Prepare
-       $(INSTALL_DIR) $(PKG_BUILD_DIR)
-endef
+TARGET_CPPFLAGS+=$(FPIC)
 
 define Build/Compile
        $(MAKE_VARS) \
@@ -55,14 +56,19 @@ define Build/Compile
        npm_config_prefix=$(PKG_INSTALL_DIR)/usr/ \
        npm_config_cache=$(TMP_DIR)/npm-cache-$(TMPNPM) \
        npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM) \
-       npm install -g $(DL_DIR)/$(PKG_SOURCE)
+       npm install -g $(PKG_BUILD_DIR)
        rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM)
        rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM)
 endef
 
 define Package/node-homebridge/install
-       $(INSTALL_DIR) $(1)/usr/lib/node
-       $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node/
+       $(INSTALL_DIR) $(1)/usr/lib/node/$(PKG_NPM_NAME)
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{*.json,*.md} \
+               $(1)/usr/lib/node/$(PKG_NPM_NAME)/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{node_modules,lib} \
+               $(1)/usr/lib/node/$(PKG_NPM_NAME)/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{LICENSE,bin} \
+               $(1)/usr/lib/node/$(PKG_NPM_NAME)/
        $(INSTALL_DIR) $(1)/usr/bin
        $(LN) ../lib/node/homebridge/bin/homebridge $(1)/usr/bin/homebridge
        $(INSTALL_DIR) $(1)/etc/init.d
diff --git a/lang/node-homebridge/patches/000-add_module_search_path.patch b/lang/node-homebridge/patches/000-add_module_search_path.patch
new file mode 100644 (file)
index 0000000..2655036
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/lib/pluginManager.js
++++ b/lib/pluginManager.js
+@@ -308,6 +308,7 @@
+             else {
+                 this.searchPaths.add("/usr/local/lib/node_modules");
+                 this.searchPaths.add("/usr/lib/node_modules");
++                this.searchPaths.add("/usr/lib/node");
+                 this.searchPaths.add(child_process_1.execSync("/bin/echo -n \"$(npm --no-update-notifier -g prefix)/lib/node_modules\"").toString("utf8"));
+             }
+         }