guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/02: gexp: 'compiled-modules' defaults to '-O1'.


From: guix-commits
Subject: 02/02: gexp: 'compiled-modules' defaults to '-O1'.
Date: Wed, 26 Aug 2020 10:03:08 -0400 (EDT)

civodul pushed a commit to branch core-updates
in repository guix.

commit 331a09654eb7e9f6212b7e8469077fa7393e8b11
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Wed Aug 26 16:01:37 2020 +0200

    gexp: 'compiled-modules' defaults to '-O1'.
    
    * guix/gexp.scm (compiled-modules): Add #:optimization-level.
    [build](optimizations-for-level): New variable.
    (process-entry): Use it.
---
 guix/gexp.scm | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/guix/gexp.scm b/guix/gexp.scm
index 42a5e7f..7132ca8 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -1507,7 +1507,8 @@ last one is created from the given <scheme-file> object."
                            (guile (%guile-for-build))
                            (module-path %load-path)
                            (extensions '())
-                           (deprecation-warnings #f))
+                           (deprecation-warnings #f)
+                           (optimization-level 1))
   "Return a derivation that builds a tree containing the `.go' files
 corresponding to MODULES.  All the MODULES are built in a context where
 they can refer to each other.  When TARGET is true, cross-compile MODULES for
@@ -1531,6 +1532,13 @@ TARGET, a GNU triplet."
                       (system base target)
                       (system base compile))
 
+         (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
+               (const '())))
+
          (define (regular? file)
            (not (member file '("." ".."))))
 
@@ -1551,7 +1559,9 @@ TARGET, a GNU triplet."
                      (compile-file entry
                                    #:output-file output
                                    #:opts
-                                   %auto-compilation-options)))
+                                   `(,@%auto-compilation-options
+                                     ,@(optimizations-for-level
+                                        (ungexp optimization-level))))))
 
                  (+ 1 processed))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]