;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
+;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(use-modules (system base target)
+ (system base message)
(ice-9 match)
(ice-9 threads)
(guix build utils))
(format #t " GUILEC ~a~%" go)
(force-output))
(mkdir-p (dirname go))
- (with-target host
- (lambda ()
- (compile-file file
- #:output-file go
- #:opts `(#:warnings ,warnings))))))
+ (with-fluids ((*current-warning-prefix* ""))
+ (with-target host
+ (lambda ()
+ (compile-file file
+ #:output-file go
+ #:opts `(#:warnings ,warnings)))))))
+
+;; Install a SIGINT handler to give unwind handlers in 'compile-file' an
+;; opportunity to run upon SIGINT and to remove temporary output files.
+(sigaction SIGINT
+ (lambda args
+ (exit 1)))
(match (command-line)
((_ . files)
(let ((files (filter file-needs-compilation? files)))
(for-each load-module-file files)
(let ((mutex (make-mutex)))
+ ;; Make sure compilation related modules are loaded before starting to
+ ;; compile files in parallel.
+ (compile #f)
(par-for-each (lambda (file)
(compile-file* file mutex))
files)))))
+
+;;; Local Variables:
+;;; eval: (put 'with-target 'scheme-indent-function 1)
+;;; End: