@@ -1405,7 +1405,8 @@ in the style of communicating sequential processes (@dfn{CSP}).")
"19a93p217h5xi2sgh34qzv24pkd4df0sw4fc5z6k47lspjp3vx2l"))))
(arguments
(substitute-keyword-arguments (package-arguments go-1.14)
- ((#:tests? _) #t)
+ ((#:tests? _ #t) #t)
+ ((#:strip-directories _ '()) ''("lib/go/pkg/tool" "lib/go/bin"))
((#:phases phases)
`(modify-phases ,phases
(add-after 'unpack 'remove-unused-sourcecode-generators
@@ -1523,7 +1524,7 @@ in the style of communicating sequential processes (@dfn{CSP}).")
(setenv "GO_LDSO" loader)
(setenv "GOOS" "linux")
(setenv "GOROOT" (dirname (getcwd)))
- (setenv "GOROOT_FINAL" output)
+ (setenv "GOROOT_FINAL" (string-append output "/lib/go"))
(setenv "GOCACHE" "/tmp/go-cache")
(invoke "sh" "make.bash" "--no-banner"))))
(replace 'check
@@ -1537,7 +1538,48 @@ in the style of communicating sequential processes (@dfn{CSP}).")
(lambda _
;; Rewrite references to perl input in test scripts
(substitute* "net/http/cgi/testdata/test.cgi"
- (("^#!.*") "#!/usr/bin/env perl\n"))))))))
+ (("^#!.*") "#!/usr/bin/env perl\n"))))
+ (replace 'install
+ ;; TODO: Most of this could be factorized with Go 1.4.
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (tests (assoc-ref outputs "tests"))
+ (out-lib (string-append out "/lib/go"))
+ (tests-share (string-append tests "/share/go"))
+ (docs (string-append (assoc-ref outputs "doc")
+ "/share/doc/go-"
+ ,(package-version this-package))))
+ ;; Prevent installation of the build cache, which contains
+ ;; store references to most of the tools used to build Go and
+ ;; would unnecessarily increase the size of Go's closure if it
+ ;; was installed.
+ (delete-file-recursively "../pkg/obj")
+
+ (install-file "../VERSION" out-lib)
+ (copy-recursively "../pkg" (string-append out-lib "/pkg"))
+ (copy-recursively "../src" (string-append out-lib "/src"))
+ (copy-recursively "../bin" (string-append out-lib "/bin"))
+ (copy-recursively "../lib" (string-append out-lib "/lib"))
+ (copy-recursively "../misc" (string-append out-lib "/misc"))
+
+ (mkdir-p (string-append out "/bin"))
+ (with-directory-excursion (string-append out "/bin")
+ (symlink "../lib/go/bin/go" "go")
+ (symlink "../lib/go/bin/gofmt" "gofmt"))
+
+ (mkdir-p tests-share)
+ (copy-recursively "../test" (string-append tests-share "/test"))
+ (copy-recursively "../api" (string-append tests-share "/api"))
+
+ (for-each
+ (lambda (file) (install-file (string-append "../" file) docs))
+ ;; Note the slightly different file names compared to 1.4.
+ '("AUTHORS" "CONTRIBUTING.md" "CONTRIBUTORS" "PATENTS"
+ "README.md" "SECURITY.md" "favicon.ico" "robots.txt"))
+ (copy-recursively "../doc" (string-append docs "/doc")))))
+ (add-before 'install-license-files 'reset-cwd
+ (lambda _
+ (chdir "..")))))))
(native-inputs
`(("go-fix-script-tests.patch" ,(search-patch "go-fix-script-tests.patch"))
,@(if (not (member (%current-system) (package-supported-systems go-1.4)))