gnu: Add Go 1.6.
* gnu/packages/golang.scm (go-1.6): New variable. Co-authored-by: Efraim Flashner <efraim@flashner.co.il> Co-authored-by: Andy Wingo <wingo@igalia.com> Co-authored-by: Ludovic Courtès <ludo@gnu.org>master
parent
f92d99a5a3
commit
ec91bcb500
|
@ -2,6 +2,7 @@
|
|||
;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
|
||||
;;; Copyright © 2016 Matthew Jordan <matthewjordandevops@yandex.com>
|
||||
;;; Copyright © 2016 Andy Wingo <wingo@igalia.com>
|
||||
;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
|
||||
;;;
|
||||
;;; This file is an addendum GNU Guix.
|
||||
;;;
|
||||
|
@ -183,3 +184,156 @@ compiled, statically typed language in the tradition of C and C++, with
|
|||
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.6
|
||||
(package
|
||||
(inherit go-1.4)
|
||||
(name "go")
|
||||
(version "1.6.3")
|
||||
(source
|
||||
(origin
|
||||
(method url-fetch)
|
||||
(uri (string-append "https://storage.googleapis.com/golang/"
|
||||
name version ".src.tar.gz"))
|
||||
(sha256
|
||||
(base32
|
||||
"002v6irgfd63zp9iza8nski5by0lar033j3ddpqiikw6bznsw9k3"))))
|
||||
(arguments
|
||||
(substitute-keyword-arguments (package-arguments go-1.4)
|
||||
((#:phases phases)
|
||||
`(modify-phases ,phases
|
||||
(replace 'prebuild
|
||||
;; TODO: Most of this could be factorized with Go 1.4.
|
||||
(lambda* (#:key inputs outputs #:allow-other-keys)
|
||||
(let* ((gcclib (string-append (assoc-ref inputs "gcc:lib") "/lib"))
|
||||
(ld (string-append (assoc-ref inputs "libc") "/lib"))
|
||||
(loader (car (find-files ld "^ld-linux.+")))
|
||||
(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, which fail when attempting to access
|
||||
;; network resources not present in the build container.
|
||||
(for-each delete-file
|
||||
'("net/listen_test.go" "net/parse_test.go"))
|
||||
|
||||
(substitute* "os/os_test.go"
|
||||
(("/usr/bin") (getcwd))
|
||||
(("/bin/pwd") (which "pwd")))
|
||||
|
||||
;; Add libgcc to runpath
|
||||
(substitute* "cmd/link/internal/ld/lib.go"
|
||||
(("!rpath.set") "true"))
|
||||
(substitute* "cmd/go/build.go"
|
||||
(("cgoldflags := \\[\\]string\\{\\}")
|
||||
(string-append "cgoldflags := []string{"
|
||||
"\"-rpath=" gcclib "\""
|
||||
"}"))
|
||||
(("ldflags = setextld\\(ldflags, compiler\\)")
|
||||
(string-append
|
||||
"ldflags = setextld(ldflags, compiler)\n"
|
||||
"ldflags = append(ldflags, \"-r\")\n"
|
||||
"ldflags = append(ldflags, \"" gcclib "\")\n"))
|
||||
(("\"-lgcc_s\", ")
|
||||
(string-append
|
||||
"\"-Wl,-rpath=" gcclib "\", \"-lgcc_s\", ")))
|
||||
|
||||
;; Disable failing tests: these tests attempt to access
|
||||
;; commands or network resources which are neither available or
|
||||
;; necessary for the build to succeed.
|
||||
(for-each
|
||||
(match-lambda
|
||||
((file regex)
|
||||
(substitute* file
|
||||
((regex all before test_name)
|
||||
(string-append before "Disabled" test_name)))))
|
||||
'(("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/areturn.+)")
|
||||
("cmd/go/go_test.go" "(.+)(TestCoverageWithCgo.+)")
|
||||
("os/exec/exec_test.go" "(.+)(TestOutputStderrCapture.+)")
|
||||
("os/exec/exec_test.go" "(.+)(TestExtraFiles.+)")
|
||||
("os/exec/exec_test.go" "(.+)(TestExtraFilesRace.+)")
|
||||
("net/lookup_test.go" "(.+)(TestLookupPort.+)")
|
||||
("syscall/exec_linux_test.go"
|
||||
"(.+)(TestCloneNEWUSERAndRemapNoRootDisableSetgroups.+)")))
|
||||
|
||||
(substitute* "../misc/cgo/testsanitizers/test.bash"
|
||||
(("(CC=)cc" all var) (string-append var "gcc")))
|
||||
|
||||
;; fix shebang for testar script
|
||||
;; note the target script is generated at build time.
|
||||
(substitute* "../misc/cgo/testcarchive/test.bash"
|
||||
(("#!/usr/bin/env") (string-append "#!" (which "env"))))
|
||||
|
||||
(substitute* "net/lookup_unix.go"
|
||||
(("/etc/protocols") (string-append net-base "/etc/protocols")))
|
||||
(substitute* "net/port_unix.go"
|
||||
(("/etc/services") (string-append net-base "/etc/services")))
|
||||
(substitute* "time/zoneinfo_unix.go"
|
||||
(("/usr/share/zoneinfo/") tzdata-path))
|
||||
(substitute* (find-files "cmd" "asm.c")
|
||||
(("/lib/ld-linux.*\\.so\\.[0-9]") loader))
|
||||
#t)))
|
||||
(add-before 'build 'set-bootstrap-variables
|
||||
(lambda* (#:key outputs inputs #:allow-other-keys)
|
||||
;; Tell the build system where to find the bootstrap Go.
|
||||
(let ((go (assoc-ref inputs "go"))
|
||||
(out (assoc-ref outputs "out")))
|
||||
(setenv "GOROOT_BOOTSTRAP" go)
|
||||
(setenv "PATH"
|
||||
(string-append out "/bin:"
|
||||
(dirname (getcwd)) "/bin:"
|
||||
(getenv "PATH")))
|
||||
|
||||
;; XXX: The following variables seem unrelated.
|
||||
(setenv "GOGC" "400")
|
||||
(setenv "GO_TEST_TIMEOUT_SCALE" "9999")
|
||||
#t)))
|
||||
(replace 'install
|
||||
;; TODO: Most of this could be factorized with Go 1.4.
|
||||
(lambda* (#:key outputs #:allow-other-keys)
|
||||
(let* ((output (assoc-ref outputs "out"))
|
||||
(doc_out (assoc-ref outputs "doc"))
|
||||
(docs (string-append doc_out "/share/doc/" ,name "-" ,version))
|
||||
(src (string-append
|
||||
(assoc-ref outputs "tests") "/share/" ,name "-" ,version)))
|
||||
(delete-file-recursively "../pkg/bootstrap")
|
||||
|
||||
(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)))
|
||||
;; Note the slightly different file names compared to 1.4.
|
||||
'("README.md" "CONTRIBUTORS" "AUTHORS" "PATENTS"
|
||||
"LICENSE" "VERSION" "CONTRIBUTING.md" "robots.txt"))
|
||||
|
||||
(copy-recursively "../" output))))))))
|
||||
(native-inputs
|
||||
`(("go" ,go-1.4)
|
||||
,@(package-native-inputs go-1.4)))))
|
||||
|
||||
(define-public go go-1.6)
|
||||
|
|
Reference in New Issue