build-system/go: Parameterize installing the source code.

* guix/build-system/go.scm (go-build): Add install-source? key.
* guix/build/go-build-system.scm (install-source): Check if
install-source? is true.
This commit is contained in:
Leo Famulari 2017-10-24 12:17:32 -04:00
parent 1c37f839fb
commit c10851cf91
No known key found for this signature in database
GPG key ID: 2646FA30BACA7F08
2 changed files with 6 additions and 3 deletions

View file

@ -78,6 +78,7 @@ (define* (go-build store name inputs
%standard-phases))
(outputs '("out"))
(search-paths '())
(install-source? #t)
(import-path "")
(unpack-path "")
(tests? #t)
@ -102,6 +103,7 @@ (define builder
#:outputs %outputs
#:search-paths ',(map search-path-specification->sexp
search-paths)
#:install-source? ,install-source?
#:import-path ,import-path
#:unpack-path ,unpack-path
#:tests? ,tests?

View file

@ -126,13 +126,14 @@ (define* (unpack #:key source import-path unpack-path #:allow-other-keys)
(zero? (system* "unzip" "-d" dest source))
(zero? (system* "tar" "-C" dest "-xvf" source))))))
(define* (install-source #:key outputs #:allow-other-keys)
(define* (install-source #:key install-source? outputs #:allow-other-keys)
"Install the source code to the output directory."
(let* ((out (assoc-ref outputs "out"))
(source "src")
(dest (string-append out "/" source)))
(copy-recursively source dest #:keep-mtime? #t)
#t))
(if install-source?
(copy-recursively source dest #:keep-mtime? #t)
#t)))
(define (go-package? name)
(string-prefix? "go-" name))