unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#44676: [PATCH] Support native compilation of packages on install
@ 2020-11-16  2:38 Stefan Kangas
  2020-11-16 15:12 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 17+ messages in thread
From: Stefan Kangas @ 2020-11-16  2:38 UTC (permalink / raw)
  To: 44676; +Cc: akrl

[-- Attachment #1: Type: text/plain, Size: 236 bytes --]

Severity: wishlist

Please find attach a patch to add support to package.el for native
compilation of packages on installation.

I've done some minimal testing and it seems to do the job.

(This is intended for the native-comp branch.)

[-- Attachment #2: 0001-Support-native-compilation-of-packages-on-install.patch --]
[-- Type: text/x-diff, Size: 1543 bytes --]

From 9a0da21a6989b20f593ec2b27a48eb4ef90561b7 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefan@marxist.se>
Date: Mon, 16 Nov 2020 03:28:39 +0100
Subject: [PATCH] Support native compilation of packages on install

* lisp/emacs-lisp/package.el (package-unpack)
(package--native-compile): Native compile packages on install, if the
feature is available.
---
 lisp/emacs-lisp/package.el | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index a381ca01f3..54b42db181 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -968,6 +968,7 @@ package-unpack
         ;; E.g. for multi-package installs, we should first install all packages
         ;; and then compile them.
         (package--compile new-desc)
+        (package--native-compile new-desc)
         ;; After compilation, load again any files loaded by
         ;; `activate-1', so that we use the byte-compiled definitions.
         (package--load-files-for-activation new-desc :reload)))
@@ -1052,6 +1053,12 @@ package--compile
         (load-path load-path))
     (byte-recompile-directory (package-desc-dir pkg-desc) 0 t)))
 
+(defun package--native-compile (pkg-desc)
+  (when (and (featurep 'nativecomp)
+             (native-comp-available-p))
+    (let ((warning-minimum-level :error))
+      (native-compile-async (package-desc-dir pkg-desc) t 'late))))
+
 ;;;; Inferring package from current buffer
 (defun package-read-from-string (str)
   "Read a Lisp expression from STR.
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2020-11-21 11:38 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-16  2:38 bug#44676: [PATCH] Support native compilation of packages on install Stefan Kangas
2020-11-16 15:12 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-11-18 14:41   ` Stefan Kangas
2020-11-18 16:05     ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-11-19 22:34       ` Stefan Kangas
2020-11-20  8:45         ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-11-20 20:03           ` Stefan Kangas
2020-11-20 20:12             ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-11-20 21:10               ` Stefan Kangas
2020-11-20 22:56                 ` bug#44676: [PATCH 4/4] " Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-11-21  3:26                   ` Stefan Kangas
2020-11-21 11:38                     ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-11-20  8:55         ` bug#44676: [PATCH 1/4] " Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-11-20  9:03         ` bug#44676: [PATCH 2/4] " Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-11-20 20:07           ` Stefan Kangas
2020-11-20 20:16             ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-11-20  9:06         ` bug#44676: [PATCH 3/4] " Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).