mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
self: Install .go files to 'lib/guile/X.Y/site-ccache'.
* guix/self.scm (guix-command): Add 'compiled-modules' parameter and honor it. (whole-package): Likewise. (compiled-guix)[built-modules]: Turn into a procedure. When PULL-VERSION is 1, use separate source and compiled modules. When PULL-VERSION is 0, return a single directory containing both .scm and .go files.
This commit is contained in:
parent
f3a34b9de8
commit
a89faa3faa
1 changed files with 32 additions and 16 deletions
|
@ -340,7 +340,8 @@ (define build
|
||||||
|
|
||||||
(computed-file "guix-manual" build))
|
(computed-file "guix-manual" build))
|
||||||
|
|
||||||
(define* (guix-command modules #:key source (dependencies '())
|
(define* (guix-command modules #:optional compiled-modules
|
||||||
|
#:key source (dependencies '())
|
||||||
(guile-version (effective-version)))
|
(guile-version (effective-version)))
|
||||||
"Return the 'guix' command such that it adds MODULES and DEPENDENCIES in its
|
"Return the 'guix' command such that it adds MODULES and DEPENDENCIES in its
|
||||||
load path."
|
load path."
|
||||||
|
@ -364,7 +365,8 @@ (define* (guix-command modules #:key source (dependencies '())
|
||||||
|
|
||||||
(set! %load-path (cons #$modules %load-path))
|
(set! %load-path (cons #$modules %load-path))
|
||||||
(set! %load-compiled-path
|
(set! %load-compiled-path
|
||||||
(cons #$modules %load-compiled-path))
|
(cons (or #$compiled-modules #$modules)
|
||||||
|
%load-compiled-path))
|
||||||
|
|
||||||
(let ((guix-main (module-ref (resolve-interface '(guix ui))
|
(let ((guix-main (module-ref (resolve-interface '(guix ui))
|
||||||
'guix-main)))
|
'guix-main)))
|
||||||
|
@ -385,14 +387,16 @@ (define* (guix-command modules #:key source (dependencies '())
|
||||||
(define* (whole-package name modules dependencies
|
(define* (whole-package name modules dependencies
|
||||||
#:key
|
#:key
|
||||||
(guile-version (effective-version))
|
(guile-version (effective-version))
|
||||||
|
compiled-modules
|
||||||
info daemon
|
info daemon
|
||||||
(command (guix-command modules
|
(command (guix-command modules
|
||||||
#:dependencies dependencies
|
#:dependencies dependencies
|
||||||
#:guile-version guile-version)))
|
#:guile-version guile-version)))
|
||||||
"Return the whole Guix package NAME that uses MODULES, a derivation of all
|
"Return the whole Guix package NAME that uses MODULES, a derivation of all
|
||||||
the modules, and DEPENDENCIES, a list of packages depended on. COMMAND is the
|
the modules, and DEPENDENCIES, a list of packages depended on. COMMAND is the
|
||||||
'guix' program to use; INFO is the Info manual."
|
'guix' program to use; INFO is the Info manual. When COMPILED-MODULES is
|
||||||
;; TODO: Move compiled modules to 'lib/guile' instead of 'share/guile'.
|
true, it is linked as 'lib/guile/X.Y/site-ccache'; otherwise, .go files are
|
||||||
|
assumed to be part of MODULES."
|
||||||
(computed-file name
|
(computed-file name
|
||||||
(with-imported-modules '((guix build utils))
|
(with-imported-modules '((guix build utils))
|
||||||
#~(begin
|
#~(begin
|
||||||
|
@ -414,7 +418,15 @@ (define* (whole-package name modules dependencies
|
||||||
(when info
|
(when info
|
||||||
(symlink #$info
|
(symlink #$info
|
||||||
(string-append #$output
|
(string-append #$output
|
||||||
"/share/info"))))))))
|
"/share/info"))))
|
||||||
|
|
||||||
|
;; Object files.
|
||||||
|
(when #$compiled-modules
|
||||||
|
(let ((modules (string-append #$output "/lib/guile/"
|
||||||
|
(effective-version)
|
||||||
|
"/site-ccache")))
|
||||||
|
(mkdir-p (dirname modules))
|
||||||
|
(symlink #$compiled-modules modules)))))))
|
||||||
|
|
||||||
(define* (compiled-guix source #:key (version %guix-version)
|
(define* (compiled-guix source #:key (version %guix-version)
|
||||||
(pull-version 1)
|
(pull-version 1)
|
||||||
|
@ -577,11 +589,9 @@ (define *config*
|
||||||
%guix-home-page-url)))
|
%guix-home-page-url)))
|
||||||
#:guile-for-build guile-for-build))
|
#:guile-for-build guile-for-build))
|
||||||
|
|
||||||
(define built-modules
|
(define (built-modules node-subset)
|
||||||
(directory-union (string-append name "-modules")
|
(directory-union (string-append name "-modules")
|
||||||
(append-map (lambda (node)
|
(append-map node-subset
|
||||||
(list (node-source node)
|
|
||||||
(node-compiled node)))
|
|
||||||
|
|
||||||
;; Note: *CONFIG* comes first so that it
|
;; Note: *CONFIG* comes first so that it
|
||||||
;; overrides the (guix config) module that
|
;; overrides the (guix config) module that
|
||||||
|
@ -609,11 +619,14 @@ (define built-modules
|
||||||
;; Version 1 is when we return the full package.
|
;; Version 1 is when we return the full package.
|
||||||
(cond ((= 1 pull-version)
|
(cond ((= 1 pull-version)
|
||||||
;; The whole package, with a standard file hierarchy.
|
;; The whole package, with a standard file hierarchy.
|
||||||
(let ((command (guix-command built-modules
|
(let* ((modules (built-modules (compose list node-source)))
|
||||||
#:source source
|
(compiled (built-modules (compose list node-compiled)))
|
||||||
#:dependencies dependencies
|
(command (guix-command modules compiled
|
||||||
#:guile-version guile-version)))
|
#:source source
|
||||||
(whole-package name built-modules dependencies
|
#:dependencies dependencies
|
||||||
|
#:guile-version guile-version)))
|
||||||
|
(whole-package name modules dependencies
|
||||||
|
#:compiled-modules compiled
|
||||||
#:command command
|
#:command command
|
||||||
|
|
||||||
;; Include 'guix-daemon'. XXX: Here we inject an
|
;; Include 'guix-daemon'. XXX: Here we inject an
|
||||||
|
@ -627,8 +640,11 @@ (define built-modules
|
||||||
#:info (info-manual source)
|
#:info (info-manual source)
|
||||||
#:guile-version guile-version)))
|
#:guile-version guile-version)))
|
||||||
((= 0 pull-version)
|
((= 0 pull-version)
|
||||||
;; Legacy 'guix pull': just return the compiled modules.
|
;; Legacy 'guix pull': return the .scm and .go files as one
|
||||||
built-modules)
|
;; directory.
|
||||||
|
(built-modules (lambda (node)
|
||||||
|
(list (node-source node)
|
||||||
|
(node-compiled node)))))
|
||||||
(else
|
(else
|
||||||
;; Unsupported 'guix pull' version.
|
;; Unsupported 'guix pull' version.
|
||||||
#f)))
|
#f)))
|
||||||
|
|
Loading…
Reference in a new issue