build-llvm: Only pass -j to ninja if CORES was set originally

If CORES was unset, let ninja pick the core count (which normally
is set higher than the number of cores).
This commit is contained in:
Martin Storsjö committed 2020-03-25 00:29:07 +02:00
1 parent ca303864ba
commit 13e441d60e
1 file changed
+5 -5
+5 -5
View File
@@ -53,10 +53,6 @@ if [ -z "$CHECKOUT_ONLY" ]; then
PREFIX="$(cd "$PREFIX" && pwd)" PREFIX="$(cd "$PREFIX" && pwd)"
fi fi
: ${CORES:=$(nproc 2>/dev/null)}
: ${CORES:=$(sysctl -n hw.ncpu 2>/dev/null)}
: ${CORES:=4}
if [ ! -d llvm-project ]; then if [ ! -d llvm-project ]; then
# When cloning master and checking out a pinned old hash, we can't use --depth=1. # When cloning master and checking out a pinned old hash, we can't use --depth=1.
git clone https://github.com/llvm/llvm-project.git git clone https://github.com/llvm/llvm-project.git
@@ -76,6 +72,10 @@ if [ -n "$(which ninja)" ]; then
CMAKE_GENERATOR="Ninja" CMAKE_GENERATOR="Ninja"
NINJA=1 NINJA=1
else else
: ${CORES:=$(nproc 2>/dev/null)}
: ${CORES:=$(sysctl -n hw.ncpu 2>/dev/null)}
: ${CORES:=4}
case $(uname) in case $(uname) in
MINGW*) MINGW*)
CMAKE_GENERATOR="MSYS Makefiles" CMAKE_GENERATOR="MSYS Makefiles"
@@ -180,7 +180,7 @@ cmake \
.. ..
if [ -n "$NINJA" ]; then if [ -n "$NINJA" ]; then
ninja -j$CORES install/strip ninja ${CORES+-j$CORES} install/strip
else else
make -j$CORES install/strip make -j$CORES install/strip
fi fi