From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:48417) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8Ab5-0004fE-7H for guix-patches@gnu.org; Sun, 24 Mar 2019 17:24:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h8Ab4-0007op-58 for guix-patches@gnu.org; Sun, 24 Mar 2019 17:24:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:43661) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h8Ab3-0007oH-V0 for guix-patches@gnu.org; Sun, 24 Mar 2019 17:24:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h8Ab3-0004NZ-R5 for guix-patches@gnu.org; Sun, 24 Mar 2019 17:24:01 -0400 Subject: [bug#34982] [PATCH] guile-build-system: Support building in parallel. Resent-Message-ID: Received: from eggs.gnu.org ([209.51.188.92]:48386) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8Aau-0004et-LJ for guix-patches@gnu.org; Sun, 24 Mar 2019 17:23:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h8Aar-0007Pv-0O for guix-patches@gnu.org; Sun, 24 Mar 2019 17:23:50 -0400 Received: from li622-129.members.linode.com ([212.71.249.129]:48220 helo=mira.cbaines.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8Aap-0007Ny-6p for guix-patches@gnu.org; Sun, 24 Mar 2019 17:23:48 -0400 Received: from localhost (cpc102582-walt20-2-0-cust14.13-2.cable.virginm.net [86.27.34.15]) by mira.cbaines.net (Postfix) with ESMTPSA id 5DB1D16DCA for ; Sun, 24 Mar 2019 21:23:45 +0000 (GMT) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 1817ac54 for ; Sun, 24 Mar 2019 21:23:45 +0000 (UTC) From: Christopher Baines Date: Sun, 24 Mar 2019 21:23:45 +0000 Message-Id: <20190324212345.4697-1-mail@cbaines.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 34982@debbugs.gnu.org * guix/build/guile-build-system.scm (build): Use n-par-for-each, instead = of for-each, to use multiple cores if available. --- guix/build/guile-build-system.scm | 43 +++++++++++++++++++------------ 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/guix/build/guile-build-system.scm b/guix/build/guile-build-s= ystem.scm index 0bed049436..a5741081bf 100644 --- a/guix/build/guile-build-system.scm +++ b/guix/build/guile-build-system.scm @@ -23,6 +23,7 @@ #:use-module (ice-9 match) #:use-module (ice-9 popen) #:use-module (ice-9 rdelim) + #:use-module (ice-9 threads) #:use-module (guix build utils) #:export (target-guile-effective-version %standard-phases @@ -101,24 +102,32 @@ Return #false if it cannot be determined." (match (getenv "GUILE_LOAD_COMPILED_PATH") (#f "") (path (string-append ":" path))))) - (for-each (lambda (file) - (let* ((go (string-append go-dir - (file-sans-extension file) - ".go"))) - ;; Install source module. - (install-file (string-append source-directory "/" file= ) - (string-append module-dir - "/" (dirname file))) + (n-par-for-each + (parallel-job-count) + (lambda (file) + (catch #t + (lambda () + (let* ((go (string-append go-dir + (file-sans-extension file) + ".go"))) + ;; Install source module. + (install-file (string-append source-directory "/" file) + (string-append module-dir + "/" (dirname file))) =20 - ;; Install and compile module. - (apply invoke guild "compile" "-L" source-directory - "-o" go - (string-append source-directory "/" file) - flags))) - - ;; Arrange to strip SOURCE-DIRECTORY from file names. - (with-directory-excursion source-directory - (find-files "." scheme-file-regexp))) + ;; Install and compile module. + (apply invoke guild "compile" "-L" source-directory + "-o" go + (string-append source-directory "/" file) + flags))) + (lambda (key . args) + ;; Since ports are not thread-safe as of Guile 2.0, reopen st= derr. + (let ((port (fdopen 2 "w0"))) + (print-exception port #f key args) + (primitive-exit 1))))) + ;; Arrange to strip SOURCE-DIRECTORY from file names. + (with-directory-excursion source-directory + (find-files "." scheme-file-regexp))) #t)) =20 (define* (install-documentation #:key outputs --=20 2.20.1