diff mbox

go@1.5

Message ID 871t4mynom.fsf@mailerver.i-did-not-set--mail-host-address--so-tickle-me
State New
Headers show

Commit Message

Matthew Jordan May 28, 2016, 7:42 p.m. UTC
Go compiler version 1.5, dependant on "[Patch] go@1.4".
Sincerely,

Comments

Leo Famulari June 3, 2016, 11:43 p.m. UTC | #1
On Sat, May 28, 2016 at 03:42:17PM -0400, Matthew Jordan wrote:
> Go compiler version 1.5, dependant on "[Patch] go@1.4".

Do executables created with this compiler also need to be wrapped? I
built Syncthing 0.13.5 with this compiler, and I got the familiar error
when trying to run the Syncthing binary:

$ ./pre-inst-env guix environment --ad-hoc go@1.5 --container --share=/home/leo/src
# [env] cd ~/src/github.com/syncthing/syncthing && go run build.go
[...]
# ./bin/syncthing 
./bin/syncthing: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory
Matthew Jordan June 4, 2016, 12:01 a.m. UTC | #2
Hi Leo,

I haven't posted the go@1.5 updated patch yet, but that patch is now
obsolete.  once go@1.4 has been accepted I'll mail the patch for go@1.5.
The new ones don't use wrappers.

you see the latest go@1.4 patch in the meantime.

Sincerely,
diff mbox

Patch

From bff345bbe0a702eadd44f8d6bc2da9eed8409f6e Mon Sep 17 00:00:00 2001
From: Matthew Jordan <matthewjordandevops@yandex.com>
Date: Thu, 26 May 2016 08:59:06 -0400
Subject: [PATCH 2/3] Add go@1.5.

* gnu/packages/golang.scm: Modfied file.
---
 gnu/packages/golang.scm | 129 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 129 insertions(+)

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 77d4b0e..241bfdb 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -183,3 +183,132 @@ 
 garbage collection, various safety features and in the style of communicating
 sequential processes (CSP) concurrent programming features added.")
     (license license:bsd-3)))
