aboutsummaryrefslogtreecommitdiffstats
path: root/src/comp.c
diff options
context:
space:
mode:
authorAndrea Corallo2021-04-04 17:10:08 +0200
committerAndrea Corallo2021-04-04 22:41:17 +0200
commit6f8ec1449197f1fcd730df91dddf6f7750284593 (patch)
treee297436a8b3d8eb2f2dba954180a5f8eec97fc5e /src/comp.c
parent978afd788fd0496540f715b83f18ed390ca8d5a4 (diff)
downloademacs-6f8ec1449197f1fcd730df91dddf6f7750284593.tar.gz
emacs-6f8ec1449197f1fcd730df91dddf6f7750284593.zip
Output native compiled preloaded files into the 'preloaded' subfolder
* src/comp.c (fixup_eln_load_path): Account the fact that the file can be dumped in the 'preloaded' subfolder. * lisp/loadup.el: Likewise. * src/lread.c (maybe_swap_for_eln1): New function. (maybe_swap_for_eln): Handle 'preloaded' subfolder. * src/Makefile.in (LISP_PRELOADED): Export preloaded files.
Diffstat (limited to 'src/comp.c')
-rw-r--r--src/comp.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/comp.c b/src/comp.c
index 67c8e39315b..9bad9b9667f 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -4091,6 +4091,7 @@ for new compilations.
4091If BASE-DIR is nil use the first entry in `comp-eln-load-path'. */) 4091If BASE-DIR is nil use the first entry in `comp-eln-load-path'. */)
4092 (Lisp_Object filename, Lisp_Object base_dir) 4092 (Lisp_Object filename, Lisp_Object base_dir)
4093{ 4093{
4094 Lisp_Object source_filename = filename;
4094 filename = Fcomp_el_to_eln_rel_filename (filename); 4095 filename = Fcomp_el_to_eln_rel_filename (filename);
4095 4096
4096 /* If base_dir was not specified search inside Vcomp_eln_load_path 4097 /* If base_dir was not specified search inside Vcomp_eln_load_path
@@ -4129,9 +4130,18 @@ If BASE-DIR is nil use the first entry in `comp-eln-load-path'. */)
4129 if (!file_name_absolute_p (SSDATA (base_dir))) 4130 if (!file_name_absolute_p (SSDATA (base_dir)))
4130 base_dir = Fexpand_file_name (base_dir, Vinvocation_directory); 4131 base_dir = Fexpand_file_name (base_dir, Vinvocation_directory);
4131 4132
4132 return Fexpand_file_name (filename, 4133 /* In case the file being compiled is found in 'LISP_PRELOADED'
4133 Fexpand_file_name (Vcomp_native_version_dir, 4134 target for output the 'preloaded' subfolder. */
4134 base_dir)); 4135 Lisp_Object lisp_preloaded =
4136 Fgetenv_internal (build_string ("LISP_PRELOADED"), Qnil);
4137 base_dir = Fexpand_file_name (Vcomp_native_version_dir, base_dir);
4138 if (!NILP (lisp_preloaded)
4139 && !NILP (Fmember (CALL1I (file-name-base, source_filename),
4140 Fmapcar (intern_c_string ("file-name-base"),
4141 CALL1I (split-string, lisp_preloaded)))))
4142 base_dir = Fexpand_file_name (build_string ("preloaded"), base_dir);
4143
4144 return Fexpand_file_name (filename, base_dir);
4135} 4145}
4136 4146
4137DEFUN ("comp--install-trampoline", Fcomp__install_trampoline, 4147DEFUN ("comp--install-trampoline", Fcomp__install_trampoline,
@@ -4750,10 +4760,15 @@ fixup_eln_load_path (Lisp_Object directory)
4750 Lisp_Object eln_cache_sys = 4760 Lisp_Object eln_cache_sys =
4751 Ffile_name_directory (concat2 (Vinvocation_directory, 4761 Ffile_name_directory (concat2 (Vinvocation_directory,
4752 directory)); 4762 directory));
4753 /* One directory up... */ 4763 bool preloaded =
4754 eln_cache_sys = 4764 !NILP (Fequal (Fsubstring (eln_cache_sys, make_fixnum (-10),
4755 Ffile_name_directory (Fsubstring (eln_cache_sys, Qnil, 4765 make_fixnum (-1)),
4756 make_fixnum (-1))); 4766 build_string ("preloaded")));
4767 /* One or two directories up... */
4768 for (int i = 0; i < (preloaded ? 2 : 1); i++)
4769 eln_cache_sys =
4770 Ffile_name_directory (Fsubstring (eln_cache_sys, Qnil,
4771 make_fixnum (-1)));
4757 Fsetcar (last_cell, eln_cache_sys); 4772 Fsetcar (last_cell, eln_cache_sys);
4758} 4773}
4759 4774