Subject: Re: bug#43878: patch for 43878

From: Itai Seggev <[email-masked]>
Date: Fri, 20 Nov 2020 14:19:09 -0600

On Wed, Nov 18, 2020 at 11:34:15PM +0000, Alan Third wrote:
> On Tue, Nov 17, 2020 at 12:36:10PM -0600, Itai Seggev wrote:
> > +ifeq ($(shell uname),Darwin)
> 
> Is $DARWIN_OS available in the Makefile?

Not as far as I can tell.  But here's a revised patch that is both more
targeted and only using autoconf variables:

diff --git a/src/Makefile.in b/src/Makefile.in
index c5fb2ea3ab..02d50bb7ca 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -336,6 +336,10 @@ DUMPING=
 CHECK_STRUCTS = @CHECK_STRUCTS@
 HAVE_PDUMPER = @HAVE_PDUMPER@
 
+## ARM Macs require that all code have a valid signature.  Since pump
+## invalidates the signature, we must re-sign to fix it.
+DO_CODESIGN=$(patsubst @configuration@,aarch64-apple-darwin%,yes)
+
 # 'make' verbosity.
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 
@@ -653,6 +657,9 @@ temacs$(EXEEXT):
 	  $(ALLOBJS) $(LIBEGNU_ARCHIVE) $(W32_RES_LINK) $(LIBES)
 ifeq ($(HAVE_PDUMPER),yes)
 	$(AM_V_at)$(MAKE_PDUMPER_FINGERPRINT) $@.tmp
+ifeq ($(DO_CODESIGN),yes)
+	codesign -s - -f $@.tmp
+endif
 endif
 	$(AM_V_at)mv $@.tmp $@
 	$(MKDIR_P) $(etc)

--
Itai

In 1997 a group of programmers started writing a desktop environment to fix a
travesty they didn't create.  Their program promptly found its way onto un*x
systems everywhere. Today, still opposed by a software monopolist, they survive
as soldiers of fortune.  If you share their vision, if you know you can help,
and if you can connect to internet, maybe you can join... the K-Team.