summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-04-07 23:48:54 +0200
committerLudovic Courtès <ludo@gnu.org>2020-04-08 00:05:45 +0200
commit041c3c22dc14d485ca58b3ae1436b62d4a39d0aa (patch)
tree13c975219cd059d99cc9e2002941752b22082f0b
parent93add9bf7d73b6a6ed2d0cf85778b26aa38fd194 (diff)
downloadguix-041c3c22dc14d485ca58b3ae1436b62d4a39d0aa.tar.gz
compile: Run the load phase within 'with-target'.
* guix/build/compile.scm (compile-files)[build]: Remove 'with-target'.
Wrap body in 'with-target'.
-rw-r--r--guix/build/compile.scm51
1 files changed, 25 insertions, 26 deletions
diff --git a/guix/build/compile.scm b/guix/build/compile.scm
index 4b6472784c..3ce0ecede5 100644
--- a/guix/build/compile.scm
+++ b/guix/build/compile.scm
@@ -184,36 +184,35 @@ files are for HOST, a GNU triplet such as \"x86_64-linux-gnu\"."
     ;; Exit as soon as something goes wrong.
     (exit-on-exception
      file
-     (with-target host
-       (lambda ()
-         (let ((relative (relative-file source-directory file)))
-           (compile-file file
-                         #:output-file (string-append build-directory "/"
-                                                      (scm->go relative))
-                         #:opts (append warning-options
-                                        (optimization-options relative))))))))
+     (let ((relative (relative-file source-directory file)))
+       (compile-file file
+                     #:output-file (string-append build-directory "/"
+                                                  (scm->go relative))
+                     #:opts (append warning-options
+                                    (optimization-options relative))))))
 
   (with-augmented-search-path %load-path source-directory
     (with-augmented-search-path %load-compiled-path build-directory
       (with-fluids ((*current-warning-prefix* ""))
-
-        ;; FIXME: To work around <https://bugs.gnu.org/15602>, we first load all
-        ;; of FILES.
-        (load-files source-directory files
-                    #:report-load report-load
-                    #:debug-port debug-port)
-
-        ;; Make sure compilation related modules are loaded before starting to
-        ;; compile files in parallel.
-        (compile #f)
-
-        ;; XXX: Don't use too many workers to work around the insane memory
-        ;; requirements of the compiler in Guile 2.2.2:
-        ;; <https://lists.gnu.org/archive/html/guile-devel/2017-05/msg00033.html>.
-        (n-par-for-each (min workers 8) build files)
-
-        (unless (zero? total)
-          (report-compilation #f total total))))))
+        (with-target host
+          (lambda ()
+            ;; FIXME: To work around <https://bugs.gnu.org/15602>, we first
+            ;; load all of FILES.
+            (load-files source-directory files
+                        #:report-load report-load
+                        #:debug-port debug-port)
+
+            ;; Make sure compilation related modules are loaded before
+            ;; starting to compile files in parallel.
+            (compile #f)
+
+            ;; XXX: Don't use too many workers to work around the insane
+            ;; memory requirements of the compiler in Guile 2.2.2:
+            ;; <https://lists.gnu.org/archive/html/guile-devel/2017-05/msg00033.html>.
+            (n-par-for-each (min workers 8) build files)
+
+            (unless (zero? total)
+              (report-compilation #f total total))))))))
 
 (eval-when (eval load)
   (when (and (string=? "2" (major-version))