Subject: [bug#31633] [PATCH 5/7] bootloader: grub: Use 'with-extensions'.

From: Ludovic Courtès <[email-masked]>
Date: Mon, 28 May 2018 23:59:28 +0200

* gnu/bootloader/grub.scm (svg->png): Use 'with-extensions'.  Remove
'add-to-load-path' calls.
* gnu/build/svg.scm: Use (rsvg) and (cairo) the normal way.  Remove
'module-autoload!' calls.
---
 gnu/bootloader/grub.scm | 19 ++++++-------------
 gnu/build/svg.scm       | 11 +++--------
 2 files changed, 9 insertions(+), 21 deletions(-)

diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index e90a6a11e..a131f3b50 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -123,19 +123,12 @@ otherwise."
   "Build a PNG of HEIGHT x WIDTH from SVG."
   (gexp->derivation "grub-image.png"
                     (with-imported-modules '((gnu build svg))
-                      #~(begin
-                          ;; We need these two libraries.
-                          (add-to-load-path (string-append #+guile-rsvg
-                                                           "/share/guile/site/"
-                                                           (effective-version)))
-                          (add-to-load-path (string-append #+guile-cairo
-                                                           "/share/guile/site/"
-                                                           (effective-version)))
-
-                          (use-modules (gnu build svg))
-                          (svg->png #+svg #$output
-                                    #:width #$width
-                                    #:height #$height)))))
+                      (with-extensions (list guile-rsvg guile-cairo)
+                        #~(begin
+                            (use-modules (gnu build svg))
+                            (svg->png #+svg #$output
+                                      #:width #$width
+                                      #:height #$height))))))
 
 (define* (grub-background-image config #:key (width 1024) (height 768))
   "Return the GRUB background image defined in CONFIG with a ratio of
diff --git a/gnu/build/svg.scm b/gnu/build/svg.scm
index b5474ec4a..6f1f4b368 100644
--- a/gnu/build/svg.scm
+++ b/gnu/build/svg.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2016, 2017 Ludovic Courtès <[email-masked]>
+;;; Copyright © 2016, 2017, 2018 Ludovic Courtès <[email-masked]>
 ;;; Copyright © 2015 Andy Wingo <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -18,16 +18,11 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu build svg)
+  #:use-module (rsvg)
+  #:use-module (cairo)
   #:use-module (srfi srfi-11)
   #:export (svg->png))
 
-;; We need Guile-RSVG and Guile-Cairo.  Load them lazily, at run time, to
-;; allow compilation to proceed.  See also <http://bugs.gnu.org/12202>.
-(module-autoload! (current-module)
-                  '(rsvg) '(rsvg-handle-new-from-file))
-(module-autoload! (current-module)
-                  '(cairo) '(cairo-image-surface-create))
-
 (define* (downscaled-surface surface
                              #:key
                              source-width source-height
-- 
2.17.0