mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-20 04:31:52 +00:00
Merge pull request #155360 from Atemu/emacs-integrate-macport
emacs: integrate macport into generic drv
This commit is contained in:
commit
7b0295a10a
|
@ -1,5 +1,4 @@
|
|||
import ./generic.nix (rec {
|
||||
version = "28.2";
|
||||
sha256 = "sha256-4oSLcUDR0MOEt53QOiZSVU8kPJ67GwugmBxdX3F15Ag=";
|
||||
patches = _: [ ];
|
||||
})
|
||||
|
|
|
@ -4,19 +4,26 @@
|
|||
, versionModifier ? ""
|
||||
, pname ? "emacs"
|
||||
, name ? "emacs-${version}${versionModifier}"
|
||||
, patches ? [ ]
|
||||
, patches ? _: [ ]
|
||||
, macportVersion ? null
|
||||
}:
|
||||
{ stdenv, lib, fetchurl, fetchpatch, ncurses, xlibsWrapper, libXaw, libXpm
|
||||
{ stdenv, llvmPackages_6, lib, fetchurl, fetchpatch, ncurses, xlibsWrapper, libXaw, libXpm
|
||||
, Xaw3d, libXcursor, pkg-config, gettext, libXft, dbus, libpng, libjpeg, giflib
|
||||
, libtiff, librsvg, libwebp, gconf, libxml2, imagemagick, gnutls, libselinux
|
||||
, alsa-lib, cairo, acl, gpm, AppKit, GSS, ImageIO, m17n_lib, libotf
|
||||
, alsa-lib, cairo, acl, gpm, m17n_lib, libotf
|
||||
, sigtool, jansson, harfbuzz, sqlite, nixosTests
|
||||
, recurseIntoAttrs, emacsPackagesFor
|
||||
, libgccjit, targetPlatform, makeWrapper # native-comp params
|
||||
, fetchFromSavannah
|
||||
, fetchFromSavannah, fetchFromBitbucket
|
||||
|
||||
# macOS dependencies for NS and macPort
|
||||
, AppKit, Carbon, Cocoa, IOKit, OSAKit, Quartz, QuartzCore, WebKit
|
||||
, ImageCaptureCore, GSS, ImageIO # These may be optional
|
||||
|
||||
, systemd ? null
|
||||
, withX ? !stdenv.isDarwin && !withPgtk
|
||||
, withNS ? stdenv.isDarwin
|
||||
, withNS ? stdenv.isDarwin && !withMacport
|
||||
, withMacport ? macportVersion != null
|
||||
, withGTK2 ? false, gtk2-x11 ? null
|
||||
, withGTK3 ? withPgtk, gtk3-x11 ? null, gsettings-desktop-schemas ? null
|
||||
, withXwidgets ? false, webkitgtk ? null, wrapGAppsHook ? null, glib-networking ? null
|
||||
|
@ -44,24 +51,30 @@ assert (libXft != null) -> libpng != null; # probably a bug
|
|||
assert stdenv.isDarwin -> libXaw != null; # fails to link otherwise
|
||||
assert withNS -> !withX;
|
||||
assert withNS -> stdenv.isDarwin;
|
||||
assert (withGTK2 && !withNS) -> withX;
|
||||
assert (withGTK3 && !withNS) -> withX || withPgtk;
|
||||
assert withMacport -> !withNS;
|
||||
assert (withGTK2 && !withNS && !withMacport) -> withX;
|
||||
assert (withGTK3 && !withNS && !withMacport) -> withX || withPgtk;
|
||||
assert withGTK2 -> !withGTK3 && gtk2-x11 != null && !withPgtk;
|
||||
assert withGTK3 -> !withGTK2 && ((gtk3-x11 != null) || withPgtk);
|
||||
assert withPgtk -> withGTK3 && !withX && gtk3 != null;
|
||||
assert withXwidgets -> withGTK3 && webkitgtk != null;
|
||||
|
||||
|
||||
let emacs = stdenv.mkDerivation (lib.optionalAttrs nativeComp {
|
||||
let emacs = (if withMacport then llvmPackages_6.stdenv else stdenv).mkDerivation (lib.optionalAttrs nativeComp {
|
||||
NATIVE_FULL_AOT = "1";
|
||||
LIBRARY_PATH = "${lib.getLib stdenv.cc.libc}/lib";
|
||||
} // {
|
||||
pname = pname + lib.optionalString ( !withX && !withNS && !withGTK2 && !withGTK3 ) "-nox";
|
||||
pname = pname + lib.optionalString ( !withX && !withNS && !withMacport && !withGTK2 && !withGTK3 ) "-nox";
|
||||
inherit version;
|
||||
|
||||
patches = patches fetchpatch;
|
||||
|
||||
src = fetchFromSavannah {
|
||||
src = if macportVersion != null then fetchFromBitbucket {
|
||||
owner = "mituharu";
|
||||
repo = "emacs-mac";
|
||||
rev = macportVersion;
|
||||
inherit sha256;
|
||||
} else fetchFromSavannah {
|
||||
repo = "emacs";
|
||||
rev = version;
|
||||
inherit sha256;
|
||||
|
@ -122,12 +135,13 @@ let emacs = stdenv.mkDerivation (lib.optionalAttrs nativeComp {
|
|||
];
|
||||
|
||||
nativeBuildInputs = [ pkg-config makeWrapper ]
|
||||
++ lib.optionals srcRepo [ autoreconfHook texinfo ]
|
||||
++ lib.optionals (srcRepo || withMacport) [ texinfo ]
|
||||
++ lib.optionals srcRepo [ autoreconfHook ]
|
||||
++ lib.optional (withX && (withGTK3 || withXwidgets)) wrapGAppsHook;
|
||||
|
||||
buildInputs =
|
||||
[ ncurses gconf libxml2 gnutls alsa-lib acl gpm gettext jansson harfbuzz.dev ]
|
||||
++ lib.optionals stdenv.isLinux [ dbus libselinux systemd ]
|
||||
[ ncurses gconf libxml2 gnutls gettext jansson harfbuzz.dev ]
|
||||
++ lib.optionals stdenv.isLinux [ dbus libselinux systemd alsa-lib acl gpm ]
|
||||
++ lib.optionals withX
|
||||
[ xlibsWrapper libXaw Xaw3d libXpm libpng libjpeg giflib libtiff libXft
|
||||
gconf cairo ]
|
||||
|
@ -143,6 +157,11 @@ let emacs = stdenv.mkDerivation (lib.optionalAttrs nativeComp {
|
|||
++ lib.optional withWebP libwebp
|
||||
++ lib.optionals (withX && withXwidgets) [ webkitgtk glib-networking ]
|
||||
++ lib.optionals withNS [ AppKit GSS ImageIO ]
|
||||
++ lib.optionals withMacport [
|
||||
AppKit Carbon Cocoa IOKit OSAKit Quartz QuartzCore WebKit
|
||||
# TODO are these optional?
|
||||
ImageCaptureCore GSS ImageIO
|
||||
]
|
||||
++ lib.optionals stdenv.isDarwin [ sigtool ]
|
||||
++ lib.optionals nativeComp [ libgccjit ];
|
||||
|
||||
|
@ -160,6 +179,12 @@ let emacs = stdenv.mkDerivation (lib.optionalAttrs nativeComp {
|
|||
then [ "--with-x-toolkit=${toolkit}" "--with-xft" "--with-cairo" ]
|
||||
else [ "--with-x=no" "--with-xpm=no" "--with-jpeg=no" "--with-png=no"
|
||||
"--with-gif=no" "--with-tiff=no" ])
|
||||
++ lib.optionals withMacport [
|
||||
"--with-mac"
|
||||
"--enable-mac-app=$$out/Applications"
|
||||
"--with-xml2=yes"
|
||||
"--with-gnutls=yes"
|
||||
]
|
||||
++ lib.optional withXwidgets "--with-xwidgets"
|
||||
++ lib.optional nativeComp "--with-native-compilation"
|
||||
++ lib.optional withImageMagick "--with-imagemagick"
|
||||
|
@ -190,7 +215,7 @@ let emacs = stdenv.mkDerivation (lib.optionalAttrs nativeComp {
|
|||
'' + lib.optionalString withNS ''
|
||||
mkdir -p $out/Applications
|
||||
mv nextstep/Emacs.app $out/Applications
|
||||
'' + lib.optionalString (nativeComp && withNS) ''
|
||||
'' + lib.optionalString (nativeComp && (withNS || withMacport)) ''
|
||||
ln -snf $out/lib/emacs/*/native-lisp $out/Applications/Emacs.app/Contents/native-lisp
|
||||
'' + lib.optionalString nativeComp ''
|
||||
echo "Generating native-compiled trampolines..."
|
||||
|
@ -219,11 +244,11 @@ let emacs = stdenv.mkDerivation (lib.optionalAttrs nativeComp {
|
|||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "The extensible, customizable GNU text editor";
|
||||
homepage = "https://www.gnu.org/software/emacs/";
|
||||
description = "The extensible, customizable GNU text editor" + optionalString withMacport " with Mitsuharu Yamamoto's macport patches";
|
||||
homepage = if withMacport then "https://bitbucket.org/mituharu/emacs-mac/" else "https://www.gnu.org/software/emacs/";
|
||||
license = licenses.gpl3Plus;
|
||||
maintainers = with maintainers; [ lovek323 jwiegley adisbladis ];
|
||||
platforms = platforms.all;
|
||||
maintainers = with maintainers; [ lovek323 jwiegley adisbladis matthewbauer atemu ];
|
||||
platforms = if withMacport then platforms.darwin else platforms.all;
|
||||
|
||||
longDescription = ''
|
||||
GNU Emacs is an extensible, customizable text editor—and more. At its
|
||||
|
|
|
@ -1,123 +1,6 @@
|
|||
{ lib, stdenv, fetchurl, ncurses, pkg-config, texinfo, libxml2, gnutls, gettext, autoconf, automake, jansson
|
||||
, AppKit, Carbon, Cocoa, IOKit, OSAKit, Quartz, QuartzCore, WebKit
|
||||
, ImageCaptureCore, GSS, ImageIO # These may be optional
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "emacs";
|
||||
version = "28.1";
|
||||
|
||||
emacsName = "emacs-${version}";
|
||||
macportVersion = "9.0";
|
||||
name = "emacs-mac-${version}-${macportVersion}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gnu/emacs/${emacsName}.tar.xz";
|
||||
sha256 = "1qbmmmhnjhn4lvzsnyk7l5ganbi6wzbm38jc1a7hhyh3k78b7c98";
|
||||
};
|
||||
|
||||
macportSrc = fetchurl {
|
||||
url = "ftp://ftp.math.s.chiba-u.ac.jp/emacs/${emacsName}-mac-${macportVersion}.tar.gz";
|
||||
sha256 = "10gyynz8wblz6r6dkk12m98kjbsmdwcbrhxpmsjylmdqmjxhlj4m";
|
||||
name = "${emacsName}-mac-${macportVersion}.tar.xz"; # It's actually compressed with xz, not gz
|
||||
};
|
||||
|
||||
hiresSrc = fetchurl {
|
||||
url = "ftp://ftp.math.s.chiba-u.ac.jp/emacs/emacs-hires-icons-3.0.tar.gz";
|
||||
sha256 = "0f2wzdw2a3ac581322b2y79rlj3c9f33ddrq9allj97r1si6v5xk";
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
nativeBuildInputs = [ pkg-config autoconf automake ];
|
||||
|
||||
buildInputs = [ ncurses libxml2 gnutls texinfo gettext jansson
|
||||
AppKit Carbon Cocoa IOKit OSAKit Quartz QuartzCore WebKit
|
||||
ImageCaptureCore GSS ImageIO # may be optional
|
||||
];
|
||||
|
||||
postUnpack = ''
|
||||
mv $sourceRoot $name
|
||||
tar xf $macportSrc -C $name --strip-components=1
|
||||
mv $name $sourceRoot
|
||||
|
||||
# extract retina image resources
|
||||
tar xfv $hiresSrc --strip 1 -C $sourceRoot
|
||||
'';
|
||||
|
||||
postPatch = ''
|
||||
patch -p1 < patch-mac
|
||||
substituteInPlace lisp/international/mule-cmds.el \
|
||||
--replace /usr/share/locale ${gettext}/share/locale
|
||||
|
||||
# use newer emacs icon
|
||||
cp nextstep/Cocoa/Emacs.base/Contents/Resources/Emacs.icns mac/Emacs.app/Contents/Resources/Emacs.icns
|
||||
|
||||
# Fix sandbox impurities.
|
||||
substituteInPlace Makefile.in --replace '/bin/pwd' 'pwd'
|
||||
substituteInPlace lib-src/Makefile.in --replace '/bin/pwd' 'pwd'
|
||||
|
||||
# Reduce closure size by cleaning the environment of the emacs dumper
|
||||
substituteInPlace src/Makefile.in \
|
||||
--replace 'RUN_TEMACS = ./temacs' 'RUN_TEMACS = env -i ./temacs'
|
||||
'';
|
||||
|
||||
configureFlags = [
|
||||
"LDFLAGS=-L${ncurses.out}/lib"
|
||||
"--with-xml2=yes"
|
||||
"--with-gnutls=yes"
|
||||
"--with-mac"
|
||||
"--with-modules"
|
||||
"--enable-mac-app=$$out/Applications"
|
||||
];
|
||||
|
||||
CFLAGS = "-O3";
|
||||
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
|
||||
'';
|
||||
|
||||
# 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;
|
||||
|
||||
meta = with lib; {
|
||||
description = "The extensible, customizable text editor";
|
||||
homepage = "https://www.gnu.org/software/emacs/";
|
||||
license = licenses.gpl3Plus;
|
||||
maintainers = with maintainers; [ jwiegley matthewbauer ];
|
||||
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.
|
||||
|
||||
This is the "Mac port" addition to GNU Emacs. This provides a native
|
||||
GUI support for Mac OS X 10.6 - 10.12. Note that Emacs 23 and later
|
||||
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.
|
||||
'';
|
||||
};
|
||||
import ./generic.nix rec {
|
||||
pname = "emacs-mac";
|
||||
version = "28.2";
|
||||
macportVersion = "emacs-${version}-mac-9.1";
|
||||
sha256 = "sha256-Ne2jQ2nVLNiQmnkkOXVc5AkLVkTpm8pFC7VNY2gQjPE=";
|
||||
}
|
||||
|
|
|
@ -27772,7 +27772,9 @@ with pkgs;
|
|||
alsa-lib = null;
|
||||
acl = null;
|
||||
gpm = null;
|
||||
inherit (darwin.apple_sdk.frameworks) AppKit GSS ImageIO;
|
||||
inherit (darwin.apple_sdk.frameworks)
|
||||
AppKit Carbon Cocoa IOKit OSAKit Quartz QuartzCore WebKit
|
||||
ImageCaptureCore GSS ImageIO;
|
||||
inherit (darwin) sigtool;
|
||||
};
|
||||
|
||||
|
@ -27788,10 +27790,14 @@ with pkgs;
|
|||
});
|
||||
|
||||
emacsMacport = callPackage ../applications/editors/emacs/macport.nix {
|
||||
withMacport = true;
|
||||
|
||||
gconf = null;
|
||||
|
||||
inherit (darwin.apple_sdk.frameworks)
|
||||
AppKit Carbon Cocoa IOKit OSAKit Quartz QuartzCore WebKit
|
||||
ImageCaptureCore GSS ImageIO;
|
||||
stdenv = if stdenv.cc.isClang then llvmPackages_6.stdenv else stdenv;
|
||||
inherit (darwin) sigtool;
|
||||
};
|
||||
|
||||
emacsPackagesFor = emacs: import ./emacs-packages.nix {
|
||||
|
|
Loading…
Reference in a new issue