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'.master
parent
fde60bfb84
commit
fed3632812
|
@ -39,25 +39,32 @@
|
||||||
;;;
|
;;;
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
(define %default-optimizations
|
(define optimizations-for-level
|
||||||
;; Default optimization options (equivalent to -O2 on Guile 2.2).
|
(or (and=> (false-if-exception
|
||||||
(append (if (defined? 'tree-il-default-optimization-options)
|
(resolve-interface '(system base optimize)))
|
||||||
(tree-il-default-optimization-options) ;Guile 2.2
|
(lambda (iface)
|
||||||
(tree-il-optimizations)) ;Guile 3
|
(module-ref iface 'optimizations-for-level))) ;Guile 3.0
|
||||||
(if (defined? 'cps-default-optimization-options)
|
(let () ;Guile 2.2
|
||||||
(cps-default-optimization-options) ;Guile 2.2
|
(define %default-optimizations
|
||||||
(cps-optimizations)))) ;Guile 3
|
;; Default optimization options (equivalent to -O2 on Guile 2.2).
|
||||||
|
(append (tree-il-default-optimization-options)
|
||||||
|
(cps-default-optimization-options)))
|
||||||
|
|
||||||
(define %lightweight-optimizations
|
(define %lightweight-optimizations
|
||||||
;; Lightweight optimizations (like -O0, but with partial evaluation).
|
;; Lightweight optimizations (like -O0, but with partial evaluation).
|
||||||
(let loop ((opts %default-optimizations)
|
(let loop ((opts %default-optimizations)
|
||||||
(result '()))
|
(result '()))
|
||||||
(match opts
|
(match opts
|
||||||
(() (reverse result))
|
(() (reverse result))
|
||||||
((#:partial-eval? _ rest ...)
|
((#:partial-eval? _ rest ...)
|
||||||
(loop rest `(#t #:partial-eval? ,@result)))
|
(loop rest `(#t #:partial-eval? ,@result)))
|
||||||
((kw _ rest ...)
|
((kw _ rest ...)
|
||||||
(loop rest `(#f ,kw ,@result))))))
|
(loop rest `(#f ,kw ,@result))))))
|
||||||
|
|
||||||
|
(lambda (level)
|
||||||
|
(if (<= level 1)
|
||||||
|
%lightweight-optimizations
|
||||||
|
%default-optimizations)))))
|
||||||
|
|
||||||
(define (supported-warning-type? type)
|
(define (supported-warning-type? type)
|
||||||
"Return true if TYPE, a symbol, denotes a supported warning type."
|
"Return true if TYPE, a symbol, denotes a supported warning type."
|
||||||
|
@ -80,8 +87,8 @@
|
||||||
(define (optimization-options file)
|
(define (optimization-options file)
|
||||||
"Return the default set of optimizations options for FILE."
|
"Return the default set of optimizations options for FILE."
|
||||||
(if (string-contains file "gnu/packages/")
|
(if (string-contains file "gnu/packages/")
|
||||||
%lightweight-optimizations ;build faster
|
(optimizations-for-level 1) ;build faster
|
||||||
'()))
|
(optimizations-for-level 3)))
|
||||||
|
|
||||||
(define (scm->go file)
|
(define (scm->go file)
|
||||||
"Strip the \".scm\" suffix from FILE, and append \".go\"."
|
"Strip the \".scm\" suffix from FILE, and append \".go\"."
|
||||||
|
|
Reference in New Issue