Subject: bug#49270: 28.0.50: native-comp: macOS self-contained .app does not use bundled *.eln files

From: Jim Myhrberg <[email-masked]>
Date: Tue, 29 Jun 2021 12:51:48 +0100

When performing a self-contained Emacs.app build, *.eln files for
Emacs' built-in lisp files stored within the Emacs.app bundle are not
used.

I believe commit 5dd2d50 which moved *.eln files and various paths
around a bit for macOS builds, has re-introduced an old bug from last
year. Basically the checksums that makes up part of the *.eln file
names uses the absolute path of the .el file in question, but for self
contained .app builds it needs to just use the relative path to the
app itself.

In short, any *.el files which contain ".app/Contents/" within their
absolute file path, need to have anything before ".app/Contents/"
removed before the *.eln filename checksum is calculated. Potentially
some extra logic might be needed for build-time native-comp, as the
checksums in the *.eln files bundled into the app right now are not
based on the final location of lisp files within the .app bundle.

In my testing, of the two checksums which are part of all *.eln
filenames, the first checksum is different in the newly async
generated *.eln files compared to those within the application bundle.
The second checksum is identical. Also moving Emacs.app to different
locations on the file system will cause it to re-compile *.eln files
again, with the first checksum changing again.

For the sake of any doubt, this issue occurs both with and without
NATIVE_FULL_AOT=1.

I've seen this behavior with all builds from the master branch that
I've done since the 27th of June.

Hopefully I've provided enough information here, please don't hesitate
to ask if anything more is needed.

P.S. I'm pretty new to emacs bug reporting, so apologies if I'm doing
something wrong, and please let me know if so, and what I should be
doing instead :)