diff options
author | Efraim Flashner <efraim@flashner.co.il> | 2021-12-21 18:21:53 +0200 |
---|---|---|
committer | Efraim Flashner <efraim@flashner.co.il> | 2021-12-21 18:24:01 +0200 |
commit | 8f85e4f9aa0bd53d0240ea28e280551c8a066b85 (patch) | |
tree | 31efebef0f7c944d14298ef1d3b66aee3f5e2c2b | |
parent | 7ccfec3065ffec59b5d285ec6b1dde06ce891781 (diff) | |
download | guix-8f85e4f9aa0bd53d0240ea28e280551c8a066b85.tar guix-8f85e4f9aa0bd53d0240ea28e280551c8a066b85.tar.gz |
gnu: go-1.17: Build with gcc:lib on arm* architectures.
* gnu/packages/golang.scm (go-1.17)[arguments]: Add phase on arm*
architectures to link to gcc:lib.
[inputs]: When building for arm* don't remove gcc:lib.
-rw-r--r-- | gnu/packages/golang.scm | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm index f03e9cc6f3..f716c69d13 100644 --- a/gnu/packages/golang.scm +++ b/gnu/packages/golang.scm @@ -685,6 +685,29 @@ in the style of communicating sequential processes (@dfn{CSP}).") (string-append net-base "/etc/services"))) (substitute* "src/time/zoneinfo_unix.go" (("/usr/share/zoneinfo/") tzdata-path))))) + ;; Keep this synchronized with the package inputs. + ,@(if (target-arm?) + '((add-after 'unpack 'patch-gcc:lib + (lambda* (#:key inputs #:allow-other-keys) + (let* ((gcclib (string-append (assoc-ref inputs "gcc:lib") "/lib"))) + ;; Add libgcc to runpath + (substitute* "src/cmd/link/internal/ld/lib.go" + (("!rpath.set") "true")) + (substitute* "src/cmd/go/internal/work/gccgo.go" + (("cgoldflags := \\[\\]string\\{\\}") + (string-append "cgoldflags := []string{" + "\"-Wl,-rpath=" gcclib "\"" + "}")) + (("\"-lgcc_s\", ") + (string-append + "\"-Wl,-rpath=" gcclib "\", \"-lgcc_s\", "))) + (substitute* "src/cmd/go/internal/work/gc.go" + (("ldflags = setextld\\(ldflags, compiler\\)") + (string-append + "ldflags = setextld(ldflags, compiler)\n" + "ldflags = append(ldflags, \"-r\")\n" + "ldflags = append(ldflags, \"" gcclib "\")\n"))))))) + '()) (add-after 'patch-source 'disable-failing-tests (lambda _ ;; Disable failing tests: these tests attempt to access @@ -796,7 +819,9 @@ in the style of communicating sequential processes (@dfn{CSP}).") (install-file file (string-append out "/share/doc/go"))) '("AUTHORS" "CONTRIBUTORS" "CONTRIBUTING.md" "PATENTS" "README.md" "SECURITY.md")))))))) - (inputs (alist-delete "gcc:lib" (package-inputs go-1.16))) + (inputs (if (not (target-arm?)) + (alist-delete "gcc:lib" (package-inputs go-1.16)) + (package-inputs go-1.16))) (native-inputs (if (not (member (%current-system) (package-supported-systems go-1.4))) ;; gccgo-10.4, 11.3 and lower has a bug which causes bootstrapping |