emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-28 2eb738f2b8: Support builds configured with a separate --bindir


From: Eli Zaretskii
Subject: emacs-28 2eb738f2b8: Support builds configured with a separate --bindir
Date: Mon, 20 Jun 2022 12:05:14 -0400 (EDT)

branch: emacs-28
commit 2eb738f2b8a3948b590ac7a6640f317a5cb12918
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Support builds configured with a separate --bindir
    
    * src/emacs.c (load_pdump): Don't overwrite the leading
    directories of the Emacs executable just because the pdumper file
    was not found in the expected directory relative to the binary.
    This is needed to support builds with a separate --bindir
    configure-time option and native-compilation.  (Bug#55741)
---
 src/emacs.c | 32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/src/emacs.c b/src/emacs.c
index ccc0dd269f..0a90b0913b 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -940,20 +940,24 @@ load_pdump (int argc, char **argv)
   sprintf (dump_file, "%s%c%s%s",
            path_exec, DIRECTORY_SEP, argv0_base, suffix);
 #if !defined (NS_SELF_CONTAINED)
-  /* Assume the Emacs binary lives in a sibling directory as set up by
-     the default installation configuration.  */
-  const char *go_up = "../../../../bin/";
-  needed += (strip_suffix ? strlen (strip_suffix) : 0)
-    - strlen (suffix) + strlen (go_up);
-  if (exec_bufsize < needed)
-    {
-      xfree (emacs_executable);
-      emacs_executable = xpalloc (NULL, &exec_bufsize, needed - exec_bufsize,
-                                 -1, 1);
-    }
-  sprintf (emacs_executable, "%s%c%s%s%s",
-          path_exec, DIRECTORY_SEP, go_up, argv0_base,
-          strip_suffix ? strip_suffix : "");
+  if (!(emacs_executable && *emacs_executable))
+    {
+      /* If we didn't find the Emacs binary, assume that it lives in a
+        sibling directory as set up by the default installation
+        configuration.  */
+      const char *go_up = "../../../../bin/";
+      needed += (strip_suffix ? strlen (strip_suffix) : 0)
+       - strlen (suffix) + strlen (go_up);
+      if (exec_bufsize < needed)
+       {
+         xfree (emacs_executable);
+         emacs_executable = xpalloc (NULL, &exec_bufsize,
+                                     needed - exec_bufsize, -1, 1);
+       }
+      sprintf (emacs_executable, "%s%c%s%s%s",
+              path_exec, DIRECTORY_SEP, go_up, argv0_base,
+              strip_suffix ? strip_suffix : "");
+    }
 #endif
   result = pdumper_load (dump_file, emacs_executable);
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]