From b91741a3d32eb402c88e442ff56cf0f0f88d17f9 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Tue, 17 Sep 2024 15:06:59 -0300 Subject: [PATCH 1/3] emacs: use lib.getDev to get harfbuzz (cherry picked from commit 2238a5a1d0a80368a326c66d5c571e6aadcc6150) --- pkgs/applications/editors/emacs/make-emacs.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/editors/emacs/make-emacs.nix b/pkgs/applications/editors/emacs/make-emacs.nix index 988df1b8951b9..8c5d717db86b2 100644 --- a/pkgs/applications/editors/emacs/make-emacs.nix +++ b/pkgs/applications/editors/emacs/make-emacs.nix @@ -214,12 +214,12 @@ mkDerivation (finalAttrs: { ] ++ lib.optionals srcRepo [ autoreconfHook texinfo - ] ++ lib.optional (withPgtk || withX && (withGTK3 || withXwidgets)) wrapGAppsHook3; + ] ++ lib.optionals (withPgtk || withX && (withGTK3 || withXwidgets)) [ wrapGAppsHook3 ]; buildInputs = [ gettext gnutls - harfbuzz.dev + (lib.getDev harfbuzz) jansson libxml2 ncurses From 0d65990eb110041a9b0a44749fe8e58ee5121705 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Tue, 17 Sep 2024 15:02:31 -0300 Subject: [PATCH 2/3] emacs30: init (cherry picked from commit b585a1d35ee8f3d76a89d819026f292319fe19c2) --- pkgs/applications/editors/emacs/default.nix | 14 ++++++++++++++ pkgs/applications/editors/emacs/make-emacs.nix | 4 +++- .../emacs/native-comp-driver-options-30.patch | 16 ++++++++++++++++ pkgs/applications/editors/emacs/sources.nix | 8 ++++++++ pkgs/top-level/all-packages.nix | 7 +++++++ 5 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 pkgs/applications/editors/emacs/native-comp-driver-options-30.patch diff --git a/pkgs/applications/editors/emacs/default.nix b/pkgs/applications/editors/emacs/default.nix index 29e2c2d85f495..678431c62ddea 100644 --- a/pkgs/applications/editors/emacs/default.nix +++ b/pkgs/applications/editors/emacs/default.nix @@ -60,6 +60,20 @@ lib.makeScope pkgs.newScope (self: withPgtk = true; }; + emacs30 = callPackage (self.sources.emacs30) inheritedArgs; + + emacs30-gtk3 = self.emacs30.override { + withGTK3 = true; + }; + + emacs30-nox = self.emacs30.override { + noGui = true; + }; + + emacs30-pgtk = self.emacs30.override { + withPgtk = true; + }; + emacs28-macport = callPackage (self.sources.emacs28-macport) inheritedArgs; emacs29-macport = callPackage (self.sources.emacs29-macport) inheritedArgs; diff --git a/pkgs/applications/editors/emacs/make-emacs.nix b/pkgs/applications/editors/emacs/make-emacs.nix index 8c5d717db86b2..df592cf214d36 100644 --- a/pkgs/applications/editors/emacs/make-emacs.nix +++ b/pkgs/applications/editors/emacs/make-emacs.nix @@ -159,7 +159,9 @@ mkDerivation (finalAttrs: { (substituteAll { src = if lib.versionOlder finalAttrs.version "29" then ./native-comp-driver-options-28.patch - else ./native-comp-driver-options.patch; + else if lib.versionOlder finalAttrs.version "30" + then ./native-comp-driver-options.patch + else ./native-comp-driver-options-30.patch; backendPath = (lib.concatStringsSep " " (builtins.map (x: ''"-B${x}"'') ([ # Paths necessary so the JIT compiler finds its libraries: diff --git a/pkgs/applications/editors/emacs/native-comp-driver-options-30.patch b/pkgs/applications/editors/emacs/native-comp-driver-options-30.patch new file mode 100644 index 0000000000000..bd3ff2adf77c1 --- /dev/null +++ b/pkgs/applications/editors/emacs/native-comp-driver-options-30.patch @@ -0,0 +1,16 @@ +diff -Naur a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el +--- old/lisp/emacs-lisp/comp.el 1969-12-31 21:00:01.000000000 -0300 ++++ source/lisp/emacs-lisp/comp.el 2024-09-13 14:26:37.246614196 -0300 +@@ -101,8 +101,10 @@ + :version "28.1") + + (defcustom native-comp-driver-options +- (cond ((eq system-type 'darwin) '("-Wl,-w")) +- ((eq system-type 'cygwin) '("-Wl,-dynamicbase"))) ++ (append ++ (cond ((eq system-type 'darwin) '("-Wl,-w")) ++ ((eq system-type 'cygwin) '("-Wl,-dynamicbase"))) ++ '(@backendPath@)) + "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. diff --git a/pkgs/applications/editors/emacs/sources.nix b/pkgs/applications/editors/emacs/sources.nix index 5855b6de91725..992dd32870cb8 100644 --- a/pkgs/applications/editors/emacs/sources.nix +++ b/pkgs/applications/editors/emacs/sources.nix @@ -110,6 +110,14 @@ in hash = "sha256-FCP6ySkN9mAdp2T09n6foS2OciqZXc/54guRZ0B4Z2s="; }); + emacs30 = import ./make-emacs.nix (mkArgs { + pname = "emacs"; + version = "30.0.91"; + variant = "mainline"; + rev = "30.0.91"; + hash = "sha256-X5J34BUY42JgA1s76eVeGA9WNtesU2c+JyndIHFbONQ="; + }); + emacs28-macport = import ./make-emacs.nix (mkArgs { pname = "emacs-mac"; version = "28.2"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index fcfaf2ebc54af..5180d7b7625ad 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -30448,10 +30448,17 @@ with pkgs; emacs28-gtk2 emacs28-gtk3 emacs28-nox + emacs29 emacs29-gtk3 emacs29-nox emacs29-pgtk + + emacs30 + emacs30-gtk3 + emacs30-nox + emacs30-pgtk + emacs28-macport emacs29-macport ; From 52285d57bffaaf65392a643c128c41d7c592bf71 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Tue, 17 Sep 2024 15:07:44 -0300 Subject: [PATCH 3/3] emacs: jansson is now optional Since it is not needed in Emacs 30+. (cherry picked from commit afb9fff17718125a26caad74d329ab679488ec73) --- pkgs/applications/editors/emacs/make-emacs.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/applications/editors/emacs/make-emacs.nix b/pkgs/applications/editors/emacs/make-emacs.nix index df592cf214d36..83836e1d9093f 100644 --- a/pkgs/applications/editors/emacs/make-emacs.nix +++ b/pkgs/applications/editors/emacs/make-emacs.nix @@ -76,6 +76,8 @@ , withGlibNetworking ? withPgtk || withGTK3 || (withX && withXwidgets) , withGpm ? stdenv.isLinux , withImageMagick ? lib.versionOlder version "27" && (withX || withNS) +# Emacs 30+ has native JSON support +, withJansson ? lib.versionOlder version "30" , withMailutils ? true , withMotif ? false , withNS ? stdenv.isDarwin && !(variant == "macport" || noGui) @@ -222,7 +224,9 @@ mkDerivation (finalAttrs: { gettext gnutls (lib.getDev harfbuzz) + ] ++ lib.optionals withJansson [ jansson + ] ++ [ libxml2 ncurses ] ++ lib.optionals withGconf [