emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>,
	Org Mode List <emacs-orgmode@gnu.org>
Subject: Re: Reproducible work with natively compiled Emacs
Date: Thu, 14 Mar 2024 08:50:09 +0100	[thread overview]
Message-ID: <CAO48Bk9GfXGoEawZq4OWurrjh3tZ5XGXpwe6078pa_Z2a=2whA@mail.gmail.com> (raw)
In-Reply-To: <CAO48Bk8v7f3ajv1P3QMvZOuLCBn8f1qp5VQKeUByX0hbKqeEmQ@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1797 bytes --]

Hi Ihor,

attached is the patch in what I would call the final version. The main
enhancement is that
make native and make cleaneln with exit gracefully on systems where native
compilation is not enabled.

Best, /PA

On Thu, 14 Mar 2024 at 07:49, Pedro Andres Aranda Gutierrez <
paaguti@gmail.com> wrote:

> HI,
>
> On Wed, 13 Mar 2024 at 18:13, Ihor Radchenko <yantar92@posteo.net> wrote:
>
>> Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes:
>>
>> > Thanks for the feedback! I'm attaching a unified patch.
>>
>> Thanks!
>> Some more comments.
>>
>> > +# This is where Emacs stores the .eln files
>> > +ELNDIR        = $(shell $(EMACS) --batch --eval '(princ (car
>> native-comp-eln-load-path))')
>>
>> Maybe := is better here. Otherwise, we risk invoking emacs multiple times.
>>
> You are right
>
>> > +cleaneln::
>>
>> Why ::?
>>
> You are absolutely right, it's an isolated rule and it doesn't need ::
>
>> --
>> Ihor Radchenko // yantar92,
>> Org mode contributor,
>> Learn more about Org mode at <https://orgmode.org/>.
>> Support Org development at <https://liberapay.com/org-mode>,
>> or support my work at <https://liberapay.com/yantar92>
>>
>
> Patch will follow. I'm testing it against an Emacs WITHOUT native-comp to
> check it there too.
>
> Best, /PA
> --
> Fragen sind nicht da, um beantwortet zu werden,
> Fragen sind da um gestellt zu werden
> Georg Kreisler
>
> Headaches with a Juju log:
> unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
> a leader-deposed hook here, but we can't yet
>
>

-- 
Fragen sind nicht da, um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet

