From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Subject: bug#27284: [PATCH 2/8] build: Honor make's '-j' flag. Date: Fri, 20 Oct 2017 18:05:51 +0200 Message-ID: <20171020160557.27096-3-ludo@gnu.org> References: <87poamv2i7.fsf@gnu.org> <20171020160557.27096-1-ludo@gnu.org> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46597) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5ZpC-0003eU-99 for bug-guix@gnu.org; Fri, 20 Oct 2017 12:07:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e5Zp8-0007Zu-Ik for bug-guix@gnu.org; Fri, 20 Oct 2017 12:07:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:43918) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e5Zp8-0007Zq-FH for bug-guix@gnu.org; Fri, 20 Oct 2017 12:07:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <20171020160557.27096-1-ludo@gnu.org> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: 27284@debbugs.gnu.org * build-aux/compile-all.scm (parallel-job-count): New procedure. : Pass it to 'compile-files' as #:workers. --- build-aux/compile-all.scm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/build-aux/compile-all.scm b/build-aux/compile-all.scm index 2fc3102da..4aa4ac9b9 100644 --- a/build-aux/compile-all.scm +++ b/build-aux/compile-all.scm @@ -44,6 +44,31 @@ (or (not (file-exists? go)) (file-mtimenumber count) _ ...) + (if (integer? count) + count + (current-processor-count))) + ((head tail ...) + (if (string-prefix? "-j" head) + (match (string-drop head 2) + ("" + (current-processor-count)) + ((= string->number count) + (if (integer? count) + count + (current-processor-count)))) + (loop tail)))))))) + ;; Install a SIGINT handler to give unwind handlers in 'compile-file' an ;; opportunity to run upon SIGINT and to remove temporary output files. (sigaction SIGINT @@ -54,6 +79,7 @@ ((_ . files) (compile-files srcdir (getcwd) (filter file-needs-compilation? files) + #:workers (parallel-job-count) #:host host #:report-load (lambda (file total completed) (when file -- 2.14.2