From 4a50f541447eddefcca3ebc6bedb110ac0041f90 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 21 Sep 2020 21:07:04 +0200 Subject: [PATCH] * Fix MacOS Emacs.app installation (bug#43532) * src/comp.c (Fcomp_el_to_eln_filename): Adapt the filename hashing algorithm to allow for producing a MacOS self-contained Emacs.app. --- src/comp.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/comp.c b/src/comp.c index 15d85d30fcb..63a58be264c 100644 --- a/src/comp.c +++ b/src/comp.c @@ -4054,18 +4054,30 @@ If BASE-DIR is nil use the first entry in `comp-eln-load-path'. */) if (NILP (loadsearch_re_list)) { - Lisp_Object loadsearch_list = - Fcons (build_string (PATH_DUMPLOADSEARCH), - Fcons (build_string (PATH_LOADSEARCH), Qnil)); - FOR_EACH_TAIL (loadsearch_list) - loadsearch_re_list = - Fcons (Fregexp_quote (XCAR (loadsearch_list)), loadsearch_re_list); + Lisp_Object sys_re; +#ifdef __APPLE__ + /* On MacOS we relax the match on PATH_LOADSEARCH making + everything before ".app/" a wildcard. This to obtain a + self-contained Emacs.app (bug#43532). */ + char *c; + if ((c = strstr (PATH_LOADSEARCH, ".app/"))) + sys_re = + concat2 (build_string ("\\`[[:ascii:]]+"), + Fregexp_quote (build_string (c))); + else + sys_re = Fregexp_quote (build_string (PATH_LOADSEARCH)); +#else + sys_re = Fregexp_quote (build_string (PATH_LOADSEARCH)); +#endif + loadsearch_re_list = + list2 (sys_re, Fregexp_quote (build_string (PATH_DUMPLOADSEARCH))); } - Lisp_Object loadsearch_res = loadsearch_re_list; - FOR_EACH_TAIL (loadsearch_res) + + Lisp_Object lds_re_tail = loadsearch_re_list; + FOR_EACH_TAIL (lds_re_tail) { Lisp_Object match_idx = - Fstring_match (XCAR (loadsearch_res), filename, Qnil); + Fstring_match (XCAR (lds_re_tail), filename, Qnil); if (EQ (match_idx, make_fixnum (0))) { filename = -- 2.39.5