2021-01-19 07:50:56 +01:00
|
|
|
{ lib, stdenv, fetchurl, ncurses, pkg-config, texinfo, libxml2, gnutls, gettext, autoconf, automake, jansson
|
2019-06-19 21:55:10 +02:00
|
|
|
, AppKit, Carbon, Cocoa, IOKit, OSAKit, Quartz, QuartzCore, WebKit
|
2016-09-21 22:19:57 +02:00
|
|
|
, ImageCaptureCore, GSS, ImageIO # These may be optional
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-12-13 21:23:47 +01:00
|
|
|
pname = "emacs";
|
2021-04-18 04:45:08 +02:00
|
|
|
version = "27.2";
|
2019-12-13 21:23:47 +01:00
|
|
|
|
|
|
|
emacsName = "emacs-${version}";
|
2021-04-18 04:45:08 +02:00
|
|
|
macportVersion = "8.2";
|
2019-12-13 21:23:47 +01:00
|
|
|
name = "emacs-mac-${version}-${macportVersion}";
|
2016-09-21 22:19:57 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
2018-05-31 03:39:14 +02:00
|
|
|
url = "mirror://gnu/emacs/${emacsName}.tar.xz";
|
2021-04-18 04:45:08 +02:00
|
|
|
sha256 = "1ff182gjw9wqsbx1kj5gl2r5pbqhp4ar54g04j33fgz6g17cr9xl";
|
2016-09-21 22:19:57 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
macportSrc = fetchurl {
|
2017-03-24 22:16:39 +01:00
|
|
|
url = "ftp://ftp.math.s.chiba-u.ac.jp/emacs/${emacsName}-mac-${macportVersion}.tar.gz";
|
2021-04-18 04:45:08 +02:00
|
|
|
sha256 = "1bgm2g3ky7rkj1l27wnmyzqsqxzjng7y9bf72ym37wiyhyi2a9za";
|
2016-09-21 22:19:57 +02:00
|
|
|
};
|
|
|
|
|
2017-01-24 00:49:39 +01:00
|
|
|
hiresSrc = fetchurl {
|
2018-05-31 03:39:14 +02:00
|
|
|
url = "ftp://ftp.math.s.chiba-u.ac.jp/emacs/emacs-hires-icons-3.0.tar.gz";
|
|
|
|
sha256 = "0f2wzdw2a3ac581322b2y79rlj3c9f33ddrq9allj97r1si6v5xk";
|
2017-01-24 00:49:39 +01:00
|
|
|
};
|
|
|
|
|
2016-09-21 22:19:57 +02:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-01-19 07:50:56 +01:00
|
|
|
nativeBuildInputs = [ pkg-config autoconf automake ];
|
2017-04-22 20:40:41 +02:00
|
|
|
|
2020-09-07 11:31:48 +02:00
|
|
|
buildInputs = [ ncurses libxml2 gnutls texinfo gettext jansson
|
2016-09-21 22:19:57 +02:00
|
|
|
AppKit Carbon Cocoa IOKit OSAKit Quartz QuartzCore WebKit
|
|
|
|
ImageCaptureCore GSS ImageIO # may be optional
|
|
|
|
];
|
|
|
|
|
|
|
|
postUnpack = ''
|
|
|
|
mv $sourceRoot $name
|
2017-03-24 22:16:39 +01:00
|
|
|
tar xzf $macportSrc -C $name --strip-components=1
|
2016-09-21 22:19:57 +02:00
|
|
|
mv $name $sourceRoot
|
2017-01-24 00:49:39 +01:00
|
|
|
|
|
|
|
# extract retina image resources
|
|
|
|
tar xzfv $hiresSrc --strip 1 -C $sourceRoot
|
2016-09-21 22:19:57 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
patch -p1 < patch-mac
|
|
|
|
substituteInPlace lisp/international/mule-cmds.el \
|
|
|
|
--replace /usr/share/locale ${gettext}/share/locale
|
2017-01-24 00:49:39 +01:00
|
|
|
|
|
|
|
# use newer emacs icon
|
|
|
|
cp nextstep/Cocoa/Emacs.base/Contents/Resources/Emacs.icns mac/Emacs.app/Contents/Resources/Emacs.icns
|
2019-02-13 19:49:17 +01:00
|
|
|
|
|
|
|
# Fix sandbox impurities.
|
|
|
|
substituteInPlace Makefile.in --replace '/bin/pwd' 'pwd'
|
|
|
|
substituteInPlace lib-src/Makefile.in --replace '/bin/pwd' 'pwd'
|
2021-02-25 10:38:20 +01:00
|
|
|
|
|
|
|
|
|
|
|
# Reduce closure size by cleaning the environment of the emacs dumper
|
|
|
|
substituteInPlace src/Makefile.in \
|
|
|
|
--replace 'RUN_TEMACS = ./temacs' 'RUN_TEMACS = env -i ./temacs'
|
2016-09-21 22:19:57 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"LDFLAGS=-L${ncurses.out}/lib"
|
|
|
|
"--with-xml2=yes"
|
|
|
|
"--with-gnutls=yes"
|
|
|
|
"--with-mac"
|
2017-04-22 20:40:41 +02:00
|
|
|
"--with-modules"
|
2016-09-21 22:19:57 +02:00
|
|
|
"--enable-mac-app=$$out/Applications"
|
|
|
|
];
|
|
|
|
|
2019-04-21 21:40:07 +02:00
|
|
|
CFLAGS = "-O3";
|
2016-09-21 22:19:57 +02:00
|
|
|
LDFLAGS = "-O3 -L${ncurses.out}/lib";
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/share/emacs/site-lisp/
|
|
|
|
cp ${./site-start.el} $out/share/emacs/site-lisp/site-start.el
|
|
|
|
'';
|
|
|
|
|
2020-08-11 18:51:24 +02:00
|
|
|
# fails with:
|
|
|
|
|
|
|
|
# Ran 3870 tests, 3759 results as expected, 6 unexpected, 105 skipped
|
|
|
|
# 5 files contained unexpected results:
|
|
|
|
# lisp/url/url-handlers-test.log
|
|
|
|
# lisp/simple-tests.log
|
|
|
|
# lisp/files-x-tests.log
|
|
|
|
# lisp/cedet/srecode-utest-template.log
|
|
|
|
# lisp/net/tramp-tests.log
|
|
|
|
doCheck = false;
|
2016-09-21 22:19:57 +02:00
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2018-06-20 22:28:25 +02:00
|
|
|
description = "The extensible, customizable text editor";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://www.gnu.org/software/emacs/";
|
2016-09-21 22:19:57 +02:00
|
|
|
license = licenses.gpl3Plus;
|
2018-06-20 22:28:25 +02:00
|
|
|
maintainers = with maintainers; [ jwiegley matthewbauer ];
|
2016-09-21 22:19:57 +02:00
|
|
|
platforms = platforms.darwin;
|
|
|
|
|
|
|
|
longDescription = ''
|
|
|
|
GNU Emacs is an extensible, customizable text editor—and more. At its
|
|
|
|
core is an interpreter for Emacs Lisp, a dialect of the Lisp
|
|
|
|
programming language with extensions to support text editing.
|
|
|
|
|
|
|
|
The features of GNU Emacs include: content-sensitive editing modes,
|
|
|
|
including syntax coloring, for a wide variety of file types including
|
|
|
|
plain text, source code, and HTML; complete built-in documentation,
|
|
|
|
including a tutorial for new users; full Unicode support for nearly all
|
|
|
|
human languages and their scripts; highly customizable, using Emacs
|
|
|
|
Lisp code or a graphical interface; a large number of extensions that
|
|
|
|
add other functionality, including a project planner, mail and news
|
|
|
|
reader, debugger interface, calendar, and more. Many of these
|
|
|
|
extensions are distributed with GNU Emacs; others are available
|
|
|
|
separately.
|
|
|
|
|
2018-06-20 22:28:25 +02:00
|
|
|
This is the "Mac port" addition to GNU Emacs 26. This provides a native
|
2017-03-24 22:16:50 +01:00
|
|
|
GUI support for Mac OS X 10.6 - 10.12. Note that Emacs 23 and later
|
2016-09-21 22:19:57 +02:00
|
|
|
already contain the official GUI support via the NS (Cocoa) port for
|
|
|
|
Mac OS X 10.4 and later. So if it is good enough for you, then you
|
|
|
|
don't need to try this.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|