about summary refs log tree commit diff
path: root/pkgs/applications/editors/emacs-24/macport-24.5.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/editors/emacs-24/macport-24.5.nix')
-rw-r--r--pkgs/applications/editors/emacs-24/macport-24.5.nix69
1 files changed, 24 insertions, 45 deletions
diff --git a/pkgs/applications/editors/emacs-24/macport-24.5.nix b/pkgs/applications/editors/emacs-24/macport-24.5.nix
index 6b377abdda10..c778c42de857 100644
--- a/pkgs/applications/editors/emacs-24/macport-24.5.nix
+++ b/pkgs/applications/editors/emacs-24/macport-24.5.nix
@@ -1,12 +1,13 @@
-{ stdenv, fetchurl, ncurses, pkgconfig, texinfo, libxml2, gnutls
-, Carbon, Cocoa, ImageCaptureCore, OSAKit, Quartz, WebKit
+{ stdenv, fetchurl, ncurses, pkgconfig, texinfo, libxml2, gnutls, gettext
+, AppKit, Carbon, Cocoa, IOKit, OSAKit, Quartz, QuartzCore, WebKit
+, ImageCaptureCore, GSS, ImageIO # These may be optional
 }:
 
 stdenv.mkDerivation rec {
   emacsName = "emacs-24.5";
-  name = "${emacsName}-mac-5.13";
+  name = "${emacsName}-mac-5.15";
 
-  #builder = ./builder.sh;
+  builder = ./builder.sh;
 
   src = fetchurl {
     url = "mirror://gnu/emacs/${emacsName}.tar.xz";
@@ -15,17 +16,16 @@ stdenv.mkDerivation rec {
 
   macportSrc = fetchurl {
     url = "ftp://ftp.math.s.chiba-u.ac.jp/emacs/${name}.tar.gz";
-    sha256 = "0p8xpsnsdpwpfq4mz0fazm785d0my0pq4ifbw533g959jh17b36h";
+    sha256 = "1r47bm1pf5av2yr37byz91y7bp6vdw9smahiy18g5qp4jp6mz193";
   };
 
   enableParallelBuilding = true;
 
-  buildInputs = [
-    ncurses pkgconfig texinfo libxml2 gnutls
-  ];
+  buildInputs = [ ncurses libxml2 gnutls pkgconfig texinfo gettext ];
 
   propagatedBuildInputs = [
-    Carbon Cocoa ImageCaptureCore OSAKit Quartz WebKit
+    AppKit Carbon Cocoa IOKit OSAKit Quartz QuartzCore WebKit
+    ImageCaptureCore GSS ImageIO   # may be optional
   ];
 
   postUnpack = ''
@@ -34,46 +34,25 @@ stdenv.mkDerivation rec {
     mv $name $emacsName
   '';
 
-  preConfigure = ''
-    substituteInPlace lisp/international/mule-cmds.el --replace /usr $TMPDIR
-    substituteInPlace Makefile.in --replace "/bin/pwd" "pwd"
-    substituteInPlace lib-src/Makefile.in --replace "/bin/pwd" "pwd"
-
+  postPatch = ''
     patch -p1 < patch-mac
-
-    # The search for 'tputs' will fail because it's in ncursesw within the
-    # ncurses package, yet Emacs' configure script only looks in ncurses.
-    # Further, we need to make sure that the -L option occurs before mention
-    # of the library, so that it finds it within the Nix store.
-    sed -i 's/tinfo ncurses/tinfo ncursesw/' configure
-    ncurseslib=$(echo ${ncurses}/lib | sed 's#/#\\/#g')
-    sed -i "s/OLIBS=\$LIBS/OLIBS=\"-L$ncurseslib \$LIBS\"/" configure
-    sed -i 's/LIBS="\$LIBS_TERMCAP \$LIBS"/LIBS="\$LIBS \$LIBS_TERMCAP"/' configure
-
-    configureFlagsArray=(
-      LDFLAGS=-L${ncurses}/lib
-      --with-xml2=yes
-      --with-gnutls=yes
-      --with-mac
-      --enable-mac-app=$out/Applications
-    )
-    makeFlagsArray=(
-      CFLAGS=-O3
-      LDFLAGS="-O3 -L${ncurses}/lib"
-    );
+    sed -i 's|/usr/share/locale|${gettext}/share/locale|g' lisp/international/mule-cmds.el
   '';
 
+  configureFlags = [
+    "LDFLAGS=-L${ncurses}/lib"
+    "--with-xml2=yes"
+    "--with-gnutls=yes"
+    "--with-mac"
+    "--enable-mac-app=$$out/Applications"
+  ];
+
+  CFLAGS = "-O3";
+  LDFLAGS = "-O3 -L${ncurses}/lib";
+
   postInstall = ''
-    cat >$out/share/emacs/site-lisp/site-start.el <<EOF
-    ;; nixos specific load-path
-    (when (getenv "NIX_PROFILES") (setq load-path
-                          (append (reverse (mapcar (lambda (x) (concat x "/share/emacs/site-lisp/"))
-                             (split-string (getenv "NIX_PROFILES"))))
-                    load-path)))
-
-    ;; make tramp work for NixOS machines
-    (eval-after-load 'tramp '(add-to-list 'tramp-remote-path "/run/current-system/sw/bin"))
-    EOF
+    mkdir -p $out/share/emacs/site-lisp/
+    cp ${./site-start.el} $out/share/emacs/site-lisp/site-start.el
   '';
 
   doCheck = true;