git: 67dd41cdb10d - stable/14 - nanobsd: Fix parallel make

From: Jose Luis Duran <jlduran_at_FreeBSD.org>
Date: Mon, 16 Dec 2024 15:14:37 UTC
The branch stable/14 has been updated by jlduran:

URL: https://cgit.FreeBSD.org/src/commit/?id=67dd41cdb10dcdf113f29645ff2c10e00bd27770

commit 67dd41cdb10dcdf113f29645ff2c10e00bd27770
Author:     Jose Luis Duran <jlduran@FreeBSD.org>
AuthorDate: 2024-11-07 14:32:01 +0000
Commit:     Jose Luis Duran <jlduran@FreeBSD.org>
CommitDate: 2024-12-16 15:11:31 +0000

    nanobsd: Fix parallel make
    
    The NANO_NCPU (number of CPUs) value gets ignored by the build script
    when setting the NANO_PMAKE (parallel make) value.
    
    Fix it by setting the NANO_PMAKE later in the process.
    
    PR:             277269
    Reviewed by:    imp, emaste
    Approved by:    emaste (mentor)
    MFC after:      1 month
    Differential Revision:  https://reviews.freebsd.org/D47476
    
    (cherry picked from commit 3c5d19a40de7273bb478163639dd8532af425595)
---
 tools/tools/nanobsd/defaults.sh | 5 ++++-
 tools/tools/nanobsd/nanobsd.sh  | 4 ----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh
index 33111a9c401f..8ce3af149356 100755
--- a/tools/tools/nanobsd/defaults.sh
+++ b/tools/tools/nanobsd/defaults.sh
@@ -67,7 +67,6 @@ NANO_PKG_META_BASE=/var/db
 # Make & parallel Make
 NANO_MAKE="make"
 NANO_NCPU=$(sysctl -n hw.ncpu)
-NANO_PMAKE="make -j $NANO_NCPU"
 
 # The default name for any image we create.
 NANO_IMGNAME="_.disk.full"
@@ -892,6 +891,10 @@ set_defaults_and_export ( ) {
 	: ${NANO_DISKIMGDIR:=${NANO_OBJ}}
 	: ${NANO_WORLDDIR:=${NANO_OBJ}/_.w}
 	: ${NANO_LOG:=${NANO_OBJ}}
+	: ${NANO_PMAKE:="${NANO_MAKE} -j ${NANO_NCPU}"}
+	if ! $do_clean; then
+		NANO_PMAKE="${NANO_PMAKE} -DNO_CLEAN"
+	fi
 	NANO_MAKE_CONF_BUILD=${MAKEOBJDIRPREFIX}/make.conf.build
 	NANO_MAKE_CONF_INSTALL=${NANO_OBJ}/make.conf.install
 
diff --git a/tools/tools/nanobsd/nanobsd.sh b/tools/tools/nanobsd/nanobsd.sh
index af03d89acece..4c390d8ca371 100755
--- a/tools/tools/nanobsd/nanobsd.sh
+++ b/tools/tools/nanobsd/nanobsd.sh
@@ -156,10 +156,6 @@ if [ ! -d "${NANO_TOOLS}" ]; then
 	exit 1
 fi
 
-if ! $do_clean; then
-	NANO_PMAKE="${NANO_PMAKE} -DNO_CLEAN"
-fi
-
 pprint 1 "NanoBSD image ${NANO_NAME} build starting"
 
 run_early_customize