@@ -0,0 +1,91 @@
1+{ stdenv, fetchurl, ncurses, pkgconfig, texinfo, libxml2, gnutls, gettext, autoconf, automake
2+, AppKit, Carbon, Cocoa, IOKit, OSAKit, Quartz, QuartzCore, WebKit
3+, ImageCaptureCore, GSS, ImageIO # These may be optional
4+}:
5+
6+stdenv.mkDerivation rec {
7+ emacsName = "emacs-25.1";
8+ name = "${emacsName}-mac-6.0";
9+
10+ builder = ./builder.sh;
11+
12+ src = fetchurl {
13+ url = "ftp://ftp.gnu.org/gnu/emacs/${emacsName}.tar.xz";
14+ sha256 = "19f2798ee3bc26c95dca3303e7ab141e7ad65d6ea2b6945eeba4dbea7df48f33";
15+ };
16+
17+ macportSrc = fetchurl {
18+ url = "ftp://ftp.math.s.chiba-u.ac.jp/emacs/${name}.tar.gz";
19+ sha256 = "2f7a3fd826e6dea541ada04f4a1ff2903a87a1f736b89c5b90bf7bb820568e34";
20+ };
21+
22+ enableParallelBuilding = true;
23+
24+ buildInputs = [ ncurses libxml2 gnutls pkgconfig texinfo gettext autoconf automake];
25+
26+ propagatedBuildInputs = [
27+ AppKit Carbon Cocoa IOKit OSAKit Quartz QuartzCore WebKit
28+ ImageCaptureCore GSS ImageIO # may be optional
29+ ];
30+
31+ postUnpack = ''
32+ mv $sourceRoot $name
33+ tar xzf $macportSrc
34+ mv $name $sourceRoot
35+ '';
36+
37+ postPatch = ''
38+ patch -p1 < patch-mac
39+ substituteInPlace lisp/international/mule-cmds.el \
40+ --replace /usr/share/locale ${gettext}/share/locale
41+ '';
42+
43+ configureFlags = [
44+ "LDFLAGS=-L${ncurses.out}/lib"
45+ "--with-xml2=yes"
46+ "--with-gnutls=yes"
47+ "--with-mac"
48+ "--enable-mac-app=$$out/Applications"
49+ ];
50+
51+ CFLAGS = "-O3 -DMAC_OS_X_VERSION_MAX_ALLOWED=1090";
52+ LDFLAGS = "-O3 -L${ncurses.out}/lib";
53+
54+ postInstall = ''
55+ mkdir -p $out/share/emacs/site-lisp/
56+ cp ${./site-start.el} $out/share/emacs/site-lisp/site-start.el
57+ '';
58+
59+ doCheck = true;
60+
61+ meta = with stdenv.lib; {
62+ description = "GNU Emacs 25, the extensible, customizable text editor";
63+ homepage = http://www.gnu.org/software/emacs/;
64+ license = licenses.gpl3Plus;
65+ maintainers = with maintainers; [ jwiegley ];
66+ platforms = platforms.darwin;
67+
68+ longDescription = ''
69+ GNU Emacs is an extensible, customizable text editor—and more. At its
70+ core is an interpreter for Emacs Lisp, a dialect of the Lisp
71+ programming language with extensions to support text editing.
72+
73+ The features of GNU Emacs include: content-sensitive editing modes,
74+ including syntax coloring, for a wide variety of file types including
75+ plain text, source code, and HTML; complete built-in documentation,
76+ including a tutorial for new users; full Unicode support for nearly all
77+ human languages and their scripts; highly customizable, using Emacs
78+ Lisp code or a graphical interface; a large number of extensions that
79+ add other functionality, including a project planner, mail and news
80+ reader, debugger interface, calendar, and more. Many of these
81+ extensions are distributed with GNU Emacs; others are available
82+ separately.
83+
84+ This is "Mac port" addition to GNU Emacs 24. This provides a native
85+ GUI support for Mac OS X 10.4 - 10.11. Note that Emacs 23 and later
86+ already contain the official GUI support via the NS (Cocoa) port for
87+ Mac OS X 10.4 and later. So if it is good enough for you, then you
88+ don't need to try this.
89+ '';
90+ };
91+}