Commit c50256b6 authored by Martin Bark's avatar Martin Bark Committed by Thomas Petazzoni
Browse files

package/nodejs: Define NPM command for other packages to use



Other nodejs-related packages will need to call npm with the same set of
arguments as is currently used by the nodejs package itself.

To avoid duplicating this code, set the NPM variable so those packages can
re-use it.

Signed-off-by: default avatarMartin Bark <martin@barkynet.com>
Acked-by: default avatar"Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
parent c72b8eaf
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -95,6 +95,15 @@ NODEJS_MODULES_LIST= $(call qstrip,\
	$(if $(BR2_PACKAGE_NODEJS_MODULES_COFFEESCRIPT),coffee-script) \
	$(BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL))

# Define NPM for other packages to use
NPM = $(TARGET_CONFIGURE_OPTS) \
	LD="$(TARGET_CXX)" \
	npm_config_arch=$(NODEJS_CPU) \
	npm_config_target_arch=$(NODEJS_CPU) \
	npm_config_build_from_source=true \
	npm_config_nodedir=$(BUILD_DIR)/nodejs-$(NODEJS_VERSION) \
	$(HOST_DIR)/usr/bin/npm

#
# We can only call NPM if there's something to install.
#
@@ -104,14 +113,7 @@ define NODEJS_INSTALL_MODULES
	# npm install call below and setting npm_config_rollback=false can both
	# help in diagnosing the problem.
	(cd $(TARGET_DIR)/usr/lib && mkdir -p node_modules && \
		$(TARGET_CONFIGURE_OPTS) \
		LD="$(TARGET_CXX)" \
		npm_config_arch=$(NODEJS_CPU) \
		npm_config_target_arch=$(NODEJS_CPU) \
		npm_config_build_from_source=true \
		npm_config_nodedir=$(BUILD_DIR)/nodejs-$(NODEJS_VERSION) \
		$(HOST_DIR)/usr/bin/npm install \
		$(NODEJS_MODULES_LIST) \
		$(NPM) install $(NODEJS_MODULES_LIST) \
	)

	# Symlink all executables in $(TARGET_DIR)/usr/lib/node_modules/.bin to