~ruther/guix-local

0cd912186a178aab591bf151a86899dfb0d29fe3 — Efraim Flashner 5 years ago 9cda21c
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.
2 files changed, 6 insertions(+), 4 deletions(-)

M guix/build-system/go.scm
M guix/build/go-build-system.scm
M guix/build-system/go.scm => guix/build-system/go.scm +2 -2
@@ 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)

M guix/build/go-build-system.scm => guix/build/go-build-system.scm +4 -2
@@ 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"))