mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-11 13:49:23 -05:00
build-expression->derivation: Move module forms at the top-level.
* guix/derivations.scm (build-expression->derivation)[module-form?]: New procedure. [prologue]: Add any form of EXP that matches MODULE-FORM?. [builder]: Remove any MODULE-FORM? from EXP.
This commit is contained in:
parent
5dcfdcaa79
commit
0d56a551bf
1 changed files with 20 additions and 3 deletions
|
@ -453,7 +453,19 @@ (define guile
|
||||||
(string-append (derivation-path->output-path (%guile-for-build))
|
(string-append (derivation-path->output-path (%guile-for-build))
|
||||||
"/bin/guile"))
|
"/bin/guile"))
|
||||||
|
|
||||||
|
(define module-form?
|
||||||
|
(match-lambda
|
||||||
|
(((or 'define-module 'use-modules) _ ...) #t)
|
||||||
|
(_ #f)))
|
||||||
|
|
||||||
(let* ((prologue `(begin
|
(let* ((prologue `(begin
|
||||||
|
,@(match exp
|
||||||
|
((_ ...)
|
||||||
|
;; Module forms must appear at the top-level so
|
||||||
|
;; that any macros they export can be expanded.
|
||||||
|
(filter module-form? exp))
|
||||||
|
(_ `(,exp)))
|
||||||
|
|
||||||
(define %output (getenv "out"))
|
(define %output (getenv "out"))
|
||||||
(define %outputs
|
(define %outputs
|
||||||
(map (lambda (o)
|
(map (lambda (o)
|
||||||
|
@ -473,9 +485,14 @@ (define %build-inputs
|
||||||
inputs))))
|
inputs))))
|
||||||
(builder (add-text-to-store store
|
(builder (add-text-to-store store
|
||||||
(string-append name "-guile-builder")
|
(string-append name "-guile-builder")
|
||||||
(string-append (object->string prologue)
|
(string-append
|
||||||
|
(object->string prologue)
|
||||||
(object->string
|
(object->string
|
||||||
`(exit ,exp)))
|
`(exit
|
||||||
|
,(match exp
|
||||||
|
((_ ...)
|
||||||
|
(remove module-form? exp))
|
||||||
|
(_ `(,exp))))))
|
||||||
(map second inputs)))
|
(map second inputs)))
|
||||||
(mod-drv (if (null? modules)
|
(mod-drv (if (null? modules)
|
||||||
#f
|
#f
|
||||||
|
|
Loading…
Reference in a new issue