diff mbox series

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

Message ID 877dd36fvc.fsf@rekahsoft.ca
State New
Headers show
Series [bug#51981,1/1] build: Fix cross compilation for go-build-system | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Collin J. Doering Nov. 19, 2021, 8:37 p.m. UTC
---
 guix/build/go-build-system.scm | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
diff mbox series

Patch

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))
               inputs))))
 
-(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."
   (with-throw-handler
     #t
     (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"