1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-28 08:11:05 -08:00

* `batch-byte+native-compile' produce .eln younger than .elc (bug#52912)

* lisp/emacs-lisp/comp.el (batch-native-compile): Add return
value.
(batch-byte+native-compile): Touch the produced .eln after the
corresponding .elc is produced.
This commit is contained in:
Andrea Corallo 2022-01-25 12:01:55 +01:00
parent 72a4cdaadc
commit dfaf8bec4e

View file

@ -4195,9 +4195,9 @@ last directory in `native-comp-eln-load-path')."
if (or (null byte+native-compile) if (or (null byte+native-compile)
(cl-notany (lambda (re) (string-match re file)) (cl-notany (lambda (re) (string-match re file))
native-comp-bootstrap-deny-list)) native-comp-bootstrap-deny-list))
do (comp--native-compile file) collect (comp--native-compile file)
else else
do (byte-compile-file file)))) collect (byte-compile-file file))))
;;;###autoload ;;;###autoload
(defun batch-byte+native-compile () (defun batch-byte+native-compile ()
@ -4211,13 +4211,18 @@ variable 'NATIVE_DISABLED' is set, only byte compile."
(if (equal (getenv "NATIVE_DISABLED") "1") (if (equal (getenv "NATIVE_DISABLED") "1")
(batch-byte-compile) (batch-byte-compile)
(cl-assert (length= command-line-args-left 1)) (cl-assert (length= command-line-args-left 1))
(let ((byte+native-compile t) (let* ((byte+native-compile t)
(byte-to-native-output-buffer-file nil)) (byte-to-native-output-buffer-file nil)
(batch-native-compile) (eln-file (car (batch-native-compile))))
(pcase byte-to-native-output-buffer-file (pcase byte-to-native-output-buffer-file
(`(,temp-buffer . ,target-file) (`(,temp-buffer . ,target-file)
(unwind-protect (unwind-protect
(byte-write-target-file temp-buffer target-file) (progn
(byte-write-target-file temp-buffer target-file)
;; Touch the .eln in order to have it older than the
;; corresponding .elc.
(when (stringp eln-file)
(set-file-times eln-file)))
(kill-buffer temp-buffer)))) (kill-buffer temp-buffer))))
(setq command-line-args-left (cdr command-line-args-left))))) (setq command-line-args-left (cdr command-line-args-left)))))