about summary refs log tree commit diff
path: root/pkgs/applications/editors/emacs/make-emacs.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/editors/emacs/make-emacs.nix')
-rw-r--r--pkgs/applications/editors/emacs/make-emacs.nix73
1 files changed, 43 insertions, 30 deletions
diff --git a/pkgs/applications/editors/emacs/make-emacs.nix b/pkgs/applications/editors/emacs/make-emacs.nix
index f252923897d18..ced468858760a 100644
--- a/pkgs/applications/editors/emacs/make-emacs.nix
+++ b/pkgs/applications/editors/emacs/make-emacs.nix
@@ -16,7 +16,6 @@
 , dbus
 , emacsPackagesFor
 , fetchpatch
-, gconf
 , gettext
 , giflib
 , glib-networking
@@ -31,7 +30,6 @@
 , jansson
 , libXaw
 , libXcursor
-, libXft
 , libXi
 , libXpm
 , libgccjit
@@ -45,6 +43,7 @@
 , libxml2
 , llvmPackages_14
 , m17n_lib
+, mailutils
 , makeWrapper
 , motif
 , ncurses
@@ -59,6 +58,7 @@
 , texinfo
 , webkitgtk
 , wrapGAppsHook3
+, zlib
 
 # Boolean flags
 , withNativeCompilation ? stdenv.buildPlatform.canExecute stdenv.hostPlatform
@@ -71,10 +71,12 @@
 , withDbus ? stdenv.isLinux
 , withGTK2 ? false
 , withGTK3 ? withPgtk && !noGui
-, withGconf ? false
 , 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)
 , withPgtk ? false
@@ -123,7 +125,6 @@ assert withAcl -> stdenv.isLinux;
 assert withAlsaLib -> stdenv.isLinux;
 assert withGTK2 -> !(withGTK3 || withPgtk);
 assert withGTK3 -> !withGTK2 || withPgtk;
-assert withGconf -> withX;
 assert withGpm -> stdenv.isLinux;
 assert withNS -> stdenv.isDarwin && !(withX || variant == "macport");
 assert withPgtk -> withGTK3 && !withX;
@@ -133,8 +134,8 @@ let
   libGccJitLibraryPaths = [
     "${lib.getLib libgccjit}/lib/gcc"
     "${lib.getLib stdenv.cc.libc}/lib"
-  ] ++ lib.optionals (stdenv.cc?cc.libgcc) [
-    "${lib.getLib stdenv.cc.cc.libgcc}/lib"
+  ] ++ lib.optionals (stdenv.cc?cc.lib.libgcc) [
+    "${lib.getLib stdenv.cc.cc.lib.libgcc}/lib"
   ];
 
   inherit (if variant == "macport"
@@ -157,7 +158,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:
@@ -212,17 +215,17 @@ 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)
+  ] ++ lib.optionals withJansson [
     jansson
+  ] ++ [
     libxml2
     ncurses
-  ] ++ lib.optionals withGconf [
-    gconf
   ] ++ lib.optionals withAcl [
     acl
   ] ++ lib.optionals withAlsaLib [
@@ -248,6 +251,7 @@ mkDerivation (finalAttrs: {
     glib-networking
   ] ++ lib.optionals withNativeCompilation [
     libgccjit
+    zlib
   ] ++ lib.optionals withImageMagick [
     imagemagick
   ] ++ lib.optionals withPgtk [
@@ -296,47 +300,56 @@ mkDerivation (finalAttrs: {
     OSAKit
     Quartz
     QuartzCore
-    UniformTypeIdentifiers
     WebKit
     # TODO are these optional?
     GSS
     ImageCaptureCore
     ImageIO
+  ] ++ lib.optionals (variant == "macport" && stdenv.hostPlatform.isAarch64) [
+    UniformTypeIdentifiers
+  ];
+
+  # Emacs needs to find movemail at run time, see info (emacs) Movemail
+  propagatedUserEnvPkgs = lib.optionals withMailutils [
+    mailutils
   ];
 
   hardeningDisable = [ "format" ];
 
   configureFlags = [
-    "--disable-build-details" # for a (more) reproducible build
-    "--with-modules"
+    (lib.enableFeature false "build-details") # for a (more) reproducible build
+    (lib.withFeature true "modules")
   ] ++ (if withNS then [
-    "--disable-ns-self-contained"
+    (lib.enableFeature false "ns-self-contained")
   ] else if withX then [
-    "--with-x-toolkit=${toolkit}"
-    "--with-xft"
-    "--with-cairo"
+    (lib.withFeatureAs true "x-toolkit" toolkit)
+    (lib.withFeature true "cairo")
+    (lib.withFeature true "xft")
   ] else if withPgtk then [
-    "--with-pgtk"
+    (lib.withFeature true "pgtk")
   ] else [
-    "--with-gif=no"
-    "--with-jpeg=no"
-    "--with-png=no"
-    "--with-tiff=no"
-    "--with-x=no"
-    "--with-xpm=no"
+    (lib.withFeature false "gif")
+    (lib.withFeature false "jpeg")
+    (lib.withFeature false "png")
+    (lib.withFeature false "tiff")
+    (lib.withFeature false "x")
+    (lib.withFeature false "xpm")
   ])
   ++ lib.optionals (variant == "macport") [
-    "--enable-mac-app=$$out/Applications"
-    "--with-gnutls=yes"
-    "--with-mac"
-    "--with-xml2=yes"
+    (lib.enableFeatureAs true "mac-app" "$$out/Applications")
+    (lib.withFeature true "gnutls")
+    (lib.withFeature true "mac")
+    (lib.withFeature true "xml2")
+  ]
+  ++ lib.optionals stdenv.isDarwin [
+    (lib.withFeature withNS "ns")
   ]
-  ++ (lib.optional stdenv.isDarwin (lib.withFeature withNS "ns"))
   ++ [
     (lib.withFeature withCompressInstall "compress-install")
     (lib.withFeature withToolkitScrollBars "toolkit-scroll-bars")
     (lib.withFeature withNativeCompilation "native-compilation")
     (lib.withFeature withImageMagick "imagemagick")
+    (lib.withFeature withMailutils "mailutils")
     (lib.withFeature withSmallJaDic "small-ja-dic")
     (lib.withFeature withTreeSitter "tree-sitter")
     (lib.withFeature withXinput2 "xinput2")