Subject: [PATCH RFC 1/2] gnu: emacs: Compute ABI hash and native version dir without version.

From: Liliana Marie Prikler <[email-masked]>
Date: Sat, 13 Jul 2024 07:49:06 +0200

* gnu/packages/patches/emacs-native-comp-fix-filenames.patch: Drop
emacs_version from Vcomp_abi_hash.
Make Vcomp_native_version_dir equal to Vcomp_abi_hash.
---
Hi Guix,

this is a somewhat experimental patch, which reduces Vcomp_native_version_dir
to simply Vcomp_abi_hash.  Note, that this is not enough to address the
issues currently noticed with Emacs native compilation, as Vcomp_abi_hash
is unstable between 29.3 and 29.4.  These hashes are probably unlikely
to stay the same between minor releases even when dropping the version.

Cheers

 .../emacs-native-comp-fix-filenames.patch     | 27 ++++++++++++++++---
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/patches/emacs-native-comp-fix-filenames.patch b/gnu/packages/patches/emacs-native-comp-fix-filenames.patch
index 169323f290..6c81d7c28c 100644
--- a/gnu/packages/patches/emacs-native-comp-fix-filenames.patch
+++ b/gnu/packages/patches/emacs-native-comp-fix-filenames.patch
@@ -12,11 +12,30 @@ way into the actual variable despite attempts to remove it by calling
 The user-visible procedure ‘startup-redirect-eln-cache’ is kept, as
 packages may require it, but only pushes the new value now.
 
-Index: emacs-29.2/src/comp.c
+Index: emacs-29.3/src/comp.c
 ===================================================================
---- emacs-29.2.orig/src/comp.c
-+++ emacs-29.2/src/comp.c
-@@ -4396,26 +4396,17 @@ DEFUN ("comp-el-to-eln-rel-filename", Fc
+--- emacs-29.3.orig/src/comp.c
++++ emacs-29.3/src/comp.c
+@@ -805,7 +805,7 @@ hash_native_abi (void)
+   Vcomp_abi_hash =
+     comp_hash_string (
+       concat3 (build_string (ABI_VERSION),
+-	       concat3 (Vemacs_version, Vsystem_configuration,
++	       concat2 (Vsystem_configuration,
+ 			Vsystem_configuration_options),
+ 	       Fmapconcat (intern_c_string ("comp--subr-signature"),
+ 			   Vcomp_subr_list, build_string (""))));
+@@ -835,8 +835,7 @@ hash_native_abi (void)
+     }
+ #endif
+ 
+-  Vcomp_native_version_dir =
+-    concat3 (version, build_string ("-"), Vcomp_abi_hash);
++  Vcomp_native_version_dir = Vcomp_abi_hash;
+ }
+ 
+ static void
+@@ -4396,26 +4395,17 @@ DEFUN ("comp-el-to-eln-rel-filename", Fc
         Scomp_el_to_eln_rel_filename, 1, 1, 0,
         doc: /* Return the relative name of the .eln file for FILENAME.
  FILENAME must exist, and if it's a symlink, the target must exist.

base-commit: a1e6ac72fd88faf20c26e235f5c8222881b2b450
-- 
2.45.2