emacs.scm 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  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 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 Nils Gillmann <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. (define-module (gnu packages emacs)
  35. #:use-module ((guix licenses) #:prefix license:)
  36. #:use-module (guix packages)
  37. #:use-module (guix download)
  38. #:use-module (guix git-download)
  39. #:use-module (guix build-system gnu)
  40. #:use-module (guix build-system glib-or-gtk)
  41. #:use-module (gnu packages)
  42. #:use-module (gnu packages acl)
  43. #:use-module (gnu packages autotools)
  44. #:use-module (gnu packages base)
  45. #:use-module (gnu packages compression)
  46. #:use-module (gnu packages fontutils)
  47. #:use-module (gnu packages fribidi)
  48. #:use-module (gnu packages gd)
  49. #:use-module (gnu packages gettext)
  50. #:use-module (gnu packages glib)
  51. #:use-module (gnu packages gnome) ; for librsvg
  52. #:use-module (gnu packages gtk)
  53. #:use-module (gnu packages guile)
  54. #:use-module (gnu packages image)
  55. #:use-module (gnu packages imagemagick)
  56. #:use-module (gnu packages linux) ; alsa-lib
  57. #:use-module (gnu packages ncurses)
  58. #:use-module (gnu packages pkg-config)
  59. #:use-module (gnu packages texinfo)
  60. #:use-module (gnu packages tls)
  61. #:use-module (gnu packages webkit)
  62. #:use-module (gnu packages xml)
  63. #:use-module (gnu packages xorg)
  64. #:use-module (guix utils)
  65. #:use-module (srfi srfi-1))
  66. (define-public emacs
  67. (package
  68. (name "emacs")
  69. (version "26.1")
  70. (source (origin
  71. (method url-fetch)
  72. (uri (string-append "mirror://gnu/emacs/emacs-"
  73. version ".tar.xz"))
  74. (sha256
  75. (base32
  76. "0b6k1wq44rc8gkvxhi1bbjxbz3cwg29qbq8mklq2az6p1hjgrx0w"))
  77. (patches (search-patches "emacs-exec-path.patch"
  78. "emacs-fix-scheme-indent-function.patch"
  79. "emacs-source-date-epoch.patch"))
  80. (modules '((guix build utils)))
  81. (snippet
  82. ;; Delete the bundled byte-compiled elisp files and
  83. ;; generated autoloads.
  84. '(with-directory-excursion "lisp"
  85. (for-each delete-file
  86. (append (find-files "." "\\.elc$")
  87. (find-files "." "loaddefs\\.el$")
  88. ;; This is the only "autoloads" file that
  89. ;; does not have "*loaddefs.el" name.
  90. '("eshell/esh-groups.el")))
  91. ;; Make sure Tramp looks for binaries in the right places on
  92. ;; remote GuixSD machines, where 'getconf PATH' returns
  93. ;; something bogus.
  94. (substitute* "net/tramp-sh.el"
  95. ;; Patch the line after "(defcustom tramp-remote-path".
  96. (("\\(tramp-default-remote-path")
  97. (format #f "(tramp-default-remote-path ~s ~s ~s ~s "
  98. "~/.guix-profile/bin" "~/.guix-profile/sbin"
  99. "/run/current-system/profile/bin"
  100. "/run/current-system/profile/sbin")))
  101. ;; Make sure Man looks for C header files in the right
  102. ;; places.
  103. (substitute* "man.el"
  104. (("\"/usr/local/include\"" line)
  105. (string-join
  106. (list line
  107. "\"~/.guix-profile/include\""
  108. "\"/var/guix/profiles/system/profile/include\"")
  109. " ")))
  110. #t))))
  111. (build-system glib-or-gtk-build-system)
  112. (arguments
  113. `(#:tests? #f ; no check target
  114. #:phases
  115. (modify-phases %standard-phases
  116. (add-before 'configure 'fix-/bin/pwd
  117. (lambda _
  118. ;; Use `pwd', not `/bin/pwd'.
  119. (substitute* (find-files "." "^Makefile\\.in$")
  120. (("/bin/pwd")
  121. "pwd"))
  122. #t))
  123. (add-after 'install 'install-site-start
  124. ;; Use 'guix-emacs' in "site-start.el". This way, Emacs packages
  125. ;; provided by Guix and installed in
  126. ;; ~/.guix-profile/share/emacs/site-lisp/guix.d/PACKAGE-VERSION are
  127. ;; automatically found.
  128. (lambda* (#:key inputs outputs #:allow-other-keys)
  129. (let* ((out (assoc-ref outputs "out"))
  130. (lisp-dir (string-append out "/share/emacs/site-lisp")))
  131. (copy-file (assoc-ref inputs "guix-emacs.el")
  132. (string-append lisp-dir "/guix-emacs.el"))
  133. (with-output-to-file (string-append lisp-dir "/site-start.el")
  134. (lambda ()
  135. (display
  136. (string-append "(when (require 'guix-emacs nil t)\n"
  137. " (guix-emacs-autoload-packages))\n"))))
  138. #t))))))
  139. (inputs
  140. `(("gnutls" ,gnutls)
  141. ("ncurses" ,ncurses)
  142. ;; TODO: Add the optional dependencies.
  143. ("libx11" ,libx11)
  144. ("gtk+" ,gtk+)
  145. ("libxft" ,libxft)
  146. ("libtiff" ,libtiff)
  147. ("giflib" ,giflib)
  148. ("libjpeg" ,libjpeg)
  149. ("imagemagick" ,imagemagick)
  150. ("acl" ,acl)
  151. ;; When looking for libpng `configure' links with `-lpng -lz', so we
  152. ;; must also provide zlib as an input.
  153. ("libpng" ,libpng)
  154. ("zlib" ,zlib)
  155. ("librsvg" ,librsvg)
  156. ("libxpm" ,libxpm)
  157. ("libxml2" ,libxml2)
  158. ("libice" ,libice)
  159. ("libsm" ,libsm)
  160. ("alsa-lib" ,alsa-lib)
  161. ("dbus" ,dbus)
  162. ;; multilingualization support
  163. ("libotf" ,libotf)
  164. ("m17n-lib" ,m17n-lib)))
  165. (native-inputs
  166. `(("guix-emacs.el" ,(search-auxiliary-file "emacs/guix-emacs.el"))
  167. ("pkg-config" ,pkg-config)
  168. ("texinfo" ,texinfo)))
  169. (native-search-paths
  170. (list (search-path-specification
  171. (variable "INFOPATH")
  172. (files '("share/info")))))
  173. (home-page "https://www.gnu.org/software/emacs/")
  174. (synopsis "The extensible, customizable, self-documenting text editor")
  175. (description
  176. "GNU Emacs is an extensible and highly customizable text editor. It is
  177. based on an Emacs Lisp interpreter with extensions for text editing. Emacs
  178. has been extended in essentially all areas of computing, giving rise to a
  179. vast array of packages supporting, e.g., email, IRC and XMPP messaging,
  180. spreadsheets, remote server editing, and much more. Emacs includes extensive
  181. documentation on all aspects of the system, from basic editing to writing
  182. large Lisp programs. It has full Unicode support for nearly all human
  183. languages.")
  184. (license license:gpl3+)))
  185. (define-public emacs-minimal
  186. ;; This is the version that you should use as an input to packages that just
  187. ;; need to byte-compile .el files.
  188. (package (inherit emacs)
  189. (name "emacs-minimal")
  190. (synopsis "The extensible text editor (used only for byte-compilation)")
  191. (build-system gnu-build-system)
  192. (arguments
  193. `(#:configure-flags (list "--with-gnutls=no")
  194. ,@(substitute-keyword-arguments (package-arguments emacs)
  195. ((#:phases phases)
  196. `(modify-phases ,phases
  197. (delete 'install-site-start))))))
  198. (inputs
  199. `(("ncurses" ,ncurses)))
  200. (native-inputs
  201. `(("pkg-config" ,pkg-config)))))
  202. (define-public emacs-xwidgets
  203. (package
  204. (inherit emacs)
  205. (name "emacs-xwidgets")
  206. (synopsis "The extensible, customizable, self-documenting text
  207. editor (with xwidgets support)")
  208. (build-system gnu-build-system)
  209. (arguments
  210. `(#:configure-flags
  211. '("--with-xwidgets")
  212. ,@(package-arguments emacs)))
  213. (inputs
  214. `(("webkitgtk" ,webkitgtk)
  215. ("libxcomposite" ,libxcomposite)
  216. ,@(package-inputs emacs)))))
  217. (define-public emacs-no-x
  218. (package (inherit emacs)
  219. (name "emacs-no-x")
  220. (synopsis "The extensible, customizable, self-documenting text
  221. editor (console only)")
  222. (build-system gnu-build-system)
  223. (inputs (fold alist-delete
  224. (package-inputs emacs)
  225. '("libx11" "gtk+" "libxft" "libtiff" "giflib" "libjpeg"
  226. "imagemagick" "libpng" "librsvg" "libxpm" "libice"
  227. "libsm"
  228. ;; These depend on libx11, so remove them as well.
  229. "libotf" "m17n-lib" "dbus")))))
  230. (define-public emacs-no-x-toolkit
  231. (package (inherit emacs)
  232. (name "emacs-no-x-toolkit")
  233. (synopsis "The extensible, customizable, self-documenting text
  234. editor (without an X toolkit)" )
  235. (build-system gnu-build-system)
  236. (inputs (append `(("inotify-tools" ,inotify-tools))
  237. (alist-delete "gtk+" (package-inputs emacs))))
  238. (arguments (append '(#:configure-flags '("--with-x-toolkit=no"))
  239. (package-arguments emacs)))))
  240. (define-public guile-emacs
  241. (package (inherit emacs)
  242. (name "guile-emacs")
  243. (version "20150512.41120e0")
  244. (source (origin
  245. (method git-fetch)
  246. (uri (git-reference
  247. (url "git://git.hcoop.net/git/bpt/emacs.git")
  248. (commit "41120e0f595b16387eebfbf731fff70481de1b4b")))
  249. (file-name (string-append name "-" version "-checkout"))
  250. (patches (search-patches "guile-emacs-fix-configure.patch"))
  251. (sha256
  252. (base32
  253. "0lvcvsz0f4mawj04db35p1dvkffdqkz8pkhc0jzh9j9x2i63kcz6"))))
  254. (native-inputs
  255. `(("autoconf" ,autoconf)
  256. ("automake" ,automake)
  257. ("guile" ,guile-for-guile-emacs)
  258. ,@(package-native-inputs emacs)))
  259. (arguments
  260. (substitute-keyword-arguments `(;; Build fails if we allow parallel build.
  261. #:parallel-build? #f
  262. ;; Tests aren't passing for now.
  263. #:tests? #f
  264. ,@(package-arguments emacs))
  265. ((#:phases phases)
  266. `(modify-phases ,phases
  267. (add-after 'unpack 'autogen
  268. (lambda _
  269. (invoke "sh" "autogen.sh")))
  270. ;; Build sometimes fails: deps/dispnew.d: No such file or directory
  271. (add-before 'build 'make-deps-dir
  272. (lambda _
  273. (invoke "mkdir" "-p" "src/deps")))))))))
  274. (define-public m17n-db
  275. (package
  276. (name "m17n-db")
  277. (version "1.8.0")
  278. (source
  279. (origin
  280. (method url-fetch)
  281. (uri (string-append "mirror://savannah/m17n/m17n-db-"
  282. version ".tar.gz"))
  283. (sha256
  284. (base32
  285. "0vfw7z9i2s9np6nmx1d4dlsywm044rkaqarn7akffmb6bf1j6zv5"))))
  286. (build-system gnu-build-system)
  287. (inputs
  288. `(("gettext" ,gettext-minimal)))
  289. (arguments
  290. `(#:configure-flags
  291. (list (string-append "--with-charmaps="
  292. (assoc-ref %build-inputs "libc")
  293. "/share/i18n/charmaps"))))
  294. ;; With `guix lint' the home-page URI returns a small page saying
  295. ;; that your browser does not handle frames. This triggers the "URI
  296. ;; returns suspiciously small file" warning.
  297. (home-page "https://www.nongnu.org/m17n/")
  298. (synopsis "Multilingual text processing library (database)")
  299. (description "The m17n library realizes multilingualization of
  300. many aspects of applications. The m17n library represents
  301. multilingual text as an object named M-text. M-text is a string with
  302. attributes called text properties, and designed to substitute for
  303. string in C. Text properties carry any information required to input,
  304. display and edit the text.
  305. This package contains the library database.")
  306. (license license:lgpl2.1+)))
  307. (define-public m17n-lib
  308. (package
  309. (name "m17n-lib")
  310. (version "1.8.0")
  311. (source
  312. (origin
  313. (method url-fetch)
  314. (uri (string-append "mirror://savannah/m17n/m17n-lib-"
  315. version ".tar.gz"))
  316. (sha256
  317. (base32
  318. "0jp61y09xqj10mclpip48qlfhniw8gwy8b28cbzxy8hq8pkwmfkq"))))
  319. (build-system gnu-build-system)
  320. (inputs
  321. `(("fribidi" ,fribidi)
  322. ("gd" ,gd)
  323. ("libotf" ,libotf)
  324. ("libxft" ,libxft)
  325. ("libxml2" ,libxml2)
  326. ("m17n-db" ,m17n-db)))
  327. (arguments
  328. `(#:parallel-build? #f))
  329. ;; With `guix lint' the home-page URI returns a small page saying
  330. ;; that your browser does not handle frames. This triggers the "URI
  331. ;; returns suspiciously small file" warning.
  332. (home-page "https://www.nongnu.org/m17n/")
  333. (synopsis "Multilingual text processing library (runtime)")
  334. (description "The m17n library realizes multilingualization of
  335. many aspects of applications. The m17n library represents
  336. multilingual text as an object named M-text. M-text is a string with
  337. attributes called text properties, and designed to substitute for
  338. string in C. Text properties carry any information required to input,
  339. display and edit the text.
  340. This package contains the library runtime.")
  341. (license license:lgpl2.1+)))