+
+(define-public go-1.5
+  (package
+    (inherit go-1.4)
+    (name "go")
+    (version "1.5.4")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://storage.googleapis.com/golang/"
+                           name version ".src.tar.gz"))
+       (sha256
+        (base32
+         "14xwn2pr3g4i1h8qpyrjjdmq1pgvzkagk4aqsp841hfxwyyclah0"))))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (delete 'validate-runpath)
+         (add-after 'patch-generated-file-shebangs 'chdir
+           (lambda _ (chdir "src")))
+         (add-before 'build 'prebuild
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((gcclib (string-append (assoc-ref inputs "gcc:lib") "/lib"))
+                    (ld (string-append
+                         (assoc-ref inputs "glibc") "/lib"))
+                    (loader (car (find-files ld "^ld-linux.+")))
+                    (libgcc (string-append (assoc-ref inputs "gcc:lib") "/lib"))
+                    (net-base (assoc-ref inputs "net-base"))
+                    (tzdata-path
+                     (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo"))
+                    (output (assoc-ref outputs "out")))
+               ;; Removing net/ tests
+               (for-each
+                (lambda (srcfile)
+                  (let ((srcfile (string-append "net/" srcfile)))
+                    (if (file-exists? srcfile)
+                        (delete-file srcfile))))
+                '("multicast_test.go" "parse_test.go" "port_test.go"))
+               (substitute* "os/os_test.go"
+                 (("/usr/bin") (getcwd))
+                 (("/bin/pwd") (which "pwd")))
+               ;; Disable failing tests
+               (for-each
+                (lambda (srcfile)
+                  (substitute* (car srcfile)
+                    (((cdr srcfile) all) (string-append all "return\n"))))
+                (list
+                 '("net/net_test.go" . ".+TestShutdownUnix.+")
+                 '("net/dial_test.go" . ".+TestDialTimeout.+")
+                 '("os/os_test.go" . ".+TestHostname.+")
+                 '("time/format_test.go" . ".+TestParseInSydney.+")
+                 '("os/exec/exec_test.go" . ".+TestEcho.+")
+                 '("os/exec/exec_test.go" . ".+TestCommandRelativeName.+")
+                 '("os/exec/exec_test.go" . ".+TestCatStdin.+")
+                 '("os/exec/exec_test.go" . ".+TestCatGoodAndBadFile.+")
+                 '("os/exec/exec_test.go" . ".+TestExitStatus.+")
+                 '("os/exec/exec_test.go" . ".+TestPipes.+")
+                 '("os/exec/exec_test.go" . ".+TestStdinClose.+")
+                 '("os/exec/exec_test.go" . ".+TestIgnorePipeErrorOnSuccess.+")
+                 '("syscall/syscall_unix_test.go" . ".+TestPassFD\\(.+")
+                 '("os/exec/exec_test.go" . ".+TestExtraFiles.+")
+                 '("net/listen_test.go" . ".+TestIPv4MulticastListener\\(.+")
+                 '("syscall/exec_linux_test.go" .
+                   ".+TestCloneNEWUSERAndRemapNoRootDisableSetgroups.+")))
+               (substitute* "net/lookup_unix.go"
+                 (("/etc/protocols") (string-append net-base "/etc/protocols")))
+               (substitute* "time/zoneinfo_unix.go"
+                 (("/usr/share/zoneinfo/") tzdata-path))
+               (substitute*
+                   (find-files "cmd" "asm.c")
+                 (("/lib/ld-linux.*\\.so\\.[0-9]") loader)))))
+         (replace 'build
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((go  (assoc-ref inputs "go"))
+                    (output (assoc-ref outputs "out")))
+               (setenv "CC" (which "gcc"))
+               (setenv "GOOS" "linux")
+               (setenv "GOROOT" (dirname (getcwd)))
+               (setenv "GOROOT_BOOTSTRAP" go)
+               (setenv "GOROOT_FINAL" output)
+               (setenv "GOGC" "400")
+               (setenv "LD_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
+               (setenv "CGO_ENABLED" "1")
+               (zero? (system* "sh" "all.bash")))))
+         (replace 'install
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((output (assoc-ref outputs "out"))
+                    (doc_out (assoc-ref outputs "doc"))
+                    (bash (string-append (assoc-ref inputs "bash") "bin/bash"))
+                    (docs (string-append doc_out "/share/doc/" ,name "-" ,version))
+                    (src (string-append
+                          (assoc-ref outputs "src") "/share/" ,name "-" ,version)))
+               (mkdir-p src)
+               (copy-recursively "../test" (string-append src "/test"))
+               (delete-file-recursively "../test")
+               (mkdir-p docs)
+               (copy-recursively "../api" (string-append docs "/api"))
+               (delete-file-recursively "../api")
+               (copy-recursively "../doc" (string-append docs "/doc"))
+               (delete-file-recursively "../doc")
+
+               (for-each
+                (lambda (file)
+                  (let* ((filein (string-append "../" file))
+                         (fileout (string-append docs "/" file)))
+                  (copy-file filein fileout)
+                  (delete-file filein)))
+                '("README.md" "CONTRIBUTORS" "AUTHORS" "PATENTS"
+                  "LICENSE" "VERSION" "CONTRIBUTING.md" "robots.txt"))
+               (rename-file "../bin/go" (string-append "../bin/go-" ,version))
+
+               ;; Create a wrapper script for go command
+               (call-with-output-file (string-append "../bin/go")
+                 (lambda (port)
+                   (format port (string-append "#!" bash "\n"))
+                   (format port "\nexport LD_LIBRARY_PATH=$LIBRARY_PATH\n")
+                   (format port (string-append "go-" ,version " \"$@\""))
+                   (chmod port #o555)))
+
+               (copy-recursively "../" output)))))
+       #:tests? #f))
+    (inputs
+     `(,@(package-inputs go-1.4)))
+    (native-inputs
+     `(("go" ,go-1.4)
+       ,@(alist-delete "gccgo" (package-native-inputs go-1.4))))
+    (propagated-inputs
+     `(,@(package-propagated-inputs go-1.4)))))
-- 
2.8.3