diff options
| author | Andrea Corallo | 2020-08-16 14:33:25 +0200 |
|---|---|---|
| committer | Andrea Corallo | 2020-08-17 18:04:23 +0200 |
| commit | da54406077c5facd7187aa17c9b4f5f4ddf0e233 (patch) | |
| tree | a80e0d6fa5f327cb6f61afaa38137d52e4e059a4 | |
| parent | 171db3110159d95803dea13c4ee7bca4a795747b (diff) | |
| download | emacs-da54406077c5facd7187aa17c9b4f5f4ddf0e233.tar.gz emacs-da54406077c5facd7187aa17c9b4f5f4ddf0e233.zip | |
Allow for native compiling .el.gz files
This is needed for installed instances compiled with NATIVE_FAST_BOOT
* src/comp.c (maybe_defer_native_compilation): Search for .el.gz
too as a source if the .el is not found.
(Fcomp_el_to_eln_filename): Remove the .gz in case to
generate the hash.
* lisp/emacs-lisp/comp.el (comp-valid-source-re): New defconst.
(comp-run-async-workers, native-compile-async): Make use of
`comp-valid-source-re'.
| -rw-r--r-- | lisp/emacs-lisp/comp.el | 9 | ||||
| -rw-r--r-- | src/comp.c | 8 |
2 files changed, 13 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index b5ab4ebdccb..85b5562f280 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el | |||
| @@ -137,6 +137,9 @@ before compilation. Usable to modify the compiler environment." | |||
| 137 | (defvar comp-dry-run nil | 137 | (defvar comp-dry-run nil |
| 138 | "When non nil run everything but the C back-end.") | 138 | "When non nil run everything but the C back-end.") |
| 139 | 139 | ||
| 140 | (defconst comp-valid-source-re (rx ".el" (? ".gz") eos) | ||
| 141 | "Regexp to match filename of valid input source files.") | ||
| 142 | |||
| 140 | (defconst comp-log-buffer-name "*Native-compile-Log*" | 143 | (defconst comp-log-buffer-name "*Native-compile-Log*" |
| 141 | "Name of the native-compiler log buffer.") | 144 | "Name of the native-compiler log buffer.") |
| 142 | 145 | ||
| @@ -2564,7 +2567,7 @@ display a message." | |||
| 2564 | (cl-loop | 2567 | (cl-loop |
| 2565 | for (source-file . load) = (pop comp-files-queue) | 2568 | for (source-file . load) = (pop comp-files-queue) |
| 2566 | while source-file | 2569 | while source-file |
| 2567 | do (cl-assert (string-match-p (rx ".el" eos) source-file) nil | 2570 | do (cl-assert (string-match-p comp-valid-source-re source-file) nil |
| 2568 | "`comp-files-queue' should be \".el\" files: %s" | 2571 | "`comp-files-queue' should be \".el\" files: %s" |
| 2569 | source-file) | 2572 | source-file) |
| 2570 | when (or comp-always-compile | 2573 | when (or comp-always-compile |
| @@ -2724,8 +2727,8 @@ LOAD can be nil t or 'late." | |||
| 2724 | (dolist (path paths) | 2727 | (dolist (path paths) |
| 2725 | (cond ((file-directory-p path) | 2728 | (cond ((file-directory-p path) |
| 2726 | (dolist (file (if recursively | 2729 | (dolist (file (if recursively |
| 2727 | (directory-files-recursively path (rx ".el" eos)) | 2730 | (directory-files-recursively path comp-valid-source-re) |
| 2728 | (directory-files path t (rx ".el" eos)))) | 2731 | (directory-files path t comp-valid-source-re))) |
| 2729 | (push file files))) | 2732 | (push file files))) |
| 2730 | ((file-exists-p path) (push path files)) | 2733 | ((file-exists-p path) (push path files)) |
| 2731 | (t (signal 'native-compiler-error | 2734 | (t (signal 'native-compiler-error |
diff --git a/src/comp.c b/src/comp.c index d42bb4f8eb5..f4111e2a291 100644 --- a/src/comp.c +++ b/src/comp.c | |||
| @@ -3867,6 +3867,8 @@ If BASE-DIR is nil use the first entry in `comp-eln-load-path'. */) | |||
| 3867 | (Lisp_Object file_name, Lisp_Object base_dir) | 3867 | (Lisp_Object file_name, Lisp_Object base_dir) |
| 3868 | { | 3868 | { |
| 3869 | CHECK_STRING (file_name); | 3869 | CHECK_STRING (file_name); |
| 3870 | if (suffix_p (file_name, ".gz")) | ||
| 3871 | file_name = Fsubstring (file_name, Qnil, make_fixnum (-3)); | ||
| 3870 | file_name = Fexpand_file_name (file_name, Qnil); | 3872 | file_name = Fexpand_file_name (file_name, Qnil); |
| 3871 | Lisp_Object hashed = Fsubstring (comp_hash_string (file_name), Qnil, | 3873 | Lisp_Object hashed = Fsubstring (comp_hash_string (file_name), Qnil, |
| 3872 | make_fixnum (ELN_FILENAME_HASH_LEN)); | 3874 | make_fixnum (ELN_FILENAME_HASH_LEN)); |
| @@ -4494,7 +4496,11 @@ maybe_defer_native_compilation (Lisp_Object function_name, | |||
| 4494 | concat2 (CALL1I (file-name-sans-extension, Vload_true_file_name), | 4496 | concat2 (CALL1I (file-name-sans-extension, Vload_true_file_name), |
| 4495 | build_pure_c_string (".el")); | 4497 | build_pure_c_string (".el")); |
| 4496 | if (NILP (Ffile_exists_p (src))) | 4498 | if (NILP (Ffile_exists_p (src))) |
| 4497 | return; | 4499 | { |
| 4500 | src = concat2 (src, build_pure_c_string (".gz")); | ||
| 4501 | if (NILP (Ffile_exists_p (src))) | ||
| 4502 | return; | ||
| 4503 | } | ||
| 4498 | 4504 | ||
| 4499 | /* This is to have deferred compilaiton able to compile comp | 4505 | /* This is to have deferred compilaiton able to compile comp |
| 4500 | dependecies breaking circularity. */ | 4506 | dependecies breaking circularity. */ |