aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Corallo2023-02-14 11:21:45 +0100
committerAndrea Corallo2023-02-14 12:27:58 +0100
commitce4a066ed1ea07f651f439132017db8ceb32779c (patch)
treefd8c55afa42a7dd455e5ac9f5f6cbd9e04ca099d
parent1a64f326e0a8b86768031ac688ded9c863ff759c (diff)
downloademacs-ce4a066ed1ea07f651f439132017db8ceb32779c.tar.gz
emacs-ce4a066ed1ea07f651f439132017db8ceb32779c.zip
* Generate trampolines in a temporary directory if no other option is viablefeature/inhibit-native-comp-cleanup
* lisp/emacs-lisp/comp.el (comp--trampoline-abs-filename): Use temporary file if no other option is viable.
-rw-r--r--lisp/emacs-lisp/comp.el20
1 files changed, 12 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index ed706feb923..a6b9b3f57ea 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -3800,18 +3800,22 @@ Return the trampoline if found or nil otherwise."
3800 (list (expand-file-name comp-native-version-dir 3800 (list (expand-file-name comp-native-version-dir
3801 native-compile-target-directory)) 3801 native-compile-target-directory))
3802 (comp-eln-load-path-eff))) 3802 (comp-eln-load-path-eff)))
3803 with rel-filename = (comp-trampoline-filename subr-name)
3803 for dir in dirs 3804 for dir in dirs
3804 for f = (expand-file-name 3805 for abs-filename = (expand-file-name rel-filename dir)
3805 (comp-trampoline-filename subr-name)
3806 dir)
3807 unless (file-exists-p dir) 3806 unless (file-exists-p dir)
3808 do (ignore-errors 3807 do (ignore-errors
3809 (make-directory dir t) 3808 (make-directory dir t)
3810 (cl-return f)) 3809 (cl-return abs-filename))
3811 when (file-writable-p f) 3810 when (file-writable-p abs-filename)
3812 do (cl-return f) 3811 do (cl-return abs-filename)
3813 finally (error "Cannot find suitable directory for output in \ 3812 ;; Default to some temporary directory if no better option was
3814`native-comp-eln-load-path'"))) 3813 ;; found.
3814 finally (cl-return
3815 (expand-file-name
3816 (make-temp-file-internal (file-name-sans-extension rel-filename)
3817 0 ".eln" nil)
3818 temporary-file-directory))))
3815 3819
3816(defun comp-trampoline-compile (subr-name) 3820(defun comp-trampoline-compile (subr-name)
3817 "Synthesize compile and return a trampoline for SUBR-NAME." 3821 "Synthesize compile and return a trampoline for SUBR-NAME."