buildroot.busybox.net archive mirror
 help / color / mirror / Atom feed
From: Alexandru Ardelean <ardeleanalex@gmail.com>
To: buildroot@buildroot.org
Cc: Alexandru Ardelean <ardeleanalex@gmail.com>,
	fontaine.fabrice@gmail.com, aduskett@gmail.com
Subject: [Buildroot] [PATCH 06/13] package/nodejs: provide {CC, CXX, CFLAGS, CXXFLAGS, LDFLAGS}_host env vars to target-build
Date: Tue,  9 Aug 2022 10:56:57 +0300	[thread overview]
Message-ID: <20220809075704.86472-7-ardeleanalex@gmail.com> (raw)
In-Reply-To: <20220809075704.86472-1-ardeleanalex@gmail.com>

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 --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)
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  parent reply	other threads:[~2022-08-09  7:58 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-09  7:56 [Buildroot] [PATCH 00/13] package/nodejs: rework cross-building Alexandru Ardelean
2022-08-09  7:56 ` [Buildroot] [PATCH 01/13] package/libuv: add host-build Alexandru Ardelean
2022-08-09  7:56 ` [Buildroot] [PATCH 02/13] package/nghttp2: " Alexandru Ardelean
2022-08-09  7:56 ` [Buildroot] [PATCH 03/13] nodejs: remove v8-qemu-wrapper stuff Alexandru Ardelean
2022-08-09 11:49   ` Thomas Petazzoni via buildroot
2022-08-09 12:52     ` Alexandru Ardelean
2022-08-09  7:56 ` [Buildroot] [PATCH 04/13] nodejs: fix 'Duplicate v8 target errors when cross-compiling' error Alexandru Ardelean
2022-08-09  7:56 ` [Buildroot] [PATCH 05/13] package/nodejs: add host-{c-ares, libuv, nghttp2} to deps Alexandru Ardelean
2022-08-09  7:56 ` Alexandru Ardelean [this message]
2022-08-09  7:56 ` [Buildroot] [PATCH 07/13] package/nodejs: don't install nodejs host-tools Alexandru Ardelean
2022-08-09  7:56 ` [Buildroot] [PATCH 08/13] package/nodejs: rename LDFLAGS.host -> LDFLAGS opt Alexandru Ardelean
2022-08-09  7:57 ` [Buildroot] [PATCH 09/13] package/nodejs: impose dep on ia32 libs/compiler if target arch not 64 bits Alexandru Ardelean
2022-08-09  7:57 ` [Buildroot] [PATCH 10/13] package/nodejs: add host-zlib depedency to target package Alexandru Ardelean
2022-08-09  7:57 ` [Buildroot] [PATCH 11/13] package/nodejs: fix ARM build with VFP3 instruction Alexandru Ardelean
2022-08-09  7:57 ` [Buildroot] [PATCH 12/13] package/nodejs: add a hack to cross-compile 32-bit targets on x64 hosts Alexandru Ardelean
2022-08-09  7:57 ` [Buildroot] [PATCH 13/13] package/nodejs: build host-nodejs only if we're installing modules with NPM Alexandru Ardelean
2022-08-09 11:42 ` [Buildroot] [PATCH 00/13] package/nodejs: rework cross-building Thomas Petazzoni via buildroot
2022-08-09 12:48   ` Alexandru Ardelean
2022-08-10 21:23 ` Thomas Petazzoni via buildroot
2022-08-11  7:48   ` Alexandru Ardelean
2022-09-25  8:27 ` Thomas Petazzoni
2022-09-25 15:17   ` Alexandru Ardelean
2022-09-25 16:15     ` Alexandru Ardelean
2022-09-25 18:41       ` Thomas Petazzoni
2022-09-26 13:11         ` Alexandru Ardelean

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220809075704.86472-7-ardeleanalex@gmail.com \
    --to=ardeleanalex@gmail.com \
    --cc=aduskett@gmail.com \
    --cc=buildroot@buildroot.org \
    --cc=fontaine.fabrice@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).