guix-commits
[Top][All Lists]
Advanced

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

branch master updated: build-system/go: Fix building on host's secondary


From: guix-commits
Subject: branch master updated: build-system/go: Fix building on host's secondary architecture.
Date: Mon, 18 Oct 2021 07:54:11 -0400

This is an automated email from the git hooks/post-receive script.

efraim pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new 0cd9121  build-system/go: Fix building on host's secondary 
architecture.
0cd9121 is described below

commit 0cd912186a178aab591bf151a86899dfb0d29fe3
Author: Efraim Flashner <efraim@flashner.co.il>
AuthorDate: Mon Oct 18 14:39:58 2021 +0300

    build-system/go: Fix building on host's secondary architecture.
    
    Before when building for i686-linux on x86_64-linux GOARCH would be set
    to amd64, not 386.
    
    * guix/build-system/go.scm (go-build): Set goarch and goos to #f when
    not cross-compiling.
    * guix/build/go-build-system.scm (setup-go-environment): Set GOARCH
    according to the calculated goarch or using GOHOSTARCH and GOOS
    according to the calculated goos or using GOHOSTOS.
---
 guix/build-system/go.scm       | 4 ++--
 guix/build/go-build-system.scm | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/guix/build-system/go.scm b/guix/build-system/go.scm
index 4c1a732..757e63a 100644
--- a/guix/build-system/go.scm
+++ b/guix/build-system/go.scm
@@ -163,8 +163,8 @@ commit hash and its date rather than a proper release tag."
                    (tests? #t)
                    (allow-go-reference? #f)
                    (system (%current-system))
-                   (goarch (first (go-target (%current-system))))
-                   (goos (last (go-target (%current-system))))
+                   (goarch #f)
+                   (goos #f)
                    (guile #f)
                    (imported-modules %go-build-system-modules)
                    (modules '((guix build go-build-system)
diff --git a/guix/build/go-build-system.scm b/guix/build/go-build-system.scm
index 645d2fe..4768ee8 100644
--- a/guix/build/go-build-system.scm
+++ b/guix/build/go-build-system.scm
@@ -152,8 +152,10 @@ dependencies, so it should be self-contained."
 
   ;; Make sure we're building for the correct architecture and OS targets
   ;; that Guix targets.
-  (setenv "GOARCH" goarch)
-  (setenv "GOOS" goos)
+  (setenv "GOARCH" (or goarch
+                       (getenv "GOHOSTARCH")))
+  (setenv "GOOS" (or goos
+                     (getenv "GOHOSTOS")))
   (match goarch
     ("arm"
      (setenv "GOARM" "7"))



reply via email to

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