all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Stefan Kangas <stefan@marxist.se>
Cc: 44676@debbugs.gnu.org
Subject: bug#44676: [PATCH] Support native compilation of packages on install
Date: Mon, 16 Nov 2020 15:12:31 +0000	[thread overview]
Message-ID: <xjfd00dfi8w.fsf@sdf.org> (raw)
In-Reply-To: <CADwFkm=cdTYHFxi8AKgcGXF50=BW9vRedtfKeNraoGTVwR+k-Q@mail.gmail.com> (Stefan Kangas's message of "Sun, 15 Nov 2020 18:38:20 -0800")

Stefan Kangas <stefan@marxist.se> writes:

Hi Stefan,

thanks for the patch

> 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.)
>
> 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))))

Late load assume the current bytecode is already loaded when the native
load will happen.  This because late load is designed to be issued when
some bytecode file is loaded and no native code alternative is found.

We should probably issue the async compilation here without late load
and in case the bytecode is being loaded before native compilation was
done just patch the kind of load stored into `comp-files-queue'.  ATM if
the stored load property and new one are not matching we complain (See
comp.el:3528).

So yeah non 100% straight forward :)

That said I think we should have a customize to decided if we want
package to eager command native compilation.

I may never used some of the installed files and prefer the current
solution for that, or maybe I may just like to have the compilation
happening in a more diluted fashion and on demand (my personal taste).

Thanks

  Andrea





  reply	other threads:[~2020-11-16 15:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=xjfd00dfi8w.fsf@sdf.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=44676@debbugs.gnu.org \
    --cc=akrl@sdf.org \
    --cc=stefan@marxist.se \
    /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/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.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.