[Top][All Lists]

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

[bug#51981] [PATCH 1/1] build: Fix cross compilation for go-build-system

From: Collin J. Doering
Subject: [bug#51981] [PATCH 1/1] build: Fix cross compilation for go-build-system
Date: Fri, 19 Nov 2021 15:37:34 -0500
User-agent: mu4e 1.6.10; emacs 27.2

 guix/build/go-build-system.scm | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/guix/build/go-build-system.scm b/guix/build/go-build-system.scm
index 4768ee8562..f36e98f47a 100644
--- a/guix/build/go-build-system.scm
+++ b/guix/build/go-build-system.scm
@@ -148,7 +148,6 @@ (define* (setup-go-environment #:key inputs outputs goos 
goarch #:allow-other-ke
   ;; currently support modules, so turn modules off to continue using the old
   ;; GOPATH behavior.
   (setenv "GO111MODULE" "off")
-  (setenv "GOBIN" (string-append (assoc-ref outputs "out") "/bin"))
   ;; Make sure we're building for the correct architecture and OS targets
   ;; that Guix targets.
@@ -234,14 +233,19 @@ (define (go-inputs inputs)
                 (_ #f))
-(define* (build #:key import-path build-flags #:allow-other-keys)
+(define* (build #:key outputs import-path build-flags #:allow-other-keys)
   "Build the package named by IMPORT-PATH."
     (lambda _
-      (apply invoke "go" "install"
+      (apply invoke "go" "build"
               "-v" ; print the name of packages as they are compiled
               "-x" ; print each command as it is invoked
+              ;; Set the output path for the build
+              (string-append "-o="
+                (assoc-ref outputs "out") "/bin/"
+                (package-name->name+version
+                  (strip-store-file-name (assoc-ref outputs "out"))))
               ;; Respectively, strip the symbol table and debug
               ;; information, and the DWARF symbol table.
               "-ldflags=-s -w"

Collin J. Doering

reply via email to

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