Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/nodejs: fix parallel build
@ 2023-09-23  9:39 Jens Maus via buildroot
  2023-09-23 10:09 ` Yann E. MORIN
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Jens Maus via buildroot @ 2023-09-23  9:39 UTC (permalink / raw)
  To: buildroot; +Cc: Martin Bark, Daniel Price

In ninja-based nodejs builds performing parallel builds using "make -jX"
is not working during buildroot initiated builds because the JOBS
variable is set in the MAKE_OPTS variables in nodejs.mk. This commit
remedies the issue by setting JOBS to BR2_JLEVEL and also by fixing the
top-level Makefile of nodejs due to an incorrect tab-based indentation
being used. Furthermore, it is important to also set LD_LIBRARY_PATH in
v8-qemu-wrapper.in to our staging libdirs as otherwise execution of
build tools fail due to host OS libraries being preferred.

Signed-off-by: Jens Maus <mail@jens-maus.de>
---
 ...-fixing-Makefile-for-parallel-builds.patch | 37 +++++++++++++++++++
 package/nodejs/nodejs.mk                      |  6 ++-
 package/nodejs/v8-qemu-wrapper.in             |  1 +
 3 files changed, 42 insertions(+), 2 deletions(-)
 create mode 100644 package/nodejs/0005-fixing-Makefile-for-parallel-builds.patch

diff --git a/package/nodejs/0005-fixing-Makefile-for-parallel-builds.patch b/package/nodejs/0005-fixing-Makefile-for-parallel-builds.patch
new file mode 100644
index 0000000000..73db129979
--- /dev/null
+++ b/package/nodejs/0005-fixing-Makefile-for-parallel-builds.patch
@@ -0,0 +1,37 @@
+From 1c4582c7dd7c80fbac89031d8fa8cf418249d01e Mon Sep 17 00:00:00 2001
+From: Jens Maus <mail@jens-maus.de>
+Date: Sat, 23 Sep 2023 11:09:50 +0200
+Subject: [PATCH] fixing Makefile for parallel builds
+
+This change fixing incorrect GNU makefile indentation in the top-level
+Makefile which causes issues with parallel "make -jXX" builds.
+
+Upstream: N/A (specific to buildroot builds)
+Signed-off-by: Jens Maus <mail@jens-maus.de>
+---
+ Makefile | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index b7871bf218..87c47bcc0b 100644
+--- a/Makefile
++++ b/Makefile
+@@ -138,12 +138,12 @@ else
+ ifeq ($(BUILD_WITH), ninja)
+ NINJA ?= ninja
+ ifeq ($(V),1)
+-	NINJA_ARGS := $(NINJA_ARGS) -v
++NINJA_ARGS := $(NINJA_ARGS) -v
+ endif
+ ifdef JOBS
+-	NINJA_ARGS := $(NINJA_ARGS) -j$(JOBS)
++NINJA_ARGS := $(NINJA_ARGS) -j$(JOBS)
+ else
+-	NINJA_ARGS := $(NINJA_ARGS) $(filter -j%,$(MAKEFLAGS))
++NINJA_ARGS := $(NINJA_ARGS) $(filter -j%,$(MAKEFLAGS))
+ endif
+ $(NODE_EXE): config.gypi out/Release/build.ninja
+ 	$(NINJA) -C out/Release $(NINJA_ARGS)
+-- 
+2.34.1
+
diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
index fe629ada21..4e70bd71a3 100644
--- a/package/nodejs/nodejs.mk
+++ b/package/nodejs/nodejs.mk
@@ -46,14 +46,16 @@ HOST_NODEJS_MAKE_OPTS = \
 	CXXFLAGS="$(HOST_NODEJS_CXXFLAGS)" \
 	LDFLAGS.host="$(HOST_LDFLAGS)" \
 	NO_LOAD=cctest.target.mk \
-	PATH=$(@D)/bin:$(BR_PATH)
+	PATH=$(@D)/bin:$(BR_PATH) \
+	JOBS=$(BR2_JLEVEL)
 
 NODEJS_MAKE_OPTS = \
 	$(TARGET_CONFIGURE_OPTS) \
 	NO_LOAD=cctest.target.mk \
 	PATH=$(@D)/bin:$(BR_PATH) \
 	LDFLAGS="$(NODEJS_LDFLAGS)" \
-	LD="$(TARGET_CXX)"
+	LD="$(TARGET_CXX)" \
+	JOBS=$(BR2_JLEVEL)
 
 # nodejs's build system uses python which can be a symlink to an unsupported
 # python version (e.g. python 3.10 with nodejs 14.18.1). We work around this by
diff --git a/package/nodejs/v8-qemu-wrapper.in b/package/nodejs/v8-qemu-wrapper.in
index e1083f47f7..48222d089b 100644
--- a/package/nodejs/v8-qemu-wrapper.in
+++ b/package/nodejs/v8-qemu-wrapper.in
@@ -5,5 +5,6 @@
 exec @QEMU_USER@ -r @TOOLCHAIN_HEADERS_VERSION@ \
     @QEMU_USERMODE_ARGS@ \
    -L "${STAGING_DIR}/" \
+   -E LD_LIBRARY_PATH="${STAGING_DIR}/lib:${STAGING_DIR}/usr/lib/" \
     "$@"
 
-- 
2.34.1

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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-09-27 11:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-23  9:39 [Buildroot] [PATCH] package/nodejs: fix parallel build Jens Maus via buildroot
2023-09-23 10:09 ` Yann E. MORIN
2023-09-23 11:07   ` Jens Maus via buildroot
2023-09-23 16:20     ` Jens Maus via buildroot
2023-09-23 10:59 ` [Buildroot] [PATCH 1/1] package/nodejs: fix cross-compile builds Jens Maus via buildroot
2023-09-24 16:36   ` Yann E. MORIN
2023-09-27 11:46   ` Peter Korsgaard
2023-09-23 16:04 ` [Buildroot] [PATCH v2] package/nodejs: fix parallel build Jens Maus via buildroot
2023-09-24  9:56   ` Yann E. MORIN
2023-09-26  8:53     ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox