diff mbox series

[06/13] package/nodejs: provide {CC, CXX, CFLAGS, CXXFLAGS, LDFLAGS}_host env vars to target-build

Message ID 20220809075704.86472-7-ardeleanalex@gmail.com
State Changes Requested
Headers show
Series package/nodejs: rework cross-building | expand

Commit Message

Alexandru Ardelean Aug. 9, 2022, 7:56 a.m. UTC
nodejs has some cross-build infrastructure in place.
When we want to build for the target, we need to use it.
Previously, the logic was trying to use the v8-qemu-wrapper stuff, but that
wasn't working.

The proper way (or recommended by nodejs) is to provide these
{CC,CXX,CFLAGS,CXXFLAGS,LDFLAGS}_host env vars, so that it builds the host
tools to generate some code stuff.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
---
 package/nodejs/nodejs.mk | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox series

Patch

diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
index d15c027c70..4713971169 100644
--- a/package/nodejs/nodejs.mk
+++ b/package/nodejs/nodejs.mk
@@ -47,6 +47,13 @@  NODEJS_CONF_OPTS = \
 	--dest-os=linux \
 	--ninja
 
+NODEJS_CROSS_BUILD_ENV_VARS = \
+	CC_host="$(HOSTCC)" \
+	CXX_host="$(HOSTCXX)" \
+	CFLAGS_host="$(HOST_CFLAGS)" \
+	CXXFLAGS_host="$(HOST_CXXFLAGS)" \
+	LDFLAGS_host="$(HOST_LDFLAGS)"
+
 HOST_NODEJS_MAKE_OPTS = \
 	$(HOST_CONFIGURE_OPTS) \
 	CXXFLAGS="$(HOST_NODEJS_CXXFLAGS)" \
@@ -182,6 +189,7 @@  endif
 define NODEJS_CONFIGURE_CMDS
 	(cd $(@D); \
 		$(TARGET_CONFIGURE_OPTS) \
+		$(NODEJS_CROSS_BUILD_ENV_VARS) \
 		PATH=$(@D)/bin:$(BR_PATH) \
 		LDFLAGS="$(NODEJS_LDFLAGS)" \
 		LD="$(TARGET_CXX)" \
@@ -199,6 +207,7 @@  endef
 
 define NODEJS_BUILD_CMDS
 	$(TARGET_MAKE_ENV) PYTHON=$(HOST_DIR)/bin/python3 \
+		$(NODEJS_CROSS_BUILD_ENV_VARS) \
 		$(MAKE) -C $(@D) \
 		$(NODEJS_MAKE_OPTS)
 endef
@@ -235,6 +244,7 @@  endif
 
 define NODEJS_INSTALL_STAGING_CMDS
 	$(TARGET_MAKE_ENV) PYTHON=$(HOST_DIR)/bin/python3 \
+		$(NODEJS_CROSS_BUILD_ENV_VARS) \
 		$(MAKE) -C $(@D) install \
 		DESTDIR=$(STAGING_DIR) \
 		$(NODEJS_MAKE_OPTS)
@@ -242,6 +252,7 @@  endef
 
 define NODEJS_INSTALL_TARGET_CMDS
 	$(TARGET_MAKE_ENV) PYTHON=$(HOST_DIR)/bin/python3 \
+		$(NODEJS_CROSS_BUILD_ENV_VARS) \
 		$(MAKE) -C $(@D) install \
 		DESTDIR=$(TARGET_DIR) \
 		$(NODEJS_MAKE_OPTS)