From 9a0da21a6989b20f593ec2b27a48eb4ef90561b7 Mon Sep 17 00:00:00 2001 From: Stefan Kangas 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