me
/
guix
Archived
1
0
Fork 0

gnu: go: Make 'make-go-std' memoizing.

* gnu/packages/golang.scm (make-go-std): Use 'mlambdaq'.
master
Ludovic Courtès 2022-06-02 14:40:57 +02:00
parent fb21085d25
commit 5b6b4ade7c
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 33 additions and 29 deletions

View File

@ -53,6 +53,7 @@
(define-module (gnu packages golang) (define-module (gnu packages golang)
#:use-module ((guix licenses) #:prefix license:) #:use-module ((guix licenses) #:prefix license:)
#:use-module (guix utils) #:use-module (guix utils)
#:use-module (guix memoization)
#:use-module ((guix build utils) #:select (alist-replace)) #:use-module ((guix build utils) #:select (alist-replace))
#:use-module (guix download) #:use-module (guix download)
#:use-module (guix git-download) #:use-module (guix git-download)
@ -840,35 +841,38 @@ in the style of communicating sequential processes (@dfn{CSP}).")
(define-public go go-1.17) (define-public go go-1.17)
(define-public (make-go-std go) (define make-go-std
"Return a package which builds the standard library for Go compiler GO." (mlambdaq (go)
(package "Return a package which builds the standard library for Go compiler GO."
(name (string-append (package-name go) "-std")) (package
(version (package-version go)) (name (string-append (package-name go) "-std"))
(source #f) (version (package-version go))
(build-system go-build-system) (source #f)
(arguments (build-system go-build-system)
`(#:import-path "std" (arguments
#:build-flags `("-pkgdir" "pkg") ; "Install" to build directory. `(#:import-path "std"
#:allow-go-reference? #t #:build-flags `("-pkgdir" "pkg") ; "Install" to build directory.
#:substitutable? #f ; Faster to build than download. #:allow-go-reference? #t
#:tests? #f ; Already tested in the main Go build. #:substitutable? #f ; Faster to build than download.
#:go ,go #:tests? #f ; Already tested in the main Go build.
#:phases #:go ,go
(modify-phases %standard-phases #:phases
(delete 'unpack) (modify-phases %standard-phases
(replace 'install (delete 'unpack)
(lambda* (#:key outputs #:allow-other-keys) (replace 'install
(let* ((out (assoc-ref outputs "out")) (lambda* (#:key outputs #:allow-other-keys)
(out-cache (string-append out "/var/cache/go/build"))) (let* ((out (assoc-ref outputs "out"))
(copy-recursively (getenv "GOCACHE") out-cache) (out-cache (string-append out "/var/cache/go/build")))
(delete-file (string-append out-cache "/trim.txt")) (copy-recursively (getenv "GOCACHE") out-cache)
(delete-file (string-append out-cache "/README"))))) (delete-file (string-append out-cache "/trim.txt"))
(delete 'install-license-files)))) (delete-file (string-append out-cache "/README")))))
(home-page (package-home-page go)) (delete 'install-license-files))))
(synopsis "Cached standard library build for Go") (home-page (package-home-page go))
(description (package-description go)) (synopsis "Cached standard library build for Go")
(license (package-license go)))) (description (package-description go))
(license (package-license go)))))
(export make-go-std)
;; Make those public so they have a corresponding Cuirass job. ;; Make those public so they have a corresponding Cuirass job.
(define-public go-std-1.14 (make-go-std go-1.14)) (define-public go-std-1.14 (make-go-std go-1.14))