diff options
author | Ludovic Courtès <ludo@gnu.org> | 2012-07-07 16:49:23 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2012-07-07 16:49:23 +0200 |
commit | febaa885696aefade25a1c615fba8af920565e87 (patch) | |
tree | c660d4192de0499f055145e24e01df93e2072544 /guix/build/gnu-build-system.scm | |
parent | 10c87717bd70c9d7e47a13753dc2756a97f00e35 (diff) | |
download | gnu-guix-febaa885696aefade25a1c615fba8af920565e87.tar gnu-guix-febaa885696aefade25a1c615fba8af920565e87.tar.gz |
build-system/gnu: Support parallel builds and tests.
* guix/build/gnu-build-system.scm (build): Add `parallel-build?'
parameter; honor it and $NIX_BUILD_CORES.
(check): Add `parallel-tests?' parameter; likewise.
* guix/build-system/gnu.scm (gnu-build): Add `parallel-build?' and
`parallel-tests?' parameters.
[builder]: Inherit them.
Diffstat (limited to 'guix/build/gnu-build-system.scm')
-rw-r--r-- | guix/build/gnu-build-system.scm | 16 |
1 files changed, 13 insertions, 3 deletions
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))) |