From 54a3c90079abc5adad27fd3a950d715f42d0eab0 Mon Sep 17 00:00:00 2001 From: Brodino Date: Mon, 27 Apr 2026 00:53:54 +0200 Subject: [PATCH] feat: added control for multiple cores --- .env.example | 4 ++++ docker-compose.yml | 3 +++ scripts/build.sh | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/.env.example b/.env.example index 5941cb9..e1c890f 100644 --- a/.env.example +++ b/.env.example @@ -18,3 +18,7 @@ AUR_MAINTAINER_EMAIL=your@email.com # How often to poll the AUR for updates, in seconds (default: 3600 = 1 hour) POLL_INTERVAL_SECONDS=3600 + +# Number of CPU cores to use for compilation (default: all available cores) +# Reduce this if you want to leave headroom for other processes on the server +# NPROC=4 diff --git a/docker-compose.yml b/docker-compose.yml index 61c1bd9..1be9df4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,6 +8,9 @@ services: restart: unless-stopped env_file: - .env + # By default Docker exposes all host CPUs to the container. + # You can cap it here or set NPROC in .env to limit parallelism at the build level. + # cpus: '4' volumes: # Entire project mounted so the container can read/write state, artifacts, # and the webkit2gtk / webkit2gtk-bin git repos. diff --git a/scripts/build.sh b/scripts/build.sh index e6f1d8c..8b57c8b 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -31,6 +31,11 @@ find . -maxdepth 1 -name '*.pkg.tar.zst' -delete find . -maxdepth 1 -name '*.pkg.tar.zst.sig' -delete # Build +# Use all available cores. MAKEFLAGS is respected by makepkg and passed +# through to cmake/ninja. NPROC can be overridden via the environment. +nproc="${NPROC:-$(nproc)}" +export MAKEFLAGS="-j${nproc}" +log "Building with ${nproc} cores" log "Running makepkg in ${SRC_DIR}" # --syncdeps : install missing makedepends automatically # --noconfirm : do not ask for confirmations