summary refs log tree commit diff
path: root/gnu/packages/golang.scm
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2023-04-05 22:16:52 +0300
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-04-14 15:12:13 -0400
commitda26ab72957aa92da45f9ddaa0fe4613b8fa6408 (patch)
tree52652ad954f4c91e091b17cf329d677130ce07fe /gnu/packages/golang.scm
parent34e5ba942ec28096298b471a011144155e2720da (diff)
downloadguix-da26ab72957aa92da45f9ddaa0fe4613b8fa6408.tar.gz
gnu: go-1.18: Fix packaging logic.
* gnu/packages/golang.scm (go-1.18)[arguments]: Only replace the custom
'patch-gcc:lib phase on certain architectures.
Diffstat (limited to 'gnu/packages/golang.scm')
-rw-r--r--gnu/packages/golang.scm44
1 files changed, 23 insertions, 21 deletions
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 9c8decda61..24dae34e20 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -700,6 +700,7 @@ in the style of communicating sequential processes (@dfn{CSP}).")
                (substitute* "src/time/zoneinfo_unix.go"
                  (("/usr/share/zoneinfo/") tzdata-path)))))
          ;; Keep this synchronized with the package inputs.
+         ;; Also keep syncthonized with later versions of go.
          ,@(if (or (target-arm?) (target-ppc64le?))
              '((add-after 'unpack 'patch-gcc:lib
                  (lambda* (#:key inputs #:allow-other-keys)
@@ -864,27 +865,28 @@ in the style of communicating sequential processes (@dfn{CSP}).")
        ((#:phases phases)
         `(modify-phases ,phases
            (delete 'adjust-test-suite)
-           ;; See the platforms using this phase in go-1.17.
-           (replace '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, err := setextld\\(ldflags, compiler\\)")
-                    (string-append
-                     "ldflags, err := setextld(ldflags, compiler)\n"
-                     "ldflags = append(ldflags, \"-r\")\n"
-                     "ldflags = append(ldflags, \"" gcclib "\")\n"))))))))))))
+           ,@(if (or (target-arm?) (target-ppc64le?))
+               '((replace '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, err := setextld\\(ldflags, compiler\\)")
+                          (string-append
+                           "ldflags, err := setextld(ldflags, compiler)\n"
+                           "ldflags = append(ldflags, \"-r\")\n"
+                           "ldflags = append(ldflags, \"" gcclib "\")\n")))))))
+               '())))))))
 
 (define-public go-1.19
   (package