Skip to content
Snippets Groups Projects
Unverified Commit ae196fa3 authored by Ludovic Courtès's avatar Ludovic Courtès
Browse files

build: On 2.2, build package files with almost no optimizations.

* build-aux/compile-all.scm (%default-optimizations)
(%lightweight-optimizations): New variables.
(optimization-options): New procedure.
(compile-file*): Use it.
parent a70782d3
No related branches found
No related tags found
No related merge requests found
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com> ;;; 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. ;;; This file is part of GNU Guix.
;;; ;;;
...@@ -63,6 +63,34 @@ (define (load-module-file file) ...@@ -63,6 +63,34 @@ (define (load-module-file file)
(format #t " LOAD ~a~%" module) (format #t " LOAD ~a~%" module)
(resolve-interface 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) (define (compile-file* file output-mutex)
(let ((go (scm->go file))) (let ((go (scm->go file)))
(with-mutex output-mutex (with-mutex output-mutex
...@@ -74,7 +102,8 @@ (define (compile-file* file output-mutex) ...@@ -74,7 +102,8 @@ (define (compile-file* file output-mutex)
(lambda () (lambda ()
(compile-file file (compile-file file
#:output-file go #:output-file go
#:opts `(#:warnings ,warnings))))))) #:opts `(#:warnings ,warnings
,@(optimization-options file))))))))
;; Install a SIGINT handler to give unwind handlers in 'compile-file' an ;; Install a SIGINT handler to give unwind handlers in 'compile-file' an
;; opportunity to run upon SIGINT and to remove temporary output files. ;; opportunity to run upon SIGINT and to remove temporary output files.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment