summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2021-09-28 15:00:50 +0300
committerEli Zaretskii <eliz@gnu.org>2021-09-28 15:00:50 +0300
commit90655e4bc01ba8d00be3281d13cc771b53e75b43 (patch)
treed0f734ef8d6a148745faa261feeb519dc65bd1bd /lisp/emacs-lisp
parentb02a7ad2631b6ac3a95e53cb26a0aa1b1ab7e98a (diff)
downloademacs-90655e4bc01ba8d00be3281d13cc771b53e75b43.tar.gz
emacs-90655e4bc01ba8d00be3281d13cc771b53e75b43.tar.bz2
emacs-90655e4bc01ba8d00be3281d13cc771b53e75b43.zip
Make the build of source tarball produce *.eln files
* lisp/emacs-lisp/comp.el (batch-native-compile): Accept an optional argument; if non-nil, place the .eln file as appropriate for building a source tarball. * doc/lispref/compile.texi (Native-Compilation Functions): Document the new optional argument of 'batch-native-compile'. * lisp/Makefile.in (.PHONY, $(THEFILE)n) [HAVE_NATIVE_COMP]: New targets. * src/Makefile.in (%.eln) [HAVE_NATIVE_COMP]: New recipe. (all) [HAVE_NATIVE_COMP]: Add ../native-lisp to prerequisites. (elnlisp) [HAVE_NATIVE_COMP]: New list of *.eln files. (../native-lisp) [HAVE_NATIVE_COMP]: New recipe. * src/verbose.mk.in (AM_V_ELN): New macro.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/comp.el25
1 files changed, 16 insertions, 9 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 7c93ebd6300..83605ca5a77 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -4191,20 +4191,27 @@ form, return the compiled function."
(comp--native-compile function-or-file nil output))
;;;###autoload
-(defun batch-native-compile ()
+(defun batch-native-compile (&optional for-tarball)
"Perform batch native compilation of remaining command-line arguments.
Native compilation equivalent of `batch-byte-compile'.
Use this from the command line, with ‘-batch’; it won’t work
-in an interactive Emacs session."
+in an interactive Emacs session.
+Optional argument FOR-TARBALL non-nil means the file being compiled
+as part of building the source tarball, in which case the .eln file
+will be placed under the native-lisp/ directory (actually, in the
+last directory in `native-comp-eln-load-path')."
(comp-ensure-native-compiler)
- (cl-loop for file in command-line-args-left
- if (or (null byte+native-compile)
- (cl-notany (lambda (re) (string-match re file))
- native-comp-bootstrap-deny-list))
- do (comp--native-compile file)
- else
- do (byte-compile-file file)))
+ (let ((native-compile-target-directory
+ (if for-tarball
+ (car (last native-comp-eln-load-path)))))
+ (cl-loop for file in command-line-args-left
+ if (or (null byte+native-compile)
+ (cl-notany (lambda (re) (string-match re file))
+ native-comp-bootstrap-deny-list))
+ do (comp--native-compile file)
+ else
+ do (byte-compile-file file))))
;;;###autoload
(defun batch-byte+native-compile ()