From: Liliana Marie Prikler <liliana.prikler@gmail.com>
To: 57086@debbugs.gnu.org
Subject: [bug#57086] [PATCH 5/6] guix: emacs-utils: Add emacs-compile-directory.
Date: Tue, 9 Aug 2022 20:26:06 +0200 [thread overview]
Message-ID: <ffcdf3a53de7c5c938dc7e9f22a7ab57cb5c98ad.camel@gmail.com> (raw)
In-Reply-To: <4c232648145659a2c3edca6d32725d8120cc14d3.camel@gmail.com>
* guix/build/emacs-utils.scm (emacs-compile-directory): New variable.
---
guix/build/emacs-utils.scm | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm
index 8ee547f2b3..17155a0b8b 100644
--- a/guix/build/emacs-utils.scm
+++ b/guix/build/emacs-utils.scm
@@ -38,6 +38,7 @@ (define-module (guix build emacs-utils)
emacs-generate-autoloads
emacs-byte-compile-directory
+ emacs-compile-directory
emacs-header-parse
as-display
@@ -115,6 +116,31 @@ (define* (emacs-byte-compile-directory dir)
(byte-recompile-directory (file-name-as-directory ,dir) 0 1))))
(emacs-batch-eval expr)))
+(define* (emacs-compile-directory dir)
+ "Compile all files in DIR to native code.
+
+If native code is not supported, compile to bytecode instead."
+ (emacs-batch-eval
+ `(let ((byte-compile-debug t) ; for proper exit status
+ (byte+native-compile (native-comp-available-p))
+ (files (directory-files-recursively ,dir "\\.el$")))
+ (mapc
+ (lambda (file)
+ (let (byte-to-native-output-file)
+ (if byte+native-compile
+ (native-compile file (concat (file-name-sans-extension file)
+ ".eln"))
+ (byte-compile-file file))
+ ;; Sadly, we can't use pcase because quasiquote works different in
+ ;; Emacs. See `batch-byte+native-compile' in comp.el for the
+ ;; actual shape of byte-to-native-output-file.
+ (unless (null byte-to-native-output-file)
+ (rename-file (car byte-to-native-output-file)
+ (cdr byte-to-native-output-file)
+ t))))
+ files))
+ #:dynamic? #t))
+
(define (emacs-header-parse section file)
"Parse the header SECTION in FILE and return it as a string."
(emacs-batch-script
--
2.37.0
next prev parent reply other threads:[~2022-08-09 18:53 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-26 13:07 bug#55657: libgccjit is unusable Liliana Marie Prikler
2022-06-04 14:07 ` Remco van 't Veer
2022-06-04 14:22 ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
2022-06-04 14:25 ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
2022-06-04 15:14 ` Liliana Marie Prikler
2022-06-28 0:53 ` John Kehayias via Bug reports for GNU Guix
2022-06-28 4:17 ` Liliana Marie Prikler
2022-06-28 5:16 ` John Kehayias via Bug reports for GNU Guix
2022-08-03 21:13 ` John Kehayias via Bug reports for GNU Guix
2022-08-04 4:26 ` Liliana Marie Prikler
2022-08-04 4:48 ` Andrew Whatson
2022-08-04 16:52 ` Liliana Marie Prikler
2022-08-05 0:59 ` Andrew Whatson
2022-08-05 18:44 ` Liliana Marie Prikler
2022-08-05 20:01 ` John Kehayias via Bug reports for GNU Guix
2022-08-05 21:31 ` Liliana Marie Prikler
2022-08-06 5:37 ` John Kehayias via Bug reports for GNU Guix
2022-08-06 5:53 ` Liliana Marie Prikler
2022-08-07 3:19 ` John Kehayias via Bug reports for GNU Guix
2022-08-07 13:59 ` Liliana Marie Prikler
2022-08-07 15:09 ` John Kehayias via Bug reports for GNU Guix
2022-08-07 15:41 ` Liliana Marie Prikler
2022-08-09 20:44 ` John Kehayias via Bug reports for GNU Guix
2022-08-09 23:53 ` Andrew Whatson
2022-08-09 18:37 ` bug#55657: [PATCH 0/6] Add native compilation to Emacs Liliana Marie Prikler
2022-08-05 3:29 ` [bug#57086] [PATCH 1/6] gnu: Parameterize libgccjit Liliana Marie Prikler
2022-08-05 3:29 ` [bug#57086] [PATCH v3 1/7] " Liliana Marie Prikler
2022-08-05 18:27 ` [bug#57086] [PATCH v3 2/7] gnu: libgccjit: Build with bootstrapped gcc Liliana Marie Prikler
2022-08-05 18:27 ` [bug#57086] [PATCH 2/6] " Liliana Marie Prikler
2022-08-05 18:30 ` [bug#57086] [PATCH 3/6] gnu: libgccjit: Build multiple versions Liliana Marie Prikler
2022-08-05 18:30 ` [bug#57086] [PATCH v3 3/7] " Liliana Marie Prikler
2022-08-05 22:37 ` [bug#57086] [PATCH v3 4/7] gnu: emacs: Build with native compilation Liliana Marie Prikler
2022-08-05 22:37 ` [bug#57086] [PATCH 4/6] " Liliana Marie Prikler
2022-08-09 18:26 ` Liliana Marie Prikler [this message]
2022-08-09 18:26 ` [bug#57086] [PATCH v2 5/6] guix: emacs-utils: Add emacs-compile-directory Liliana Marie Prikler
2022-08-09 18:26 ` [bug#57086] [PATCH v3 5/7] " Liliana Marie Prikler
2022-08-09 18:32 ` [bug#57086] [PATCH 6/6] build-system: emacs: Use native compilation Liliana Marie Prikler
2022-08-09 18:32 ` [bug#57086] [PATCH v3 6/7] " Liliana Marie Prikler
2022-08-09 21:19 ` [bug#57086] [PATCH 0/6] Add native compilation to Emacs ( via Guix-patches via
2022-08-10 4:19 ` Liliana Marie Prikler
2022-08-10 6:11 ` ( via Guix-patches via
2022-08-23 20:07 ` Liliana Marie Prikler
2022-08-24 21:59 ` [bug#57086] [PATCH v3 7/7] gnu: emacs-yasnippet: Fix build Liliana Marie Prikler
2022-08-25 7:08 ` [bug#57086] [PATCH v3 0/7] Add native compilation to Emacs Liliana Marie Prikler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ffcdf3a53de7c5c938dc7e9f22a7ab57cb5c98ad.camel@gmail.com \
--to=liliana.prikler@gmail.com \
--cc=57086@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.