diff options
-rw-r--r-- | guix/build-system/gnu.scm | 5 | ||||
-rw-r--r-- | guix/build/gnu-build-system.scm | 16 |
2 files changed, 17 insertions, 4 deletions
diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm index 6876342b45..20b7fbe897 100644 --- a/guix/build-system/gnu.scm +++ b/guix/build-system/gnu.scm @@ -45,6 +45,7 @@ #:key (outputs '("out")) (configure-flags ''()) (make-flags ''()) (patches ''()) (patch-flags ''("--batch" "-p1")) + (parallel-build? #t) (parallel-tests? #t) (phases '%standard-phases) (system (%current-system)) (modules '((guix build gnu-build-system) @@ -63,7 +64,9 @@ input derivation INPUTS, using the usual procedure of the GNU Build System." #:patch-flags ,patch-flags #:phases ,phases #:configure-flags ,configure-flags - #:make-flags ,make-flags))) + #:make-flags ,make-flags + #:parallel-build? ,parallel-build? + #:parallel-tests? ,parallel-tests?))) (build-expression->derivation store name system builder diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 9035280577..d59b9408a8 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -87,13 +87,23 @@ (format #t "configure flags: ~s~%" flags) (zero? (apply system* "./configure" flags)))) -(define* (build #:key (make-flags '()) #:allow-other-keys) - (zero? (apply system* "make" make-flags))) +(define* (build #:key (make-flags '()) (parallel-build? #t) + #:allow-other-keys) + (zero? (apply system* "make" + `(,@(if parallel-build? + `("-j" ,(getenv "NIX_BUILD_CORES")) + '()) + ,@make-flags)))) (define* (check #:key (make-flags '()) (tests? #t) (test-target "check") + (parallel-tests? #t) #:allow-other-keys) (if tests? - (zero? (apply system* "make" test-target make-flags)) + (zero? (apply system* "make" test-target + `(,@(if parallel-tests? + `("-j" ,(getenv "NIX_BUILD_CORES")) + '()) + ,@make-flags))) (begin (format #t "test suite not run~%") #t))) |