gnu: emacs-minimal: Don't inherit configure-flags.
[jackhill/guix/guix.git] / gnu / packages / emacs.scm
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
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.1")
72 (source (origin
73 (method url-fetch)
74 (uri (string-append "mirror://gnu/emacs/emacs-"
75 version ".tar.xz"))
76 (sha256
77 (base32
78 "0b6k1wq44rc8gkvxhi1bbjxbz3cwg29qbq8mklq2az6p1hjgrx0w"))
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 GuixSD 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 (append '(#:configure-flags '("--with-x-toolkit=no"))
255 (package-arguments emacs)))))
256
257 (define-public guile-emacs
258 (let ((commit "41120e0f595b16387eebfbf731fff70481de1b4b")
259 (revision "0"))
260 (package (inherit emacs)
261 (name "guile-emacs")
262 (version (git-version "0.0.0" revision commit))
263 (source (origin
264 (method git-fetch)
265 (uri (git-reference
266 (url "https://git.hcoop.net/git/bpt/emacs.git")
267 (commit commit)))
268 (file-name (git-file-name name version))
269 (patches (search-patches "guile-emacs-fix-configure.patch"))
270 (sha256
271 (base32
272 "0lvcvsz0f4mawj04db35p1dvkffdqkz8pkhc0jzh9j9x2i63kcz6"))))
273 (native-inputs
274 `(("autoconf" ,autoconf)
275 ("automake" ,automake)
276 ("guile" ,guile-for-guile-emacs)
277 ,@(package-native-inputs emacs)))
278 (arguments
279 (substitute-keyword-arguments `(;; Build fails if we allow parallel build.
280 #:parallel-build? #f
281 ;; Tests aren't passing for now.
282 #:tests? #f
283 ,@(package-arguments emacs))
284 ((#:phases phases)
285 `(modify-phases ,phases
286 (add-after 'unpack 'autogen
287 (lambda _
288 (invoke "sh" "autogen.sh")))
289 ;; Build sometimes fails: deps/dispnew.d: No such file or directory
290 (add-before 'build 'make-deps-dir
291 (lambda _
292 (invoke "mkdir" "-p" "src/deps"))))))))))
293
294 (define-public m17n-db
295 (package
296 (name "m17n-db")
297 (version "1.8.0")
298 (source
299 (origin
300 (method url-fetch)
301 (uri (string-append "mirror://savannah/m17n/m17n-db-"
302 version ".tar.gz"))
303 (sha256
304 (base32
305 "0vfw7z9i2s9np6nmx1d4dlsywm044rkaqarn7akffmb6bf1j6zv5"))))
306 (build-system gnu-build-system)
307 (inputs
308 `(("gettext" ,gettext-minimal)))
309 (arguments
310 `(#:configure-flags
311 (list (string-append "--with-charmaps="
312 (assoc-ref %build-inputs "libc")
313 "/share/i18n/charmaps"))))
314 ;; With `guix lint' the home-page URI returns a small page saying
315 ;; that your browser does not handle frames. This triggers the "URI
316 ;; returns suspiciously small file" warning.
317 (home-page "https://www.nongnu.org/m17n/")
318 (synopsis "Multilingual text processing library (database)")
319 (description "The m17n library realizes multilingualization of
320 many aspects of applications. The m17n library represents
321 multilingual text as an object named M-text. M-text is a string with
322 attributes called text properties, and designed to substitute for
323 string in C. Text properties carry any information required to input,
324 display and edit the text.
325
326 This package contains the library database.")
327 (license license:lgpl2.1+)))
328
329 (define-public m17n-lib
330 (package
331 (name "m17n-lib")
332 (version "1.8.0")
333 (source
334 (origin
335 (method url-fetch)
336 (uri (string-append "mirror://savannah/m17n/m17n-lib-"
337 version ".tar.gz"))
338 (sha256
339 (base32
340 "0jp61y09xqj10mclpip48qlfhniw8gwy8b28cbzxy8hq8pkwmfkq"))))
341 (build-system gnu-build-system)
342 (inputs
343 `(("fribidi" ,fribidi)
344 ("gd" ,gd)
345 ("libotf" ,libotf)
346 ("libxft" ,libxft)
347 ("libxml2" ,libxml2)
348 ("m17n-db" ,m17n-db)))
349 (arguments
350 `(#:parallel-build? #f))
351 ;; With `guix lint' the home-page URI returns a small page saying
352 ;; that your browser does not handle frames. This triggers the "URI
353 ;; returns suspiciously small file" warning.
354 (home-page "https://www.nongnu.org/m17n/")
355 (synopsis "Multilingual text processing library (runtime)")
356 (description "The m17n library realizes multilingualization of
357 many aspects of applications. The m17n library represents
358 multilingual text as an object named M-text. M-text is a string with
359 attributes called text properties, and designed to substitute for
360 string in C. Text properties carry any information required to input,
361 display and edit the text.
362
363 This package contains the library runtime.")
364 (license license:lgpl2.1+)))