summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xinclude/option.sh8
-rwxr-xr-xscript/update/release7
-rwxr-xr-xscript/update/trees4
3 files changed, 14 insertions, 5 deletions
diff --git a/include/option.sh b/include/option.sh
index 64442d15..8fc80aaa 100755
--- a/include/option.sh
+++ b/include/option.sh
@@ -22,6 +22,14 @@ eval "$(setvars "" CONFIG_BOARD_DELL_E6400 CONFIG_HAVE_MRC CONFIG_HAVE_ME_BIN \
CONFIG_IFD_BIN_PATH CONFIG_MRC_FILE _dest board boarddir \
CONFIG_HAVE_REFCODE_BLOB CONFIG_REFCODE_BLOB_FILE)"
+threads=
+set | grep LBMK_THREADS 1>/dev/null 2>/dev/null || threads=$(nproc) || :
+[ -z "$threads" ] && threads=$LBMK_THREADS
+[ -z "$threads" ] && threads=1 # LBMK_THREADS not set, and nproc failed
+
+expr "X$threads" : "X-\{0,1\}[0123456789][0123456789]*$" \
+ 1>/dev/null 2>/dev/null || threads=1 # user specified a non-integer
+
items()
{
rval=1
diff --git a/script/update/release b/script/update/release
index c4101b5a..25ada9da 100755
--- a/script/update/release
+++ b/script/update/release
@@ -215,11 +215,12 @@ mktarball()
mkdir -p "${2%/*}" || $err "mk, !mkdir -p \"${2%/*}\""
if [ "${tar_implementation% *}" = "tar (GNU tar)" ]; then
tar --sort=name --owner=root:0 --group=root:0 \
- --mtime="UTC 2024-02-25" -c "$1" | xz -T0 -9e > "$2" || \
- $err "mktarball 1, ${1}"
+ --mtime="UTC 2024-02-25" -c "$1" | xz -T$threads -9e \
+ > "$2" || $err "mktarball 1, ${1}"
else
# TODO: reproducible tarballs on non-GNU systems
- tar -c "$1" | xz -T0 -9e > "$2" || $err "mktarball 2, $1"
+ tar -c "$1" | xz -T$threads -9e > "$2" || \
+ $err "mktarball 2, $1"
fi
(
[ "${2%/*}" != "${2}" ] && x_ cd "${2%/*}"
diff --git a/script/update/trees b/script/update/trees
index 40ff1878..ac5743be 100755
--- a/script/update/trees
+++ b/script/update/trees
@@ -172,7 +172,7 @@ check_cross_compiler()
[ -n "${xlang}" ] && export BUILD_LANGUAGES="$xlang"
[ -d "${cbdir}/util/crossgcc/xgcc/${_xarch}/" ] && continue
- x_ make -C "$cbdir" crossgcc-${_xarch%-*} CPUS=$(nproc)
+ x_ make -C "$cbdir" crossgcc-${_xarch%-*} CPUS=$threads
done
}
@@ -219,7 +219,7 @@ run_make_command()
[ "$project" = "coreboot" ] && [ -z "$mode" ] && x_ \
printf "%s\n" "${version%%-*}" > "$codedir/.coreboot-version"
- make $mode -j$(nproc) $makeargs -C "$codedir" || \
+ make $mode -j$threads $makeargs -C "$codedir" || \
$err "run_make $codedir: !make $mode"
[ "$mode" != "clean" ] && return 0