guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

46/75: build-system/go: Honor #:parallel-build?.


From: guix-commits
Subject: 46/75: build-system/go: Honor #:parallel-build?.
Date: Sun, 21 Jan 2024 13:21:48 -0500 (EST)

apteryx pushed a commit to branch core-updates
in repository guix.

commit 16bfc5fb21db8ea47b17ff3248114c34f4c8e3ab
Author: Sarah Morgensen <iskarian@mgsn.dev>
AuthorDate: Fri Aug 6 21:48:33 2021 -0700

    build-system/go: Honor #:parallel-build?.
    
    guix/build/go-build-system.scm (build): Honor #:parallel-build?.
    guix/build-system/go.scm (go-build): Add PARALLEL-BUILD? parameter.
    [builder]: Use it.
    
    Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
---
 guix/build-system/go.scm       | 2 ++
 guix/build/go-build-system.scm | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/guix/build-system/go.scm b/guix/build-system/go.scm
index 3883fac786..0acaeca1cc 100644
--- a/guix/build-system/go.scm
+++ b/guix/build-system/go.scm
@@ -184,6 +184,7 @@ commit hash and its date rather than a proper release tag."
                    (unpack-path "")
                    (build-flags ''())
                    (tests? #t)
+                   (parallel-build? #t)
                    (allow-go-reference? #f)
                    (system (%current-system))
                    (goarch #f)
@@ -214,6 +215,7 @@ commit hash and its date rather than a proper release tag."
                     #:unpack-path #$unpack-path
                     #:build-flags #$build-flags
                     #:tests? #$tests?
+                    #:parallel-build? #$parallel-build?
                     #:allow-go-reference? #$allow-go-reference?
                     #:inputs #$(input-tuples->gexp inputs)))))
 
diff --git a/guix/build/go-build-system.scm b/guix/build/go-build-system.scm
index d32235bf5a..a55381b0c6 100644
--- a/guix/build/go-build-system.scm
+++ b/guix/build/go-build-system.scm
@@ -255,8 +255,12 @@ unpacking."
                 (_ #f))
               inputs))))
 
-(define* (build #:key import-path build-flags #:allow-other-keys)
+(define* (build #:key import-path build-flags (parallel-build? #t)
+                #:allow-other-keys)
   "Build the package named by IMPORT-PATH."
+  (let* ((njobs (if parallel-build? (parallel-job-count) 1)))
+    (setenv "GOMAXPROCS" (number->string njobs)))
+
   (with-throw-handler
     #t
     (lambda _



reply via email to

[Prev in Thread] Current Thread [Next in Thread]