diff --git a/pkgs/applications/editors/emacs-22/builder.sh b/pkgs/applications/editors/emacs-22/builder.sh new file mode 100644 index 00000000000..7a82f6552ef --- /dev/null +++ b/pkgs/applications/editors/emacs-22/builder.sh @@ -0,0 +1,27 @@ +source $stdenv/setup + +preConfigure() { + libc=$(cat ${NIX_GCC}/nix-support/orig-libc) + echo "libc: $libc" + + case "${system}" in + x86_64-*) glibclibdir=lib64 ;; + *) glibclibdir=lib ;; + esac + + for i in src/s/*.h src/m/*.h; do + substituteInPlace $i \ + --replace /usr/${glibclibdir}/crt1.o $libc/${glibclibdir}/crt1.o \ + --replace /usr/${glibclibdir}/crti.o $libc/${glibclibdir}/crti.o \ + --replace /usr/${glibclibdir}/crtn.o $libc/${glibclibdir}/crtn.o \ + --replace /usr/lib/crt1.o $libc/${glibclibdir}/crt1.o \ + --replace /usr/lib/crti.o $libc/${glibclibdir}/crti.o \ + --replace /usr/lib/crtn.o $libc/${glibclibdir}/crtn.o + done + + for i in Makefile.in ./src/Makefile.in ./lib-src/Makefile.in ./leim/Makefile.in; do + substituteInPlace $i --replace /bin/pwd pwd + done +} + +genericBuild diff --git a/pkgs/applications/editors/emacs-22/default.nix b/pkgs/applications/editors/emacs-22/default.nix new file mode 100644 index 00000000000..da3c4babbf6 --- /dev/null +++ b/pkgs/applications/editors/emacs-22/default.nix @@ -0,0 +1,48 @@ +{ xawSupport ? true +, xpmSupport ? true +, xaw3dSupport ? false +, gtkGUI ? false +, stdenv, fetchurl, x11, libXaw ? null, libXpm ? null, Xaw3d ? null +, pkgconfig ? null, gtk ? null +, ncurses +}: + +assert xawSupport && !xaw3dSupport -> libXaw != null; +assert xawSupport && xaw3dSupport -> Xaw3d != null; +assert xpmSupport -> libXpm != null; +assert gtkGUI -> pkgconfig != null && gtk != null; + +stdenv.mkDerivation rec { + name = "emacs-22.3"; + + builder = ./builder.sh; + + src = fetchurl { + url = "mirror://gnu/emacs/${name}.tar.gz"; + sha256 = "05hd89bchcpwzcx5la0alcp0wb7xywvnf98dxrshrqlfvccvgnbv"; + }; + + buildInputs = [ncurses x11] + ++ stdenv.lib.optional xawSupport (if xaw3dSupport then Xaw3d else libXaw) + ++ stdenv.lib.optional xpmSupport libXpm + ++ stdenv.lib.optionals gtkGUI [pkgconfig gtk]; + + configureFlags = + stdenv.lib.optional gtkGUI "--with-x-toolkit=gtk"; + + meta = { + description = "GNU Emacs, *the* text editor"; + + 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. + ''; + + homepage = http://www.gnu.org/software/emacs/; + license = "GPLv3+"; + + platforms = stdenv.lib.platforms.linux; # GTK & co. are needed. + }; +} diff --git a/pkgs/lib/attrsets.nix b/pkgs/lib/attrsets.nix index 72904458665..53d13e42d85 100644 --- a/pkgs/lib/attrsets.nix +++ b/pkgs/lib/attrsets.nix @@ -22,6 +22,7 @@ rec { then attrByPath (tail attrPath) default (getAttr attr e) else default; + /* Return nested attribute set in which an attribute is set. For instance ["x" "y"] applied with some value v returns `x.y = v;' */ setAttrByPath = attrPath: value: diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 691656ba221..07e94129822 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6489,6 +6489,14 @@ let emacs = emacs23; + emacs22 = import ../applications/editors/emacs-22 { + inherit fetchurl stdenv ncurses pkgconfig x11 Xaw3d; + inherit (xlibs) libXaw libXpm; + inherit (gtkLibs) gtk; + xaw3dSupport = getPkgConfig "emacs" "xaw3dSupport" false; + gtkGUI = getPkgConfig "emacs" "gtkSupport" true; + }; + emacs23 = import ../applications/editors/emacs-23 { inherit fetchurl stdenv ncurses pkgconfig x11 Xaw3d libpng libjpeg libungif libtiff texinfo dbus; @@ -6582,6 +6590,7 @@ let }; }); + emacs22Packages = emacsPackages emacs22; emacs23Packages = emacsPackages emacs23; evince = makeOverridable (import ../applications/misc/evince) { diff --git a/pkgs/top-level/release.nix b/pkgs/top-level/release.nix index 83891984096..060f389e9e0 100644 --- a/pkgs/top-level/release.nix +++ b/pkgs/top-level/release.nix @@ -146,6 +146,7 @@ in { e2fsprogs = linux; ejabberd = linux; elinks = linux; + emacs22 = gtkSupported; emacs23 = gtkSupported; enscript = all; eprover = linux; @@ -435,13 +436,16 @@ in { tools = linux; }; - emacs23Packages = { + emacs22Packages = { bbdb = linux; cedet = linux; ecb = linux; emacsw3m = linux; emms = linux; nxml = all; + }; + + emacs23Packages = emacs22Packages // { jdee = linux; };