From 834415c33a2fd909e410a5cf352c597f05bb6999 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Fri, 1 Oct 2021 14:53:56 +0200 Subject: build-system: linux-module: Build and install in parallel. * guix/build-system/linux-module.scm (linux-module-build) (guix/build-system/linux-module.scm): Accept the PARALLEL-BUILD? keyword and pass it on to the builder. * guix/build/linux-module-build-system.scm (build, install): Capture and honour it. --- guix/build-system/linux-module.scm | 4 ++++ guix/build/linux-module-build-system.scm | 21 +++++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) (limited to 'guix') diff --git a/guix/build-system/linux-module.scm b/guix/build-system/linux-module.scm index 33bc8c95df..548ed7a9aa 100644 --- a/guix/build-system/linux-module.scm +++ b/guix/build-system/linux-module.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2019 Danny Milosavljevic ;;; Copyright © 2020 Mathieu Othacehe +;;; Copyright © 2021 Tobias Geerinckx-Rice ;;; ;;; This file is part of GNU Guix. ;;; @@ -157,6 +158,7 @@ (define* (linux-module-build store name inputs %standard-phases)) (outputs '("out")) (make-flags ''()) + (parallel-build? #t) (system (%current-system)) (source-directory ".") (guile #f) @@ -187,6 +189,7 @@ (define builder #:tests? ,tests? #:outputs %outputs #:make-flags ,make-flags + #:parallel-build? ,parallel-build? #:inputs %build-inputs))) (define guile-for-build @@ -213,6 +216,7 @@ (define* (linux-module-build-cross (guile #f) (outputs '("out")) (make-flags ''()) + (parallel-build? #t) (search-paths '()) (native-search-paths '()) (tests? #f) diff --git a/guix/build/linux-module-build-system.scm b/guix/build/linux-module-build-system.scm index 1541b6393e..7c0dba8445 100644 --- a/guix/build/linux-module-build-system.scm +++ b/guix/build/linux-module-build-system.scm @@ -50,16 +50,22 @@ (define* (configure #:key inputs target arch #:allow-other-keys) ; TODO: kernel ".config". #t) -(define* (build #:key inputs make-flags (source-directory ".") #:allow-other-keys) +(define* (build #:key (make-flags '()) (parallel-build? #t) + (source-directory ".") + inputs + #:allow-other-keys) (apply invoke "make" "-C" (string-append (assoc-ref inputs "linux-module-builder") "/lib/modules/build") (string-append "M=" (canonicalize-path source-directory)) - (or make-flags '()))) + `(,@(if parallel-build? + `("-j" ,(number->string (parallel-job-count))) + '()) + ,@make-flags))) -;; This block was copied from make-linux-libre--only took the "modules_install" -;; part. -(define* (install #:key make-flags (source-directory ".") +;; Similar to the "modules_install" part of make-linux-libre. +(define* (install #:key (make-flags '()) (parallel-build? #t) + (source-directory ".") inputs native-inputs outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) @@ -80,7 +86,10 @@ (define* (install #:key make-flags (source-directory ".") (string-append "INSTALL_MOD_PATH=" out) "INSTALL_MOD_STRIP=1" "modules_install" - (or make-flags '())))) + `(,@(if parallel-build? + `("-j" ,(number->string (parallel-job-count))) + '()) + ,@make-flags)))) (define %standard-phases (modify-phases gnu:%standard-phases -- cgit v1.2.3