| 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr> |
| 4 | ;;; Copyright © 2014 Taylan Ulrich Bayirli/Kammer <taylanbayirli@gmail.com> |
| 5 | ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mark H Weaver <mhw@netris.org> |
| 6 | ;;; Copyright © 2014, 2015, 2016, 2017 Alex Kost <alezost@gmail.com> |
| 7 | ;;; Copyright © 2016, 2018 Arun Isaac <arunisaac@systemreboot.net> |
| 8 | ;;; Copyright © 2016 Federico Beffa <beffa@fbengineering.ch> |
| 9 | ;;; Copyright © 2016 David Thompson <dthompson2@worcester.edu> |
| 10 | ;;; Copyright © 2016 ng0 <ng0@n0.is> |
| 11 | ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com> |
| 12 | ;;; Copyright © 2017 Maxim Cournoyer <maxim.cournoyer@gmail.com> |
| 13 | ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com> |
| 14 | ;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net> |
| 15 | ;;; Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org> |
| 16 | ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il> |
| 17 | ;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com> |
| 18 | ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr> |
| 19 | ;;; |
| 20 | ;;; This file is part of GNU Guix. |
| 21 | ;;; |
| 22 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
| 23 | ;;; under the terms of the GNU General Public License as published by |
| 24 | ;;; the Free Software Foundation; either version 3 of the License, or (at |
| 25 | ;;; your option) any later version. |
| 26 | ;;; |
| 27 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
| 28 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 29 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 30 | ;;; GNU General Public License for more details. |
| 31 | ;;; |
| 32 | ;;; You should have received a copy of the GNU General Public License |
| 33 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
| 34 | |
| 35 | (define-module (gnu packages emacs) |
| 36 | #:use-module ((guix licenses) #:prefix license:) |
| 37 | #:use-module (guix packages) |
| 38 | #:use-module (guix download) |
| 39 | #:use-module (guix git-download) |
| 40 | #:use-module (guix build-system gnu) |
| 41 | #:use-module (guix build-system glib-or-gtk) |
| 42 | #:use-module (gnu packages) |
| 43 | #:use-module (gnu packages acl) |
| 44 | #:use-module (gnu packages autotools) |
| 45 | #:use-module (gnu packages base) |
| 46 | #:use-module (gnu packages compression) |
| 47 | #:use-module (gnu packages fontutils) |
| 48 | #:use-module (gnu packages fribidi) |
| 49 | #:use-module (gnu packages gd) |
| 50 | #:use-module (gnu packages gettext) |
| 51 | #:use-module (gnu packages glib) |
| 52 | #:use-module (gnu packages gnome) ; for librsvg |
| 53 | #:use-module (gnu packages gtk) |
| 54 | #:use-module (gnu packages guile) |
| 55 | #:use-module (gnu packages image) |
| 56 | #:use-module (gnu packages imagemagick) |
| 57 | #:use-module (gnu packages linux) ; alsa-lib |
| 58 | #:use-module (gnu packages ncurses) |
| 59 | #:use-module (gnu packages pkg-config) |
| 60 | #:use-module (gnu packages texinfo) |
| 61 | #:use-module (gnu packages tls) |
| 62 | #:use-module (gnu packages webkit) |
| 63 | #:use-module (gnu packages xml) |
| 64 | #:use-module (gnu packages xorg) |
| 65 | #:use-module (guix utils) |
| 66 | #:use-module (srfi srfi-1)) |
| 67 | |
| 68 | (define-public emacs |
| 69 | (package |
| 70 | (name "emacs") |
| 71 | (version "26.2") |
| 72 | (source (origin |
| 73 | (method url-fetch) |
| 74 | (uri (string-append "mirror://gnu/emacs/emacs-" |
| 75 | version ".tar.xz")) |
| 76 | (sha256 |
| 77 | (base32 |
| 78 | "13n5m60i47k96mpv5pp6km2ph9rv2m5lmbpzj929v02vpsfyc70m")) |
| 79 | (patches (search-patches "emacs-exec-path.patch" |
| 80 | "emacs-fix-scheme-indent-function.patch" |
| 81 | "emacs-source-date-epoch.patch")) |
| 82 | (modules '((guix build utils))) |
| 83 | (snippet |
| 84 | ;; Delete the bundled byte-compiled elisp files and |
| 85 | ;; generated autoloads. |
| 86 | '(with-directory-excursion "lisp" |
| 87 | (for-each delete-file |
| 88 | (append (find-files "." "\\.elc$") |
| 89 | (find-files "." "loaddefs\\.el$") |
| 90 | ;; This is the only "autoloads" file that |
| 91 | ;; does not have "*loaddefs.el" name. |
| 92 | '("eshell/esh-groups.el"))) |
| 93 | |
| 94 | ;; Make sure Tramp looks for binaries in the right places on |
| 95 | ;; remote Guix System machines, where 'getconf PATH' returns |
| 96 | ;; something bogus. |
| 97 | (substitute* "net/tramp-sh.el" |
| 98 | ;; Patch the line after "(defcustom tramp-remote-path". |
| 99 | (("\\(tramp-default-remote-path") |
| 100 | (format #f "(tramp-default-remote-path ~s ~s ~s ~s " |
| 101 | "~/.guix-profile/bin" "~/.guix-profile/sbin" |
| 102 | "/run/current-system/profile/bin" |
| 103 | "/run/current-system/profile/sbin"))) |
| 104 | |
| 105 | ;; Make sure Man looks for C header files in the right |
| 106 | ;; places. |
| 107 | (substitute* "man.el" |
| 108 | (("\"/usr/local/include\"" line) |
| 109 | (string-join |
| 110 | (list line |
| 111 | "\"~/.guix-profile/include\"" |
| 112 | "\"/var/guix/profiles/system/profile/include\"") |
| 113 | " "))) |
| 114 | #t)))) |
| 115 | (build-system glib-or-gtk-build-system) |
| 116 | (arguments |
| 117 | `(#:tests? #f ; no check target |
| 118 | #:configure-flags (list "--with-modules") |
| 119 | #:phases |
| 120 | (modify-phases %standard-phases |
| 121 | (add-before 'configure 'fix-/bin/pwd |
| 122 | (lambda _ |
| 123 | ;; Use `pwd', not `/bin/pwd'. |
| 124 | (substitute* (find-files "." "^Makefile\\.in$") |
| 125 | (("/bin/pwd") |
| 126 | "pwd")) |
| 127 | #t)) |
| 128 | (add-after 'install 'install-site-start |
| 129 | ;; Use 'guix-emacs' in "site-start.el". This way, Emacs packages |
| 130 | ;; provided by Guix and installed in |
| 131 | ;; ~/.guix-profile/share/emacs/site-lisp/guix.d/PACKAGE-VERSION are |
| 132 | ;; automatically found. |
| 133 | (lambda* (#:key inputs outputs #:allow-other-keys) |
| 134 | (let* ((out (assoc-ref outputs "out")) |
| 135 | (lisp-dir (string-append out "/share/emacs/site-lisp"))) |
| 136 | (copy-file (assoc-ref inputs "guix-emacs.el") |
| 137 | (string-append lisp-dir "/guix-emacs.el")) |
| 138 | (with-output-to-file (string-append lisp-dir "/site-start.el") |
| 139 | (lambda () |
| 140 | (display |
| 141 | (string-append "(when (require 'guix-emacs nil t)\n" |
| 142 | " (guix-emacs-autoload-packages))\n")))) |
| 143 | #t)))))) |
| 144 | (inputs |
| 145 | `(("gnutls" ,gnutls) |
| 146 | ("ncurses" ,ncurses) |
| 147 | |
| 148 | ;; TODO: Add the optional dependencies. |
| 149 | ("libx11" ,libx11) |
| 150 | ("gtk+" ,gtk+) |
| 151 | ("libxft" ,libxft) |
| 152 | ("libtiff" ,libtiff) |
| 153 | ("giflib" ,giflib) |
| 154 | ("libjpeg" ,libjpeg) |
| 155 | ("imagemagick" ,imagemagick) |
| 156 | ("acl" ,acl) |
| 157 | |
| 158 | ;; When looking for libpng `configure' links with `-lpng -lz', so we |
| 159 | ;; must also provide zlib as an input. |
| 160 | ("libpng" ,libpng) |
| 161 | ("zlib" ,zlib) |
| 162 | |
| 163 | ("librsvg" ,librsvg) |
| 164 | ("libxpm" ,libxpm) |
| 165 | ("libxml2" ,libxml2) |
| 166 | ("libice" ,libice) |
| 167 | ("libsm" ,libsm) |
| 168 | ("alsa-lib" ,alsa-lib) |
| 169 | ("dbus" ,dbus) |
| 170 | |
| 171 | ;; multilingualization support |
| 172 | ("libotf" ,libotf) |
| 173 | ("m17n-lib" ,m17n-lib))) |
| 174 | (native-inputs |
| 175 | `(("guix-emacs.el" ,(search-auxiliary-file "emacs/guix-emacs.el")) |
| 176 | ("pkg-config" ,pkg-config) |
| 177 | ("texinfo" ,texinfo))) |
| 178 | |
| 179 | (native-search-paths |
| 180 | (list (search-path-specification |
| 181 | (variable "INFOPATH") |
| 182 | (files '("share/info"))))) |
| 183 | |
| 184 | (home-page "https://www.gnu.org/software/emacs/") |
| 185 | (synopsis "The extensible, customizable, self-documenting text editor") |
| 186 | (description |
| 187 | "GNU Emacs is an extensible and highly customizable text editor. It is |
| 188 | based on an Emacs Lisp interpreter with extensions for text editing. Emacs |
| 189 | has been extended in essentially all areas of computing, giving rise to a |
| 190 | vast array of packages supporting, e.g., email, IRC and XMPP messaging, |
| 191 | spreadsheets, remote server editing, and much more. Emacs includes extensive |
| 192 | documentation on all aspects of the system, from basic editing to writing |
| 193 | large Lisp programs. It has full Unicode support for nearly all human |
| 194 | languages.") |
| 195 | (license license:gpl3+))) |
| 196 | |
| 197 | (define-public emacs-minimal |
| 198 | ;; This is the version that you should use as an input to packages that just |
| 199 | ;; need to byte-compile .el files. |
| 200 | (package (inherit emacs) |
| 201 | (name "emacs-minimal") |
| 202 | (synopsis "The extensible text editor (used only for byte-compilation)") |
| 203 | (build-system gnu-build-system) |
| 204 | (arguments |
| 205 | `(,@(substitute-keyword-arguments (package-arguments emacs) |
| 206 | ((#:phases phases) |
| 207 | `(modify-phases ,phases |
| 208 | (delete 'install-site-start)))) |
| 209 | #:configure-flags (list "--with-gnutls=no"))) |
| 210 | (inputs |
| 211 | `(("ncurses" ,ncurses))) |
| 212 | (native-inputs |
| 213 | `(("pkg-config" ,pkg-config))))) |
| 214 | |
| 215 | (define-public emacs-xwidgets |
| 216 | (package |
| 217 | (inherit emacs) |
| 218 | (name "emacs-xwidgets") |
| 219 | (synopsis "The extensible, customizable, self-documenting text |
| 220 | editor (with xwidgets support)") |
| 221 | (build-system gnu-build-system) |
| 222 | (arguments |
| 223 | `(#:configure-flags |
| 224 | '("--with-xwidgets") |
| 225 | ,@(package-arguments emacs))) |
| 226 | (inputs |
| 227 | `(("webkitgtk" ,webkitgtk) |
| 228 | ("libxcomposite" ,libxcomposite) |
| 229 | ,@(package-inputs emacs))))) |
| 230 | |
| 231 | (define-public emacs-no-x |
| 232 | (package (inherit emacs) |
| 233 | (name "emacs-no-x") |
| 234 | (synopsis "The extensible, customizable, self-documenting text |
| 235 | editor (console only)") |
| 236 | (build-system gnu-build-system) |
| 237 | (inputs (fold alist-delete |
| 238 | (package-inputs emacs) |
| 239 | '("libx11" "gtk+" "libxft" "libtiff" "giflib" "libjpeg" |
| 240 | "imagemagick" "libpng" "librsvg" "libxpm" "libice" |
| 241 | "libsm" |
| 242 | |
| 243 | ;; These depend on libx11, so remove them as well. |
| 244 | "libotf" "m17n-lib" "dbus"))))) |
| 245 | |
| 246 | (define-public emacs-no-x-toolkit |
| 247 | (package (inherit emacs) |
| 248 | (name "emacs-no-x-toolkit") |
| 249 | (synopsis "The extensible, customizable, self-documenting text |
| 250 | editor (without an X toolkit)" ) |
| 251 | (build-system gnu-build-system) |
| 252 | (inputs (append `(("inotify-tools" ,inotify-tools)) |
| 253 | (alist-delete "gtk+" (package-inputs emacs)))) |
| 254 | (arguments |
| 255 | `(,@(substitute-keyword-arguments (package-arguments emacs) |
| 256 | ((#:configure-flags cf) |
| 257 | `(cons "--with-x-toolkit=no" ,cf))))))) |
| 258 | |
| 259 | (define-public guile-emacs |
| 260 | (let ((commit "41120e0f595b16387eebfbf731fff70481de1b4b") |
| 261 | (revision "0")) |
| 262 | (package (inherit emacs) |
| 263 | (name "guile-emacs") |
| 264 | (version (git-version "0.0.0" revision commit)) |
| 265 | (source (origin |
| 266 | (method git-fetch) |
| 267 | (uri (git-reference |
| 268 | (url "https://git.hcoop.net/git/bpt/emacs.git") |
| 269 | (commit commit))) |
| 270 | (file-name (git-file-name name version)) |
| 271 | (patches (search-patches "guile-emacs-fix-configure.patch")) |
| 272 | (sha256 |
| 273 | (base32 |
| 274 | "0lvcvsz0f4mawj04db35p1dvkffdqkz8pkhc0jzh9j9x2i63kcz6")))) |
| 275 | (native-inputs |
| 276 | `(("autoconf" ,autoconf) |
| 277 | ("automake" ,automake) |
| 278 | ("guile" ,guile-for-guile-emacs) |
| 279 | ,@(package-native-inputs emacs))) |
| 280 | (arguments |
| 281 | (substitute-keyword-arguments `(;; Build fails if we allow parallel build. |
| 282 | #:parallel-build? #f |
| 283 | ;; Tests aren't passing for now. |
| 284 | #:tests? #f |
| 285 | ,@(package-arguments emacs)) |
| 286 | ((#:phases phases) |
| 287 | `(modify-phases ,phases |
| 288 | (add-after 'unpack 'autogen |
| 289 | (lambda _ |
| 290 | (invoke "sh" "autogen.sh"))) |
| 291 | ;; Build sometimes fails: deps/dispnew.d: No such file or directory |
| 292 | (add-before 'build 'make-deps-dir |
| 293 | (lambda _ |
| 294 | (invoke "mkdir" "-p" "src/deps")))))))))) |
| 295 | |
| 296 | (define-public m17n-db |
| 297 | (package |
| 298 | (name "m17n-db") |
| 299 | (version "1.8.0") |
| 300 | (source |
| 301 | (origin |
| 302 | (method url-fetch) |
| 303 | (uri (string-append "mirror://savannah/m17n/m17n-db-" |
| 304 | version ".tar.gz")) |
| 305 | (sha256 |
| 306 | (base32 |
| 307 | "0vfw7z9i2s9np6nmx1d4dlsywm044rkaqarn7akffmb6bf1j6zv5")))) |
| 308 | (build-system gnu-build-system) |
| 309 | (inputs |
| 310 | `(("gettext" ,gettext-minimal))) |
| 311 | (arguments |
| 312 | `(#:configure-flags |
| 313 | (list (string-append "--with-charmaps=" |
| 314 | (assoc-ref %build-inputs "libc") |
| 315 | "/share/i18n/charmaps")))) |
| 316 | ;; With `guix lint' the home-page URI returns a small page saying |
| 317 | ;; that your browser does not handle frames. This triggers the "URI |
| 318 | ;; returns suspiciously small file" warning. |
| 319 | (home-page "https://www.nongnu.org/m17n/") |
| 320 | (synopsis "Multilingual text processing library (database)") |
| 321 | (description "The m17n library realizes multilingualization of |
| 322 | many aspects of applications. The m17n library represents |
| 323 | multilingual text as an object named M-text. M-text is a string with |
| 324 | attributes called text properties, and designed to substitute for |
| 325 | string in C. Text properties carry any information required to input, |
| 326 | display and edit the text. |
| 327 | |
| 328 | This package contains the library database.") |
| 329 | (license license:lgpl2.1+))) |
| 330 | |
| 331 | (define-public m17n-lib |
| 332 | (package |
| 333 | (name "m17n-lib") |
| 334 | (version "1.8.0") |
| 335 | (source |
| 336 | (origin |
| 337 | (method url-fetch) |
| 338 | (uri (string-append "mirror://savannah/m17n/m17n-lib-" |
| 339 | version ".tar.gz")) |
| 340 | (sha256 |
| 341 | (base32 |
| 342 | "0jp61y09xqj10mclpip48qlfhniw8gwy8b28cbzxy8hq8pkwmfkq")))) |
| 343 | (build-system gnu-build-system) |
| 344 | (inputs |
| 345 | `(("fribidi" ,fribidi) |
| 346 | ("gd" ,gd) |
| 347 | ("libotf" ,libotf) |
| 348 | ("libxft" ,libxft) |
| 349 | ("libxml2" ,libxml2) |
| 350 | ("m17n-db" ,m17n-db))) |
| 351 | (arguments |
| 352 | `(#:parallel-build? #f)) |
| 353 | ;; With `guix lint' the home-page URI returns a small page saying |
| 354 | ;; that your browser does not handle frames. This triggers the "URI |
| 355 | ;; returns suspiciously small file" warning. |
| 356 | (home-page "https://www.nongnu.org/m17n/") |
| 357 | (synopsis "Multilingual text processing library (runtime)") |
| 358 | (description "The m17n library realizes multilingualization of |
| 359 | many aspects of applications. The m17n library represents |
| 360 | multilingual text as an object named M-text. M-text is a string with |
| 361 | attributes called text properties, and designed to substitute for |
| 362 | string in C. Text properties carry any information required to input, |
| 363 | display and edit the text. |
| 364 | |
| 365 | This package contains the library runtime.") |
| 366 | (license license:lgpl2.1+))) |