From db1a15314da4ae1c83877942cef2941ae8fb80cf Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 5 Oct 2012 23:21:09 +0200 Subject: Support build-cores = 0; change `guix-build' to default to 0. * guix/build/gnu-build-system.scm (%parallel-job-count): New variable. (build, check): Use it instead of $NIX_BUILD_CORES. * guix-build.in (guix-build): Default to 0 for the #:build-cores option. --- guix/build/gnu-build-system.scm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'guix') diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 112b34cd4d..2b7d1c180e 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -128,11 +128,18 @@ (define* (configure #:key outputs (configure-flags '()) out-of-source? (string-append srcdir "/configure") flags)))) +(define %parallel-job-count + ;; String to be passed next to GNU Make's `-j' argument. + (match (getenv "NIX_BUILD_CORES") + (#f "1") + ("0" (number->string (current-processor-count))) + (x x))) + (define* (build #:key (make-flags '()) (parallel-build? #t) #:allow-other-keys) (zero? (apply system* "make" `(,@(if parallel-build? - `("-j" ,(getenv "NIX_BUILD_CORES")) + `("-j" ,%parallel-job-count) '()) ,@make-flags)))) @@ -142,7 +149,7 @@ (define* (check #:key (make-flags '()) (tests? #t) (test-target "check") (if tests? (zero? (apply system* "make" test-target `(,@(if parallel-tests? - `("-j" ,(getenv "NIX_BUILD_CORES")) + `("-j" ,%parallel-job-count) '()) ,@make-flags))) (begin -- cgit v1.2.3