From 5182b9970155fc3a4b0c823de299278c3b69d48c Mon Sep 17 00:00:00 2001 From: Beginner <70857188+Beginner-Go@users.noreply.github.com> Date: Mon, 23 May 2022 22:43:07 +0800 Subject: [PATCH] node-*: support for npm@8 (#414) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * node-homebridge: Support for npm@8 With the upgrade of node.js to version 16, the npm version will also change to version 8. This fix is to support npm@8. npm@6 can also build without problems. Signed-off-by: Hirokazu MORIKAWA * Revert "node-yarn: bump to v1.22.17" This reverts commit 38b18a50f22ff132596439adca0cdef98bedbb9a. * node-yarn: Support for npm@8 With the upgrade of node.js to version 16, the npm version will also change to version 8. This fix is to support npm@8. npm@6 can also build without problems. Signed-off-by: Hirokazu MORIKAWA * node-hid: Support for npm@8 With the upgrade of node.js to version 16, the npm version will also change to version 8. This fix is to support npm@8. npm@6 can also build without problems. Signed-off-by: Hirokazu MORIKAWA * javascript-obfuscator: bump to 2.19.0 and switch to autorelease New version of package node-javascript-obfuscator. Signed-off-by: Zbyněk Kocur * node-javascript-obfuscator: Support for npm@8 With the upgrade of node.js to version 16, the npm version will also change to version 8. This fix is to support npm@8. npm@6 can also build without problems. The modification method is different from other node modules. The reason is due to the npm@8 issue. https://github.com/npm/cli/issues/4027 Signed-off-by: Hirokazu MORIKAWA * node-serialport: Support for npm@8 With the upgrade of node.js to version 16, the npm version will also change to version 8. This fix is to support npm@8. npm@6 can also build without problems. Signed-off-by: Hirokazu MORIKAWA * node-cylon: Support for npm@8 With the upgrade of node.js to version 16, the npm version will also change to version 8. This fix is to support npm@8. npm@6 can also build without problems. Signed-off-by: Hirokazu MORIKAWA * node-arduino-firmata: Support for npm@8 With the upgrade of node.js to version 16, the npm version will also change to version 8. This fix is to support npm@8. npm@6 can also build without problems. Signed-off-by: Hirokazu MORIKAWA * node-serialport-bindings: Support for npm@8 With the upgrade of node.js to version 16, the npm version will also change to version 8. This fix is to support npm@8. npm@6 can also build without problems. Signed-off-by: Hirokazu MORIKAWA Co-authored-by: Hirokazu MORIKAWA Co-authored-by: Zbyněk Kocur --- lang/node-arduino-firmata/Makefile | 21 ++++--- lang/node-cylon/Makefile | 21 ++++--- lang/node-hid/Makefile | 14 +++-- lang/node-homebridge/Makefile | 11 ++-- lang/node-javascript-obfuscator/Makefile | 42 +++++++------ lang/node-serialport-bindings/Makefile | 12 ++-- lang/node-serialport/Makefile | 13 ++-- lang/node-yarn/Makefile | 76 ++++++------------------ 8 files changed, 102 insertions(+), 108 deletions(-) diff --git a/lang/node-arduino-firmata/Makefile b/lang/node-arduino-firmata/Makefile index fd2b3f4c..c915afb5 100644 --- a/lang/node-arduino-firmata/Makefile +++ b/lang/node-arduino-firmata/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NPM_NAME:=arduino-firmata PKG_NAME:=node-$(PKG_NPM_NAME) PKG_VERSION:=0.3.4 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_NPM_NAME)/-/ @@ -42,8 +42,12 @@ 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) -define Build/Compile +TARGET_CFLAGS+=$(FPIC) +TARGET_CPPFLAGS+=$(FPIC) + +NPM_FLAGS:= \ $(MAKE_VARS) \ $(MAKE_FLAGS) \ npm_config_arch=$(NODEJS_CPU) \ @@ -51,11 +55,14 @@ define Build/Compile npm_config_build_from_source=true \ npm_config_nodedir=$(STAGING_DIR)/usr/ \ npm_config_prefix=$(PKG_INSTALL_DIR)/usr/ \ - npm_config_cache=$(TMP_DIR)/npm-cache \ - npm_config_tmp=$(TMP_DIR)/npm-tmp \ - npm install -g $(PKG_BUILD_DIR) - rm -rf $(TMP_DIR)/npm-tmp - rm -rf $(TMP_DIR)/npm-cache + npm_config_cache=$(TMP_DIR)/npm-cache-$(TMPNPM) \ + npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM) + +define Build/Compile + $(NPM_FLAGS) npm i -g --production $(PKG_BUILD_DIR) + $(NPM_FLAGS) npm i --production --prefix=$(PKG_BUILD_DIR) --target_arch=$(NODEJS_CPU) --prefer-dedupe + rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM) + rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM) endef define Package/node-arduino-firmata/install diff --git a/lang/node-cylon/Makefile b/lang/node-cylon/Makefile index 2e5da4e3..347b6bbb 100644 --- a/lang/node-cylon/Makefile +++ b/lang/node-cylon/Makefile @@ -11,7 +11,7 @@ PKG_NPM_NAME:=cylon PKG_NAME:=node-$(PKG_NPM_NAME) PKG_SRC_NAME:=$(PKG_NPM_NAME)-firmata PKG_VERSION:=0.24.0 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE:=$(PKG_SRC_NAME)-$(PKG_VERSION).tgz PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_SRC_NAME)/-/ @@ -60,8 +60,12 @@ 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) -define Build/Compile +TARGET_CFLAGS+=$(FPIC) +TARGET_CPPFLAGS+=$(FPIC) + +NPM_FLAGS:= \ $(MAKE_VARS) \ $(MAKE_FLAGS) \ npm_config_arch=$(NODEJS_CPU) \ @@ -69,11 +73,14 @@ define Build/Compile npm_config_build_from_source=true \ npm_config_nodedir=$(STAGING_DIR)/usr/ \ npm_config_prefix=$(PKG_INSTALL_DIR)/usr/ \ - npm_config_cache=$(TMP_DIR)/npm-cache \ - npm_config_tmp=$(TMP_DIR)/npm-tmp \ - npm install -g $(PKG_BUILD_DIR) - rm -rf $(TMP_DIR)/npm-tmp - rm -rf $(TMP_DIR)/npm-cache + npm_config_cache=$(TMP_DIR)/npm-cache-$(TMPNPM) \ + npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM) + +define Build/Compile + $(NPM_FLAGS) npm i -g --production $(PKG_BUILD_DIR) + $(NPM_FLAGS) npm i --production --prefix=$(PKG_BUILD_DIR) --target_arch=$(NODEJS_CPU) --prefer-dedupe + rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM) + rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM) endef define Package/node-cylon/install diff --git a/lang/node-hid/Makefile b/lang/node-hid/Makefile index 008eac69..ae9c7793 100644 --- a/lang/node-hid/Makefile +++ b/lang/node-hid/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NPM_NAME:=node-hid PKG_NAME:=$(PKG_NPM_NAME) PKG_VERSION:=2.1.1 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_NPM_NAME)/-/ @@ -48,9 +48,7 @@ TMPNPM:=$(shell mktemp -u XXXXXXXXXX) TARGET_CFLAGS+=$(FPIC) -I$(STAGING_DIR)/usr/include/libusb-1.0 TARGET_LDFLAGS+=$(if $(ICONV_FULL),-liconv) -define Build/Compile - GYP_DEFINES='driver="hidraw"' \ - $(MAKE_VARS) \ +NPM_FLAGS=$(MAKE_VARS) \ $(MAKE_FLAGS) \ npm_config_arch=$(NODEJS_CPU) \ npm_config_target_arch=$(NODEJS_CPU) \ @@ -58,8 +56,12 @@ define Build/Compile npm_config_nodedir=$(STAGING_DIR)/usr/ \ 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 $(PKG_BUILD_DIR) + npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM) + +define Build/Compile + $(NPM_FLAGS) npm i -g --production $(PKG_BUILD_DIR) --ignore-scripts + GYP_DEFINES='driver="hidraw"' \ + $(NPM_FLAGS) npm i --production --prefix=$(PKG_BUILD_DIR) --target_arch=$(NODEJS_CPU) --prefer-dedupe rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM) rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM) endef diff --git a/lang/node-homebridge/Makefile b/lang/node-homebridge/Makefile index 209e1a0b..0b71fafb 100644 --- a/lang/node-homebridge/Makefile +++ b/lang/node-homebridge/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NPM_NAME:=homebridge PKG_NAME:=node-$(PKG_NPM_NAME) PKG_VERSION:=1.2.4 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_NPM_NAME)/-/ @@ -46,8 +46,7 @@ TMPNPM:=$(shell mktemp -u XXXXXXXXXX) TARGET_CFLAGS+=$(FPIC) TARGET_CPPFLAGS+=$(FPIC) -define Build/Compile - $(MAKE_VARS) \ +NPM_FLAGS=$(MAKE_VARS) \ $(MAKE_FLAGS) \ npm_config_arch=$(NODEJS_CPU) \ npm_config_target_arch=$(NODEJS_CPU) \ @@ -55,7 +54,11 @@ define Build/Compile npm_config_nodedir=$(STAGING_DIR)/usr/ \ npm_config_prefix=$(PKG_INSTALL_DIR)/usr/ \ npm_config_cache=$(TMP_DIR)/npm-cache-$(TMPNPM) \ - npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM) \ + npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM) + +define Build/Compile + $(NPM_FLAGS) npm i -g --production $(PKG_BUILD_DIR) + $(NPM_FLAGS) npm i --production --prefix=$(PKG_BUILD_DIR) --target_arch=$(NODEJS_CPU) --prefer-dedupe npm install -g $(PKG_BUILD_DIR) rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM) rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM) diff --git a/lang/node-javascript-obfuscator/Makefile b/lang/node-javascript-obfuscator/Makefile index c8f75506..7f423256 100644 --- a/lang/node-javascript-obfuscator/Makefile +++ b/lang/node-javascript-obfuscator/Makefile @@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk PKG_NPM_NAME:=javascript-obfuscator PKG_NAME:=node-$(PKG_NPM_NAME) -PKG_VERSION:=2.9.4 -PKG_RELEASE:=1 +PKG_VERSION:=2.19.0 +PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_NPM_NAME)/-/ -PKG_HASH:=db443ed7c07a7a111352dac4aa7c6edd7969f97386f37c1cfe884d5a8c5f5408 +PKG_HASH:=9bc89b04c78277130bc6f699563871d211f6fc85803c874f6114a632d9456f7b PKG_BUILD_DEPENDS:=node/host HOST_BUILD_PARALLEL:=1 @@ -50,8 +50,7 @@ HOSTTMPNPM:=$(shell mktemp -u XXXXXXXXXX) TARGET_CFLAGS+=$(FPIC) TARGET_CPPFLAGS+=$(FPIC) -define Build/Compile - $(MAKE_VARS) \ +NPM_FLAGS=$(MAKE_VARS) \ $(MAKE_FLAGS) \ npm_config_arch=$(NODEJS_CPU) \ npm_config_target_arch=$(NODEJS_CPU) \ @@ -59,42 +58,51 @@ define Build/Compile npm_config_nodedir=$(STAGING_DIR)/usr/ \ 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 $(PKG_BUILD_DIR) + npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM) + +define Build/Compile + cd $(PKG_BUILD_DIR); \ + $(NPM_FLAGS) npm install --production --global-style --no-save --omit=dev --no-package-lock --ignore-scripts --legacy-peer-deps rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM) rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM) endef define Package/node-javascript-obfuscator/install $(INSTALL_DIR) $(1)/usr/lib/node/$(PKG_NPM_NAME) - $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{package.json,LICENSE.BSD} \ + $(CP) $(PKG_BUILD_DIR)/{package.json,LICENSE.BSD} \ $(1)/usr/lib/node/$(PKG_NPM_NAME)/ - $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/README.md \ + $(CP) $(PKG_BUILD_DIR)/README.md \ $(1)/usr/lib/node/$(PKG_NPM_NAME)/ - $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{node_modules,bin,dist} \ + $(CP) $(PKG_BUILD_DIR)/{node_modules,bin,dist} \ $(1)/usr/lib/node/$(PKG_NPM_NAME)/ $(INSTALL_DIR) $(1)/usr/bin $(LN) ../lib/node/javascript-obfuscator/bin/javascript-obfuscator $(1)/usr/bin/javascript-obfuscator endef -define Host/Compile - $(HOST_MAKE_VARS) \ +HOST_NPM_FLAGS=$(HOST_MAKE_VARS) \ + $(HOST_MAKE_FLAGS) \ + npm_config_arch=$(NODEJS_CPU) \ + npm_config_target_arch=$(NODEJS_CPU) \ + npm_config_build_from_source=true \ npm_config_nodedir=$(STAGING_DIR)/usr/ \ npm_config_prefix=$(HOST_INSTALL_DIR)/usr/ \ npm_config_cache=$(TMP_DIR)/npm-cache-$(HOSTTMPNPM) \ - npm_config_tmp=$(TMP_DIR)/npm-tmp-$(HOSTTMPNPM) \ - npm install -g --no-optional $(HOST_BUILD_DIR) + npm_config_tmp=$(TMP_DIR)/npm-tmp-$(HOSTTMPNPM) + +define Host/Compile + cd $(HOST_BUILD_DIR); \ + $(HOST_NPM_FLAGS) npm install --production --global-style --no-save --omit=dev --no-package-lock --ignore-scripts --legacy-peer-deps rm -rf $(TMP_DIR)/npm-tmp-$(HOSTTMPNPM) rm -rf $(TMP_DIR)/npm-cache-$(HOSTTMPNPM) endef define Host/Install $(INSTALL_DIR) $(1)/lib/node_modules/$(PKG_NPM_NAME) - $(CP) $(HOST_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{package.json,LICENSE.BSD} \ + $(CP) $(HOST_BUILD_DIR)/{package.json,LICENSE.BSD} \ $(1)/lib/node_modules/$(PKG_NPM_NAME)/ - $(CP) $(HOST_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/README.md \ + $(CP) $(HOST_BUILD_DIR)/README.md \ $(1)/lib/node_modules/$(PKG_NPM_NAME)/ - $(CP) $(HOST_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{node_modules,bin,dist} \ + $(CP) $(HOST_BUILD_DIR)/{node_modules,bin,dist} \ $(1)/lib/node_modules/$(PKG_NPM_NAME)/ $(INSTALL_DIR) $(1)/bin $(LN) ../lib/node_modules/javascript-obfuscator/bin/javascript-obfuscator $(1)/bin/javascript-obfuscator diff --git a/lang/node-serialport-bindings/Makefile b/lang/node-serialport-bindings/Makefile index dd19307e..70731e7f 100644 --- a/lang/node-serialport-bindings/Makefile +++ b/lang/node-serialport-bindings/Makefile @@ -8,7 +8,7 @@ PKG_NPM_SCOPE:=serialport PKG_NPM_NAME:=bindings PKG_NAME:=node-$(PKG_NPM_SCOPE)-$(PKG_NPM_NAME) PKG_VERSION:=9.0.4 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz PKG_SOURCE_URL:=https://registry.npmjs.org/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME)/-/ @@ -45,8 +45,7 @@ TMPNPM:=$(shell mktemp -u XXXXXXXXXX) TARGET_CFLAGS+=$(FPIC) TARGET_CPPFLAGS+=$(FPIC) -define Build/Compile - $(MAKE_VARS) \ +NPM_FLAGS=$(MAKE_VARS) \ $(MAKE_FLAGS) \ npm_config_arch=$(NODEJS_CPU) \ npm_config_target_arch=$(NODEJS_CPU) \ @@ -54,8 +53,11 @@ define Build/Compile npm_config_nodedir=$(STAGING_DIR)/usr/ \ 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 $(PKG_BUILD_DIR) + npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM) + +define Build/Compile + $(NPM_FLAGS) npm i -g --production $(PKG_BUILD_DIR) --ignore-scripts + $(NPM_FLAGS) npm i --production --prefix=$(PKG_BUILD_DIR) --target_arch=$(NODEJS_CPU) --prefer-dedupe rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM) rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM) endef diff --git a/lang/node-serialport/Makefile b/lang/node-serialport/Makefile index 7988b086..ee1d6e40 100644 --- a/lang/node-serialport/Makefile +++ b/lang/node-serialport/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NPM_NAME:=serialport PKG_NAME:=node-$(PKG_NPM_NAME) PKG_VERSION:=9.0.4 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_NPM_NAME)/-/ @@ -45,9 +45,9 @@ NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst TMPNPM:=$(shell mktemp -u XXXXXXXXXX) TARGET_CFLAGS+=$(FPIC) +TARGET_CPPFLAGS+=$(FPIC) -define Build/Compile - $(MAKE_VARS) \ +NPM_FLAGS=$(MAKE_VARS) \ $(MAKE_FLAGS) \ npm_config_arch=$(NODEJS_CPU) \ npm_config_target_arch=$(NODEJS_CPU) \ @@ -55,8 +55,11 @@ define Build/Compile npm_config_nodedir=$(STAGING_DIR)/usr/ \ 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 $(PKG_BUILD_DIR) + npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM) + +define Build/Compile + $(NPM_FLAGS) npm i -g --production $(PKG_BUILD_DIR) + $(NPM_FLAGS) npm i --production --prefix=$(PKG_BUILD_DIR) --target_arch=$(NODEJS_CPU) --prefer-dedupe rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM) rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM) endef diff --git a/lang/node-yarn/Makefile b/lang/node-yarn/Makefile index 0a96c370..47c7112f 100644 --- a/lang/node-yarn/Makefile +++ b/lang/node-yarn/Makefile @@ -6,24 +6,21 @@ include $(TOPDIR)/rules.mk PKG_NPM_NAME:=yarn PKG_NAME:=node-$(PKG_NPM_NAME) -PKG_VERSION:=1.22.17 -PKG_RELEASE:=1 +PKG_VERSION:=1.22.10 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_NPM_NAME)/-/ -PKG_HASH:=267982c61119a055ba2b23d9cf90b02d3d16c202c03cb0c3a53b9633eae37249 +PKG_HASH:=05a22fff30d7d8e8005bed277bf20d55111ba2bed65a6b91a0fcd1307b71fd8d -PKG_MAINTAINER:=Hirokazu MORIKAWA , Patrik Laszlo +PKG_MAINTAINER:=Hirokazu MORIKAWA , Patrik Laszlo , Dobroslaw Kijowski PKG_LICENSE:=BSD-2-Clause PKG_LICENSE_FILES:=LICENSE +PKG_HOST_ONLY:=1 HOST_BUILD_DEPENDS:=node/host HOST_BUILD_PARALLEL:=1 -PKG_BUILD_DEPENDS:=node/host -PKG_BUILD_PARALLEL:=1 -PKG_USE_MIPS16:=0 - include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/package.mk @@ -34,6 +31,7 @@ define Package/node-yarn TITLE:=Fast, reliable, and secure dependency management URL:=https://yarnpkg.com/ DEPENDS:=+node + BUILDONLY:=1 endef define Package/node-yarn/description @@ -43,68 +41,32 @@ 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) HOSTTMPNPM:=$(shell mktemp -u XXXXXXXXXX) -TARGET_CFLAGS+=$(FPIC) -TARGET_CPPFLAGS+=$(FPIC) - -define Build/Compile - cd $(PKG_BUILD_DIR); \ - $(MAKE_VARS) \ - $(MAKE_FLAGS) \ +HOST_NPM_FLAGS=$(HOST_MAKE_VARS) \ + $(HOST_MAKE_FLAGS) \ + npm_config_arch=$(NODEJS_CPU) \ + npm_config_target_arch=$(NODEJS_CPU) \ + npm_config_build_from_source=true \ npm_config_nodedir=$(STAGING_DIR)/usr/ \ - npm_config_cache=$(TMP_DIR)/npm-cache-$(TMPNPM) \ - npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM) \ - npm install --production --global-style --no-save --omit=dev --no-package-lock - rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM) - rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM) - rm -f $(PKG_BUILD_DIR)/node_modules/.package-lock.json - find $(PKG_BUILD_DIR)/node_modules -type d -empty -print0 | xargs -0 rmdir || true -endef - -define Package/node-yarn/install - $(INSTALL_DIR) $(1)/usr/lib/node/$(PKG_NPM_NAME) - $(CP) $(PKG_BUILD_DIR)/{package.json,LICENSE} \ - $(1)/usr/lib/node/$(PKG_NPM_NAME)/ - $(CP) $(PKG_BUILD_DIR)/README.md \ - $(1)/usr/lib/node/$(PKG_NPM_NAME)/ - $(CP) $(PKG_BUILD_DIR)/{bin,lib} \ - $(1)/usr/lib/node/$(PKG_NPM_NAME)/ - $(INSTALL_DIR) $(1)/usr/bin - $(LN) ../lib/node/$(PKG_NPM_NAME)/bin/yarn.js $(1)/usr/bin/yarn - $(LN) ../lib/node/$(PKG_NPM_NAME)/bin/yarn.js $(1)/usr/bin/yarnpkg - $(INSTALL_DIR) $(1)/usr/lib/node_modules - $(LN) ../node/$(PKG_NPM_NAME) $(1)/usr/lib/node_modules/$(PKG_NPM_NAME) -endef - -define Package/node-yarn/postrm -#!/bin/sh -rm /usr/lib/node_modules/yarn || true -rm -rf /usr/lib/node/yarn || true -endef + npm_config_prefix=$(HOST_INSTALL_DIR)/usr/ \ + npm_config_cache=$(TMP_DIR)/npm-cache-$(HOSTTMPNPM) \ + npm_config_tmp=$(TMP_DIR)/npm-tmp-$(HOSTTMPNPM) define Host/Compile - cd $(HOST_BUILD_DIR); \ - $(HOST_MAKE_VARS) \ - npm_config_nodedir=$(STAGING_DIR)/usr/ \ - npm_config_cache=$(TMP_DIR)/npm-cache-$(HOSTTMPNPM) \ - npm_config_tmp=$(TMP_DIR)/npm-tmp-$(HOSTTMPNPM) \ - npm install --production --global-style --no-save --omit=dev --no-package-lock + $(HOST_NPM_FLAGS) npm i -g --production $(HOST_BUILD_DIR) + $(HOST_NPM_FLAGS) npm i --production --prefix=$(HOST_BUILD_DIR) --target_arch=$(NODEJS_CPU) --prefer-dedupe rm -rf $(TMP_DIR)/npm-tmp-$(HOSTTMPNPM) rm -rf $(TMP_DIR)/npm-cache-$(HOSTTMPNPM) - rm -f $(HOST_BUILD_DIR)/node_modules/.package-lock.json - find $(HOST_BUILD_DIR)/node_modules -type d -empty -print0 | xargs -0 rmdir || true endef define Host/Install $(INSTALL_DIR) $(1)/lib/node_modules/$(PKG_NPM_NAME) - $(CP) $(HOST_BUILD_DIR)/{package.json,LICENSE} \ + $(CP) $(HOST_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{package.json,LICENSE} \ $(1)/lib/node_modules/$(PKG_NPM_NAME)/ - $(CP) $(HOST_BUILD_DIR)/README.md \ + $(CP) $(HOST_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/README.md \ $(1)/lib/node_modules/$(PKG_NPM_NAME)/ - $(CP) $(HOST_BUILD_DIR)/{bin,lib} \ + $(CP) $(HOST_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{bin,lib} \ $(1)/lib/node_modules/$(PKG_NPM_NAME)/ $(INSTALL_DIR) $(1)/bin $(LN) ../lib/node_modules/$(PKG_NPM_NAME)/bin/yarn.js $(1)/bin/yarn