Subject: [bug#66225] [PATCH v2 2/2] gnu: emacs-next-minimal: Add patch emacs-native-comp-driver-options.

From: Nicolas Graves <[email-masked]>
Date: Sun, 1 Oct 2023 22:06:49 +0200

* gnu/packages/emacs.scm (emacs-next-minimal)[origin](patches): Add patch emacs-native-comp-driver-options.
* gnu/local.mk: Add patch emacs-native-comp-driver-options.
* gnu/packages/patches/emacs-native-comp-driver-options.patch: Add file.
---
 gnu/local.mk                                   |  1 +
 gnu/packages/emacs.scm                         |  4 +++-
 .../emacs-native-comp-driver-options.patch     | 18 ++++++++++++++++++
 3 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/emacs-native-comp-driver-options.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index ef7888f5b5..956f846928 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1109,6 +1109,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/emacs-highlight-stages-add-gexp.patch	\
   %D%/packages/patches/emacs-lispy-fix-thread-last-test.patch   \
   %D%/packages/patches/emacs-29-native-comp-driver-options.patch   \
+  %D%/packages/patches/emacs-native-comp-driver-options.patch   \
   %D%/packages/patches/emacs-pasp-mode-quote-file-names.patch  \
   %D%/packages/patches/emacs-polymode-fix-lexical-variable-error.patch  \
   %D%/packages/patches/emacs-telega-path-placeholder.patch	\
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 54581d968d..cd01285a83 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -498,7 +498,9 @@ (define-public emacs-next-minimal
              (commit commit)))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "00mwpq1msr3jij281w5piqmbwq968xr8dn9hqbf4r947ck754kn9")))))))
+        (base32 "00mwpq1msr3jij281w5piqmbwq968xr8dn9hqbf4r947ck754kn9"))
+       (patches
+        (search-patches "emacs-native-comp-driver-options.patch")))))))
 
 (define* (emacs->emacs-next emacs #:optional name
                             #:key (version (package-version emacs-next-minimal))
diff --git a/gnu/packages/patches/emacs-native-comp-driver-options.patch b/gnu/packages/patches/emacs-native-comp-driver-options.patch
new file mode 100644
index 0000000000..e4ed5a48f1
--- /dev/null
+++ b/gnu/packages/patches/emacs-native-comp-driver-options.patch
@@ -0,0 +1,18 @@
+We substitute this anyway, so let's make it easier to substitute.
+
+--- a/lisp/emacs-lisp/comp.el
++++ b/lisp/emacs-lisp/comp.el
+@@ -203,9 +203,7 @@ and above."
+   :type '(repeat string)
+   :version "28.1")
+ 
+-(defcustom native-comp-driver-options
+-  (cond ((eq system-type 'darwin) '("-Wl,-w"))
+-        ((eq system-type 'cygwin) '("-Wl,-dynamicbase")))
++(defcustom native-comp-driver-options nil
+   "Options passed verbatim to the native compiler's back-end driver.
+ Note that not all options are meaningful; typically only the options
+ affecting the assembler and linker are likely to be useful.
+-- 
+2.38.0
+
-- 
2.41.0