unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: Jim Myhrberg <contact@jimeh.me>
Cc: 49271@debbugs.gnu.org
Subject: bug#49271: 28.0.50: native-comp: Signing macOS self-contained .app bundle fails due to new *.eln location
Date: Wed, 30 Jun 2021 20:05:50 +0100	[thread overview]
Message-ID: <YNzAjsQYSAqZKdlN@breton.holly.idiocy.org> (raw)
In-Reply-To: <CAGaZ61tmM7=DcjjRJgaMZ9fr=5y57LDwmtEb3EPfDH3b5uZ1BQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 561 bytes --]

On Wed, Jun 30, 2021 at 02:10:53PM +0100, Jim Myhrberg wrote:
> 
> Also, I'd obviously be more than happy to help with testing any
> further changes to eln file locations and related things :)

Please try the attached patch.

Eli, is this an acceptable way of modifying a lisp string, or is there
a better way?

I considered just removing the version since it doesn't matter much
for the app bundle, but then I realised that would also remove it in
the eln cache in .emacs.d, which isn't ideal, so I ended up replacing
the dots with underscores.
-- 
Alan Third

[-- Attachment #2: 0001-Fix-NS-self-contained-eln-location-bug-49271.patch --]
[-- Type: text/plain, Size: 2746 bytes --]

From 2d408e5db6f4d111bdf687eea939b0897dad58cd Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Wed, 30 Jun 2021 19:58:13 +0100
Subject: [PATCH] Fix NS self contained eln location (bug#49271)

* Makefile.in:
* configure.ac: Change eln file install location to
Contents/Frameworks.
* src/comp.c (hash_native_abi): Replace dots with underscores in the
eln install location as the macOS code-signing tool won't sign the
files if the parent directories have dots.
---
 Makefile.in  |  2 +-
 configure.ac |  4 ++--
 src/comp.c   | 20 +++++++++++++++++++-
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 8fccdf7580..8c14c5cc7d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -333,7 +333,7 @@ BIN_DESTDIR=
 ELN_DESTDIR = $(DESTDIR)${libdir}/emacs/${version}/
 else
 BIN_DESTDIR='${ns_appbindir}/'
-ELN_DESTDIR = ${ns_applibdir}/emacs/${version}/
+ELN_DESTDIR = ${ns_applibdir}/
 endif
 
 all: ${SUBDIR} info
diff --git a/configure.ac b/configure.ac
index 6e2cda947a..c924634d5b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1895,7 +1895,7 @@ AC_DEFUN
      ns_appdir=`pwd`/nextstep/Emacs.app
      ns_appbindir=${ns_appdir}/Contents/MacOS
      ns_applibexecdir=${ns_appdir}/Contents/MacOS/libexec
-     ns_applibdir=${ns_appdir}/Contents/MacOS/lib
+     ns_applibdir=${ns_appdir}/Contents/Frameworks
      ns_appresdir=${ns_appdir}/Contents/Resources
      ns_appsrc=Cocoa/Emacs.base
      ns_fontfile=macfont.o
@@ -1954,7 +1954,7 @@ AC_DEFUN
      ns_appdir=`pwd`/nextstep/Emacs.app
      ns_appbindir=${ns_appdir}
      ns_applibexecdir=${ns_appdir}/libexec
-     ns_applibdir=${ns_appdir}/lib
+     ns_applibdir=${ns_appdir}/Frameworks
      ns_appresdir=${ns_appdir}/Resources
      ns_appsrc=GNUstep/Emacs.base
      ns_fontfile=nsfont.o
diff --git a/src/comp.c b/src/comp.c
index ea05952627..ac77ae704d 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -744,8 +744,26 @@ hash_native_abi (void)
 			Vsystem_configuration_options),
 	       Fmapconcat (intern_c_string ("comp--subr-signature"),
 			   Vcomp_subr_list, build_string (""))));
+
+  Lisp_Object version = Vemacs_version;
+
+#ifdef NS_SELF_CONTAINED
+  /* MacOS self contained app bundles do not like having dots in the
+     directory names under the Contents/Frameworks directory, so
+     convert them to underscores.  */
+
+  char *str = xstrdup (SSDATA(version));
+
+  for (ptrdiff_t c = 0 ; c < SBYTES (version) ; c++)
+    if (*(str + c) == '.')
+      *(str + c) = '_';
+
+  version = build_string (str);
+  xfree (str);
+#endif
+
   Vcomp_native_version_dir =
-    concat3 (Vemacs_version, build_string ("-"), Vcomp_abi_hash);
+    concat3 (version, build_string ("-"), Vcomp_abi_hash);
 }
 
 static void
-- 
2.29.2


  reply	other threads:[~2021-06-30 19:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-29 11:58 bug#49271: 28.0.50: native-comp: Signing macOS self-contained .app bundle fails due to new *.eln location Jim Myhrberg
2021-06-29 19:18 ` Alan Third
2021-06-30 10:04   ` Jim Myhrberg
2021-06-30 12:20     ` Eli Zaretskii
2021-06-30 12:39       ` Jim Myhrberg
2021-06-30 12:52         ` Alan Third
2021-06-30 13:10           ` Jim Myhrberg
2021-06-30 19:05             ` Alan Third [this message]
2021-07-01  7:13               ` Eli Zaretskii
2021-07-01 18:45                 ` Alan Third
2021-07-01 19:03                   ` Eli Zaretskii
2021-07-01 19:56                     ` Alan Third
2021-07-01 14:53               ` Jim Myhrberg
2021-07-01 20:13                 ` Alan Third
2021-07-01 20:43                   ` Jim Myhrberg
2021-07-01 21:16                 ` Alan Third
2021-06-30 12:42       ` Alan Third
2021-06-30 12:51         ` Jim Myhrberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YNzAjsQYSAqZKdlN@breton.holly.idiocy.org \
    --to=alan@idiocy.org \
    --cc=49271@debbugs.gnu.org \
    --cc=contact@jimeh.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).