[-- Attachment #1.2: Type: text/html, Size: 3589 bytes --]

[-- Attachment #2: 0001-Make-cleaneln-work-execute-cleanly-when-native-comp-.patch --]
[-- Type: text/x-patch, Size: 4437 bytes --]

From 797a63581bac53f8eb9cba268a975807ec6b841e Mon Sep 17 00:00:00 2001
From: "Pedro A. Aranda" <paaguti@gmail.com>
Date: Thu, 14 Mar 2024 08:17:11 +0100
Subject: [PATCH] Make cleaneln work, execute cleanly when native comp not
 available.

---
lisp/Makefile: clean .eln files from the directory where the user's natively
compiled files are stored. Detect when native compilation is not available
and exit gracefully in that case

* Makefile: Add help for =make native=
* lisp/Makefile: Implement =make cleaneln=
* mk/targets.mk: Add =cleaneln= target


Makefile      |  1 +
 etc/ORG-NEWS  |  7 +++++++
 lisp/Makefile | 20 +++++++++++++++++++-
 mk/targets.mk |  5 ++++-
 4 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index f476a3ea7..b3a167ecb 100644
--- a/Makefile
+++ b/Makefile
@@ -27,6 +27,7 @@ help helpall::
 	$(info make all            - ditto)
 	$(info make compile        - build Org ELisp files)
 	$(info make single         - build Org ELisp files, single Emacs per source)
+	$(info make native         - build Org natively compiled Elisp files)
 	$(info make autoloads      - create org-loaddefs.el to load Org in-place)
 	$(info make test           - build Org ELisp files and run test suite)
 	$(info make vanilla        - run Emacs with this Org-mode and no personal config)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index ca73f06e7..cb8ed9b71 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -1281,6 +1281,13 @@ optional argument =NEW-HEADING-CONTAINER= specifies where in the
 buffer it will be added.  If not specified, new headings are created
 at level 1 at the end of the accessible part of the buffer, as before.

+*** ~make cleaneln~ will remove the .eln files from the user emacs configuration
+
+Natively compiled Emacs lisp files generated with ~make native~ are
+now correctly located and deleted with ~make cleaneln~.
+
+*** Add text for =make native= to ~make help~
+
 ** Miscellaneous
 *** =org-crypt.el= now applies initial visibility settings to decrypted entries

diff --git a/lisp/Makefile b/lisp/Makefile
index c570d9cfa..ff49dccff 100644
--- a/lisp/Makefile
+++ b/lisp/Makefile
@@ -11,12 +11,15 @@ LISPF 	:= $(filter-out $(LISPA),$(sort $(wildcard *.el)))
 LISPC 	:= $(filter-out $(LISPB) $(LISPN:%el=%elc),$(LISPF:%el=%elc))
 LISPN 	:= $(filter-out $(LISPB) $(LISPN:%el=%eln),$(LISPF:%el=%eln))
 _ORGCM_ := dirall single native source slint1 slint2
+# This is where Emacs stores the .eln files
+ELNDIR  := $(shell $(EMACS) --batch --eval '(when (native-comp-available-p) (princ (car native-comp-eln-load-path)))')
+
 -include local.mk

 .PHONY:	all compile compile-dirty \
 	$(_ORGCM_) $(_ORGCM_:%=compile-%) \
 	autoloads \
-	install clean cleanauto cleanall cleanelc clean-install
+	install clean cleanauto cleanall cleanelc cleaneln clean-install

 # do not clean here, done in toplevel make
 all compile compile-dirty::	 | autoloads
@@ -52,9 +55,15 @@ slint1:
 	@$(info Compiling single $(abspath $<)...)
 	-@$(ELC) $<

+ifeq (,$(ELNDIR))
+%.eln: %.el
+	@$(info Native compilation not enabled!)
+	@false
+else
 %.eln: %.el
 	@$(info Native compiling single $(abspath $<)...)
 	-@$(ELN) $<
+endif

 autoloads:	cleanauto $(LISPI) $(LISPV)

@@ -79,6 +88,15 @@ cleanauto clean cleanall::
 clean cleanall cleanelc::
 	$(RM) *.elc

+ifeq (,$(ELNDIR))
+cleaneln:
+	@$(info Native compilation not enabled. Nothing to do.)
+else
+cleaneln:
+	@$(foreach elnf,$(patsubst %.eln, %-*.eln, $(LISPN)), \
+	  $(FIND) $(ELNDIR) -name $(elnf) -exec $(RM) -v {} \; ;)
+endif
+
 clean-install:
 	if [ -d $(DESTDIR)$(lispdir) ] ; then \
 	  $(RM) $(DESTDIR)$(lispdir)/org*.el* $(DESTDIR)$(lispdir)/ob*.el* $(DESTDIR)$(lispdir)/ol*.el* $(DESTDIR)$(lispdir)/ox*.el* ; \
diff --git a/mk/targets.mk b/mk/targets.mk
index de849c4fb..4ab5fa13c 100644
--- a/mk/targets.mk
+++ b/mk/targets.mk
@@ -31,7 +31,7 @@ endif
 	info html pdf card refcard doc docs \
 	autoloads cleanall clean $(CLEANDIRS:%=clean%) \
 	clean-install cleanelc cleandirs \
-	cleanlisp cleandoc cleandocs cleantest \
+	cleanlisp cleandoc cleandocs cleantest cleaneln \
 	compile compile-dirty uncompiled \
 	config config-test config-exe config-all config-eol config-version \
 	vanilla repro
@@ -143,6 +143,9 @@ cleanall: cleandirs cleantest
 $(CLEANDIRS:%=clean%):
 	-$(FIND) $(@:clean%=%) \( -name \*~ -o -name \*.elc \) -exec $(RM) {} +

+cleaneln:
+	$(MAKE) -C lisp $@
+
 cleanelc:
 	$(MAKE) -C lisp $@

--
2.34.1

  parent reply	other threads:[~2024-03-14  7:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-10 11:49 Reproducible work with natively compiled Emacs Pedro A. Aranda
2024-03-11  9:11 ` Pedro Andres Aranda Gutierrez
2024-03-13 12:50   ` Ihor Radchenko
2024-03-13 16:52     ` Pedro Andres Aranda Gutierrez
2024-03-13 17:17       ` Ihor Radchenko
     [not found]         ` <CAO48Bk8v7f3ajv1P3QMvZOuLCBn8f1qp5VQKeUByX0hbKqeEmQ@mail.gmail.com>
2024-03-14  7:50           ` Pedro Andres Aranda Gutierrez [this message]
2024-03-15 14:08             ` Ihor Radchenko
2024-03-15 11:17               ` Pedro Andres Aranda Gutierrez
     [not found]                 ` <CAO48Bk9TgysKrAGmhiyR5NZ_4LYj9GMZf-LUo=fjREJYsuXFFg@mail.gmail.com>
2024-03-15 17:08                   ` Ihor Radchenko
2024-03-16  6:16                     ` Pedro Andres Aranda Gutierrez
2024-03-16 10:20                       ` Ihor Radchenko
2024-03-17  6:13                         ` Pedro Andres Aranda Gutierrez
2024-03-17  8:19                           ` Max Nikulin
2024-03-17 10:16                           ` Ihor Radchenko
2024-03-17 10:30                             ` Pedro Andres Aranda Gutierrez
2024-03-17 14:26                               ` Ihor Radchenko

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAO48Bk9GfXGoEawZq4OWurrjh3tZ5XGXpwe6078pa_Z2a=2whA@mail.gmail.com' \
    --to=paaguti@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).