Subject: [bug#57086] [PATCH 6/6] build-system: emacs: Use native compilation.

From: Liliana Marie Prikler <[email-masked]>
Date: Tue, 9 Aug 2022 20:32:37 +0200

* guix/build/emacs-build-system.scm (build): Use ‘emacs-compile-directory’
rather than ‘emacs-byte-compile-directory’.  Also delete already compiled
files in the working directory prior to compilation.
---
 guix/build/emacs-build-system.scm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm
index 6a6918bfdd..9ecfceccf1 100644
--- a/guix/build/emacs-build-system.scm
+++ b/guix/build/emacs-build-system.scm
@@ -110,11 +110,14 @@ (define* (expand-load-path #:key (prepend-source? #t) #:allow-other-keys)
 
 (define* (build #:key outputs inputs #:allow-other-keys)
   "Compile .el files."
+  ;; Ensure that already compiled files in the working directory don't shadow
+  ;; the build.  Might happen, because check runs first.
+  (for-each delete-file (find-files "." "\\.el[cn]$"))
   (let* ((emacs (search-input-file inputs "/bin/emacs"))
          (out (assoc-ref outputs "out")))
     (setenv "SHELL" "sh")
     (parameterize ((%emacs emacs))
-      (emacs-byte-compile-directory (elpa-directory out)))))
+      (emacs-compile-directory (elpa-directory out)))))
 
 (define* (patch-el-files #:key outputs #:allow-other-keys)
   "Substitute the absolute \"/bin/\" directory with the right location in the
-- 
2.37.0