pull: Build package modules without optimizations on Guile 2.2.

* guix/build/pull.scm (%default-optimizations)
(%lightweight-optimizations): New variables.
(optimization-options): New procedure.  Taken from
build-aux/compile-all.scm.
(build-guix): Pass it to 'compile-file'.
This commit is contained in:
Ludovic Courtès 2017-05-09 17:34:54 +02:00
parent 838ba73d6e
commit 07a0f68fa5
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 30 additions and 1 deletions

View File

@ -57,6 +57,35 @@ indirectly, on Guile-SSH."
(string-prefix? gnu b)) (string-prefix? gnu b))
(string<? a b)))))) (string<? a b))))))
(cond-expand
(guile-2.2 (use-modules (language tree-il optimize)
(language cps optimize)))
(else #f))
(define %default-optimizations
;; Default optimization options (equivalent to -O2 on Guile 2.2).
(cond-expand
(guile-2.2 (append (tree-il-default-optimization-options)
(cps-default-optimization-options)))
(else '())))
(define %lightweight-optimizations
;; Lightweight optimizations (like -O0, but with partial evaluation).
(let loop ((opts %default-optimizations)
(result '()))
(match opts
(() (reverse result))
((#:partial-eval? _ rest ...)
(loop rest `(#t #:partial-eval? ,@result)))
((kw _ rest ...)
(loop rest `(#f ,kw ,@result))))))
(define (optimization-options file)
(if (string-contains file "gnu/packages/")
%lightweight-optimizations ;build faster
'()))
(define* (build-guix out source (define* (build-guix out source
#:key #:key
system system
@ -158,7 +187,7 @@ containing the source code. Write any debugging output to DEBUG-PORT."
(parameterize ((current-warning-port (%make-void-port "w"))) (parameterize ((current-warning-port (%make-void-port "w")))
(compile-file file (compile-file file
#:output-file go #:output-file go
#:opts %auto-compilation-options))) #:opts (optimization-options file))))
(with-mutex mutex (with-mutex mutex
(set! completed (+ 1 completed)))) (set! completed (+ 1 completed))))
files)))) files))))