summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobbert van der Helm2021-11-11 15:46:47 +0100
committerRobbert van der Helm2021-11-11 15:46:47 +0100
commita20afb17255a00421ddd35780c704c9daa885160 (patch)
treed6da91eeba988f0fd7bb46e5483a4735480b5a87
parent0136a143369b1b269ddc05e59ba74103efe7d181 (diff)
downloadaur-a20afb17255a00421ddd35780c704c9daa885160.tar.gz
Limit the number of concurrent jobs even further
-rw-r--r--PKGBUILD13
1 files changed, 3 insertions, 10 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 69ad52510d80..67a770ee2310 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -49,19 +49,12 @@ build() {
# The unity build takes can take up to 2 GB of RAM per target, so if the
# system does not have enough RAM to build everything at once we'll limit the
# number of concurrent jobs
- #
# NOTE: The `LANG=C` is needed because apparently the `pt_BR.UTF-8` locale
# changes `Mem:` to `Mem.:`, so who knows what other locales might do
total_memory=$(env LANG=C free --gibi --si | awk '/^Mem:/ { print $2 }')
- if [ "$total_memory" -le 4 ]; then
- echo -e "\n$total_memory gigabytes of RAM detected, limiting the number of build jobs to 1\n"
- ninja -C build -j1
- elif [ "$total_memory" -le 8 ]; then
- echo -e "\n$total_memory gigabytes of RAM detected, limiting the number of build jobs to 3\n"
- ninja -C build -j3
- else
- ninja -C build
- fi
+ num_jobs=$((total_memory / 4))
+ echo -e "\n$total_memory gigabytes of RAM detected, limiting the number of build jobs to $num_jobs\n"
+ ninja -C build -j"$num_jobs"
}
package() {