NS: Fix startup with HAVE_NATIVE_COMP && !NS_SELF_CONTAINED

* src/pdumper.c (pdumper_set_emacs_execdir): Add workaround for
!NS_SELF_CONTAINED so that launching Emacs from the app bundle
works flawlessly when built with native compilation.
* configure.ac: Define BINDIR.  (Bug#80094)
This commit is contained in:
Yavor Doganov 2026-01-12 12:51:11 +02:00 committed by Eli Zaretskii
parent c68c5fbe14
commit bc5fb19d16
2 changed files with 22 additions and 5 deletions

View file

@ -7200,6 +7200,9 @@ AC_SUBST([ns_appsrc])
AC_SUBST([GNU_OBJC_CFLAGS])
AC_SUBST([OTHER_FILES])
AS_IF([test $prefix = "NONE"], [_prefix=/usr/local], [_prefix=$prefix])
AC_DEFINE_UNQUOTED([BINDIR], ["${_prefix}/bin/"], [Executables directory.])
if test -n "${term_header}"; then
AC_DEFINE_UNQUOTED([TERM_HEADER], ["${term_header}"],
[Define to the header for the built-in window system.])

View file

@ -5648,11 +5648,25 @@ pdumper_set_emacs_execdir (char *emacs_executable)
&& !IS_DIRECTORY_SEP (p[-1]))
--p;
eassert (p > emacs_executable);
emacs_execdir = xpalloc (emacs_execdir, &execdir_size,
p - emacs_executable + 1 - execdir_size, -1, 1);
memcpy (emacs_execdir, emacs_executable, p - emacs_executable);
execdir_len = p - emacs_executable;
emacs_execdir[execdir_len] = '\0';
#if HAVE_NS && !NS_SELF_CONTAINED
if (strcmp (basename (emacs_executable), "Emacs") == 0)
{
/* This is the Emacs executable from the non-self-contained app
bundle which can be anywhere on the system. Fortunately, the
location of the Lisp resources is known. */
emacs_execdir = (char *) BINDIR;
execdir_len = strlen (BINDIR);
}
else
#endif
{
emacs_execdir = xpalloc (emacs_execdir, &execdir_size,
p - emacs_executable + 1 - execdir_size, -1, 1);
memcpy (emacs_execdir, emacs_executable, p - emacs_executable);
execdir_len = p - emacs_executable;
emacs_execdir[execdir_len] = '\0';
}
}
#endif