Subject: Re: bug#58509: 29.0.50; Synchronous nativecomp

From: Eli Zaretskii <[email-masked]>
Date: Fri, 14 Oct 2022 13:53:03 +0300

> Cc: Andrea Corallo <[email-masked]>
> From: Lars Ingebrigtsen <[email-masked]>
> Date: Fri, 14 Oct 2022 12:38:30 +0200
> 
> 
> I thought I'd open a bug report for something I mentioned elsewhere: It
> should be possible for --batch Emacsen to do native compilation.

We already have that, and we use it when users build a release
tarball.  Here's the lisp/Makefile snippet which  does it:

  ifeq ($(HAVE_NATIVE_COMP),yes)
  .PHONY: $(THEFILE)n
  $(THEFILE)n:
	  $(AM_V_ELN)$(emacs) $(BYTE_COMPILE_FLAGS) \
		  -l comp -f byte-compile-refresh-preloaded \
		  --eval '(batch-native-compile t)' $(THEFILE)

We also have the batch-native-compile function, which is probably a
better match for what you want to do in your case (compile a bunch of
your own Lisp files, AFAIU).

> However, this also almost requires that we allow the nativecomp to
> happen synchronously -- the batch job may end before nativecomp finished
> otherwise, leading to cleanup problems and loss of efficiency.

The above-mentioned functions do work synchronously.

So what is actually missing?