[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
06/06: compile: Adjust for Guile 2.9.5.
From: |
guix-commits |
Subject: |
06/06: compile: Adjust for Guile 2.9.5. |
Date: |
Sat, 23 Nov 2019 16:48:29 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit fed36328129def5f10b1d1f3e4ea8886916fd22a
Author: Ludovic Courtès <address@hidden>
Date: Sat Nov 23 22:43:40 2019 +0100
compile: Adjust for Guile 2.9.5.
* guix/build/compile.scm (optimizations-for-level): New procedure.
Include '%lightweight-optimizations' and '%default-optimizations'.
(optimization-options): Use 'optimizations-for-level'.
---
guix/build/compile.scm | 49 ++++++++++++++++++++++++++++---------------------
1 file changed, 28 insertions(+), 21 deletions(-)
diff --git a/guix/build/compile.scm b/guix/build/compile.scm
index 06ed57c..3781e14 100644
--- a/guix/build/compile.scm
+++ b/guix/build/compile.scm
@@ -39,25 +39,32 @@
;;;
;;; Code:
-(define %default-optimizations
- ;; Default optimization options (equivalent to -O2 on Guile 2.2).
- (append (if (defined? 'tree-il-default-optimization-options)
- (tree-il-default-optimization-options) ;Guile 2.2
- (tree-il-optimizations)) ;Guile 3
- (if (defined? 'cps-default-optimization-options)
- (cps-default-optimization-options) ;Guile 2.2
- (cps-optimizations)))) ;Guile 3
-
-(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 optimizations-for-level
+ (or (and=> (false-if-exception
+ (resolve-interface '(system base optimize)))
+ (lambda (iface)
+ (module-ref iface 'optimizations-for-level))) ;Guile 3.0
+ (let () ;Guile 2.2
+ (define %default-optimizations
+ ;; Default optimization options (equivalent to -O2 on Guile 2.2).
+ (append (tree-il-default-optimization-options)
+ (cps-default-optimization-options)))
+
+ (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))))))
+
+ (lambda (level)
+ (if (<= level 1)
+ %lightweight-optimizations
+ %default-optimizations)))))
(define (supported-warning-type? type)
"Return true if TYPE, a symbol, denotes a supported warning type."
@@ -80,8 +87,8 @@
(define (optimization-options file)
"Return the default set of optimizations options for FILE."
(if (string-contains file "gnu/packages/")
- %lightweight-optimizations ;build faster
- '()))
+ (optimizations-for-level 1) ;build faster
+ (optimizations-for-level 3)))
(define (scm->go file)
"Strip the \".scm\" suffix from FILE, and append \".go\"."
- branch master updated (a3e5361 -> fed3632), guix-commits, 2019/11/23
- 01/06: gnu: guile2.0-git: Fix compilation of libgit2., guix-commits, 2019/11/23
- 05/06: tests: Use (ice-9 threads)., guix-commits, 2019/11/23
- 03/06: gnu: gnutls: Add "guile3.0-gnutls" variant., guix-commits, 2019/11/23
- 04/06: gnu: guile-sqlite3: Add "guile3.0-sqlite3" variant., guix-commits, 2019/11/23
- 02/06: gnu: guile-git: Add "guile3.0-git" variant., guix-commits, 2019/11/23
- 06/06: compile: Adjust for Guile 2.9.5.,
guix-commits <=