aboutsummaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2017-03-15 17:52:26 +0100
committerMarius Bakke <mbakke@fastmail.com>2017-03-15 17:52:26 +0100
commit4b7e5c1131430f10e6211879836cf17447ef5bbc (patch)
tree54155070ec4044a78c1abf20f879fded47b5baf2 /build-aux
parentadb984d23c003d5d48ada47bf5ad8105a3b8e412 (diff)
parent608e42e7c92114497e7908980424288079acee1e (diff)
downloadgnu-guix-4b7e5c1131430f10e6211879836cf17447ef5bbc.tar
gnu-guix-4b7e5c1131430f10e6211879836cf17447ef5bbc.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'build-aux')
-rw-r--r--build-aux/compile-all.scm33
1 files changed, 31 insertions, 2 deletions
diff --git a/build-aux/compile-all.scm b/build-aux/compile-all.scm
index 6ce4040887..d077d75229 100644
--- a/build-aux/compile-all.scm
+++ b/build-aux/compile-all.scm
@@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
-;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -63,6 +63,34 @@
(format #t " LOAD ~a~%" module)
(resolve-interface module)))
+(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 (compile-file* file output-mutex)
(let ((go (scm->go file)))
(with-mutex output-mutex
@@ -74,7 +102,8 @@
(lambda ()
(compile-file file
#:output-file go
- #:opts `(#:warnings ,warnings)))))))
+ #:opts `(#:warnings ,warnings
+ ,@(optimization-options file))))))))
;; Install a SIGINT handler to give unwind handlers in 'compile-file' an
;; opportunity to run upon SIGINT and to remove temporary output files.