gnu: emacs-svg-icon: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / aspell.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com>
4 ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
5 ;;; Copyright © 2016, 2017, 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2016 Christopher Andersson <christopher@8bits.nu>
7 ;;; Copyright © 2016 Theodoros Foradis <theodoros@foradis.org>
8 ;;; Copyright © 2016, 2017, 2019, 2021 Tobias Geerinckx-Rice <me@tobias.gr>
9 ;;; Copyright © 2019 Jens Mølgaard <jens@zete.tk>
10 ;;; Copyright © 2020 Timotej Lazar <timotej.lazar@araneo.si>
11 ;;; Copyright © 2020 Marcin Karpezo <sirmacik@wioo.waw.pl>
12 ;;; Copyright © 2020 Jonathan Brielmaier <jonathan.brielmaier@web.de>
13 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
14 ;;; Copyright © 2020 Noah Landis <noahlandis@posteo.net>
15 ;;;
16 ;;; This file is part of GNU Guix.
17 ;;;
18 ;;; GNU Guix is free software; you can redistribute it and/or modify it
19 ;;; under the terms of the GNU General Public License as published by
20 ;;; the Free Software Foundation; either version 3 of the License, or (at
21 ;;; your option) any later version.
22 ;;;
23 ;;; GNU Guix is distributed in the hope that it will be useful, but
24 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
25 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 ;;; GNU General Public License for more details.
27 ;;;
28 ;;; You should have received a copy of the GNU General Public License
29 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
30
31 (define-module (gnu packages aspell)
32 #:use-module (guix packages)
33 #:use-module (guix download)
34 #:use-module (guix build-system gnu)
35 #:use-module (guix licenses)
36 #:use-module (guix utils)
37 #:use-module (gnu packages)
38 #:use-module (gnu packages base)
39 #:use-module (gnu packages bison)
40 #:use-module (gnu packages compression)
41 #:use-module (gnu packages ncurses)
42 #:use-module (gnu packages perl)
43 #:use-module (ice-9 match))
44
45 (define-public aspell
46 (package
47 (name "aspell")
48 (version "0.60.8")
49 (source
50 (origin
51 (method url-fetch)
52 (uri (string-append "mirror://gnu/aspell/aspell-"
53 version ".tar.gz"))
54 (sha256
55 (base32
56 "1wi60ankalmh8ds7nplz434jd7j94gdvbahdwsr539rlad8pxdzr"))
57 (patches (search-patches "aspell-default-dict-dir.patch"))))
58 (build-system gnu-build-system)
59 (arguments
60 `(#:phases
61 (modify-phases %standard-phases
62 (add-before 'build 'set-filter-path
63 (lambda* (#:key outputs #:allow-other-keys)
64 ;; Change the default value of 'filter-path' so that filters such
65 ;; as 'tex-filter.so' can be found. By default none of the
66 ;; filters would be found.
67 (let* ((out (assoc-ref outputs "out"))
68 (libdir (string-append out "/lib/aspell-"
69 ,(version-major+minor version))))
70 (substitute* "common/config.cpp"
71 (("\"filter-path(.*)DICT_DIR" _ middle)
72 (string-append "\"filter-path" middle
73 "\"" libdir "\"")))
74 #t))))))
75 (inputs `(("perl" ,perl)))
76
77 (native-search-paths
78 ;; This is a Guix-specific environment variable that takes a single
79 ;; entry, not an actual search path.
80 (list (search-path-specification
81 (variable "ASPELL_DICT_DIR")
82 (separator #f)
83 (files '("lib/aspell")))))
84
85 (home-page "http://aspell.net/")
86 (synopsis "Spell checker")
87 (description
88 "Aspell is a spell-checker which can be used either as a library or as
89 a standalone program. Notable features of Aspell include its full support of
90 documents written in the UTF-8 encoding and its ability to use multiple
91 dictionaries, including personal ones.")
92 (license lgpl2.1+)))
93
94 ;;;
95 ;;; Dictionaries.
96 ;;;
97 ;;; Use 'export ASPELL_CONF="dict-dir $HOME/.guix-profile/lib/aspell"' to use
98 ;;; them, or set the Guix-specific 'ASPELL_DICT_DIR', or just do nothing (as
99 ;;; long as 'HOME' is set, that's fine!).
100 ;;;
101
102 (define* (aspell-dictionary dict-name full-name
103 #:key version sha256 (prefix "aspell6-"))
104 (package
105 (name (string-append
106 "aspell-dict-"
107 ;; Downcase and replace underscore in package names
108 ;; to follow Guix naming conventions.
109 (string-map (match-lambda
110 (#\_ #\-)
111 (chr chr))
112 (string-downcase dict-name))))
113 (version version)
114 (source (origin
115 (method url-fetch)
116 (uri (string-append "mirror://gnu/aspell/dict/" dict-name
117 "/" prefix dict-name "-"
118 version ".tar.bz2"))
119 (hash (content-hash sha256))))
120 (build-system gnu-build-system)
121 (arguments
122 `(#:phases
123 (modify-phases %standard-phases
124 (replace 'configure
125 (lambda* (#:key outputs #:allow-other-keys)
126 (let ((out (assoc-ref outputs "out")))
127 (invoke "./configure")))))
128 #:make-flags
129 (let ((out (assoc-ref %outputs "out")))
130 (list (string-append "dictdir=" out "/lib/aspell")
131 (string-append "datadir=" out "/lib/aspell")))
132 #:tests? #f))
133 (native-inputs `(("aspell" ,aspell)
134 ("which" ,which)))
135 (synopsis (string-append full-name " dictionary for GNU Aspell")) ; XXX: i18n
136 (description
137 "This package provides a dictionary for the GNU Aspell spell checker.")
138 (license gpl2+)
139 (home-page "http://aspell.net/")))
140
141
142 (define-public aspell-dict-ar
143 (aspell-dictionary "ar" "Arabic"
144 #:version "1.2-0"
145 #:prefix "aspell6-"
146 #:sha256
147 (base32
148 "1avw40bp8yi5bnkq64ihm2rldgw34lk89yz281q9bmndh95a47h4")))
149
150 (define-public aspell-dict-be
151 (aspell-dictionary "be" "Belarusian"
152 #:version "0.01"
153 #:prefix "aspell5-"
154 #:sha256
155 (base32
156 "1svls9p7rsfi3hs0afh0cssj006qb4v1ik2yzqgj8hm10c6as2sm")))
157
158 (define-public aspell-dict-ca
159 (let ((version "2.5.0")
160 (sha256
161 (base32 "0kbi8fi7a1bys31kfqrlh332gyik0cfdmxgl7n15sa9c305rkgwq")))
162 (package
163 (inherit (aspell-dictionary "ca" "Catalan"
164 #:version version
165 #:sha256 sha256))
166 (source
167 (origin
168 (method url-fetch)
169 (uri (string-append "https://www.softcatala.org/pub/softcatala/aspell/"
170 version "/aspell6-ca-" version ".tar.bz2"))
171 (hash (content-hash sha256))))
172 (home-page "https://www.softcatala.org/pub/softcatala/aspell/"))))
173
174 (define-public aspell-dict-cs
175 (aspell-dictionary "cs" "Czech"
176 #:version "20040614-1"
177 #:sha256
178 (base32
179 "0rihj4hsw96pd9casvmpvw3r8040pfa28p1h73x4vyn20zwr3h01")))
180
181 (define-public aspell-dict-de
182 (aspell-dictionary "de" "German"
183 #:version "20161207-7-0"
184 #:sha256
185 (base32
186 "0wamclvp66xfmv5wff96v6gdlnfv4y8lx3f8wvxyzm5imwgms4n2")))
187
188 (define-public aspell-dict-da
189 (aspell-dictionary "da" "Danish"
190 #:version "1.6.36-11-0"
191 #:sha256
192 (base32
193 "1xz2haayvwlxgss9jf1x2311a1ixbk75q2vgfprjhibsmb7cpinv")))
194
195 (define-public aspell-dict-el
196 (aspell-dictionary "el" "Greek"
197 #:version "0.08-0"
198 #:prefix "aspell6-"
199 #:sha256
200 (base32
201 "1ljcc30zg2v2h3w5h5jr5im41mw8jbsgvvhdd2cii2yzi8d0zxja")))
202
203 (define-public aspell-dict-en
204 (aspell-dictionary "en" "English"
205 #:version "2019.10.06-0"
206 #:sha256
207 (base32
208 "1zai9wrqwgb9z9vfgb22qhrvxvg73jg0ix44j1khm2f6m96lncr4")))
209
210 (define-public aspell-dict-eo
211 (aspell-dictionary "eo" "Esperanto"
212 #:version "2.1.20000225a-2"
213 #:sha256
214 (base32
215 "09vf0mbiicbmyb4bwb7v7lgpabnylg0wy7m3hlhl5rjdda6x3lj1")))
216
217 (define-public aspell-dict-es
218 (aspell-dictionary "es" "Spanish"
219 #:version "1.11-2"
220 #:sha256
221 (base32
222 "1k5g328ac1hdpp6fsg57d8md6i0aqcwlszp3gbmp5706wyhpydmd")))
223
224 (define-public aspell-dict-fi
225 (aspell-dictionary "fi" "Finnish"
226 #:version "0.7-0"
227 #:prefix "aspell6-"
228 #:sha256
229 (base32
230 "07d5s08ba4dd89cmwy9icc01i6fjdykxlb9ravmhdrhi8mxz1mzq")))
231
232 (define-public aspell-dict-fr
233 (aspell-dictionary "fr" "French"
234 #:version "0.50-3"
235 #:prefix "aspell-"
236 #:sha256
237 (base32
238 "14ffy9mn5jqqpp437kannc3559bfdrpk7r36ljkzjalxa53i0hpr")))
239
240 (define-public aspell-dict-grc
241 (aspell-dictionary "grc" "Ancient Greek"
242 #:version "0.02-0"
243 #:sha256
244 (base32
245 "1zxr8958v37v260fkqd4pg37ns5h5kyqm54hn1hg70wq5cz8h512")))
246
247 (define-public aspell-dict-he
248 (aspell-dictionary "he" "Hebrew"
249 #:version "1.0-0"
250 #:sha256
251 (base32
252 "13bhbghx5b8g0119g3wxd4n8mlf707y41vlf59irxjj0kynankfn")))
253
254 (define-public aspell-dict-hi
255 (aspell-dictionary "hi" "Hindi"
256 #:version "0.02-0"
257 #:prefix "aspell6-"
258 #:sha256
259 (base32
260 "0drs374qz4419zx1lf2k281ydxf2750jk5ailafj1x0ncz27h1ys")))
261
262 (define-public aspell-dict-it
263 (let ((version "2.4-20070901-0")
264 (sha256
265 (base32 "0d6ypii3jblprpibazb6ypady536jz62rwxlss1x1raq07rhvvqn")))
266 (package
267 (inherit (aspell-dictionary "it" "Italian"
268 #:version version
269 #:sha256 sha256))
270
271 ;; The version hosted at <https://ftp.gnu.org/gnu/aspell/dict> is even
272 ;; more out of date.
273 (source
274 (origin
275 (method url-fetch)
276 (uri (string-append "mirror://sourceforge/linguistico/"
277 "Dizionario%20italiano%20per%20Aspell/" version "/"
278 "aspell6-it-" version ".tar.bz2"))
279 (hash (content-hash sha256))))
280 (home-page
281 "http://linguistico.sourceforge.net/pages/dizionario_italiano.html"))))
282
283 (define-public aspell-dict-mi
284 (aspell-dictionary "mi" "Maori"
285 #:version "0.50-0"
286 #:prefix "aspell-"
287 #:sha256
288 (base32
289 "12bxplpd348yx8d2q8qvahi9dlp7qf28qmanzhziwc7np8rixvmy")))
290
291 (define-public aspell-dict-nl
292 (aspell-dictionary "nl" "Dutch"
293 #:version "0.50-2"
294 #:prefix "aspell-"
295 #:sha256
296 (base32
297 "0ffb87yjsh211hllpc4b9khqqrblial4pzi1h9r3v465z1yhn3j4")))
298
299 (define-public aspell-dict-nn
300 (aspell-dictionary "nn" "Norwegian Nynorsk"
301 #:version "0.50.1-1"
302 #:prefix "aspell-"
303 #:sha256
304 (base32
305 "0w2k5l5rbqpliripgqwiqixz5ghnjf7i9ggbrc4ly4vy1ia10rmc")))
306
307 (define-public aspell-dict-pl
308 (aspell-dictionary "pl" "Polish"
309 #:version "0.51-0"
310 #:prefix "aspell-"
311 #:sha256
312 (base32
313 "1a3ccji6k5gys7l3ilr2lh5pzxgzb7ipc5vb737svl6nqgdy8757")))
314
315 (define-public aspell-dict-pt-br
316 (aspell-dictionary "pt_BR" "Brazilian Portuguese"
317 #:version "20131030-12-0"
318 #:sha256
319 (base32
320 "1xqlpk21s93c6blkdnpk7l62q9fxjvzdv2x86chl8p2x1gdrj3gb")))
321
322 (define-public aspell-dict-pt-pt
323 (aspell-dictionary "pt_PT" "Portuguese"
324 #:version "20190329-1-0"
325 #:sha256
326 (base32
327 "0ld0d0ily4jqifjfsxfv4shbicz6ymm2gk56fq9gbzra1j4qnw75")))
328
329 (define-public aspell-dict-ru
330 (aspell-dictionary "ru" "Russian"
331 #:version "0.99f7-1"
332 #:sha256
333 (base32
334 "0ip6nq43hcr7vvzbv4lwwmlwgfa60hrhsldh9xy3zg2prv6bcaaw")))
335
336 (define-public aspell-dict-sl
337 (aspell-dictionary "sl" "Slovenian"
338 #:version "0.50-0"
339 #:prefix "aspell-"
340 #:sha256
341 (base32
342 "1l9kc5g35flq8kw9jhn2n0bjb4sipjs4qkqzgggs438kywkx2rp5")))
343
344 (define-public aspell-dict-sv
345 (aspell-dictionary "sv" "Swedish"
346 #:version "0.51-0"
347 #:prefix "aspell-"
348 #:sha256
349 (base32
350 "02jwkjhr32kvyibnyzgx3smbnm576jwdzg3avdf6zxwckhy5fw4v")))
351
352 (define-public aspell-dict-uk
353 (aspell-dictionary "uk" "Ukrainian"
354 #:version "1.4.0-0"
355 #:sha256
356 (base32
357 "137i4njvnslab6l4s291s11xijr5jsy75lbdph32f9y183lagy9m")))
358
359 \f
360 ;;;
361 ;;; Hunspell packages made from the Aspell word lists.
362 ;;;
363
364 (define* (aspell-word-list language synopsis
365 #:optional
366 (nick (string-map (lambda (chr)
367 (if (char=? #\_ chr)
368 #\-
369 chr))
370 (string-downcase language))))
371 (package
372 (name (string-append "hunspell-dict-" nick))
373 (version "2018.04.16")
374 (source (origin
375 (method url-fetch)
376 (uri (string-append
377 "mirror://sourceforge/wordlist/SCOWL/"
378 version "/scowl-" version ".tar.gz"))
379 (sha256
380 (base32
381 "11lkrnhwrf5mvrrq45k4mads3n9aswgac8dc25ba61c75alxb5rs"))))
382 (native-inputs
383 `(("tar" ,tar)
384 ("gzip" ,gzip)
385 ("perl" ,perl)
386 ("aspell" ,aspell)))
387 (build-system gnu-build-system)
388 (arguments
389 `(#:phases
390 (modify-phases %standard-phases
391 (delete 'configure)
392 (delete 'check)
393 (replace 'build
394 (lambda _
395 (substitute* "speller/make-hunspell-dict"
396 (("zip -9 .*$")
397 "return\n"))
398 (mkdir "speller/hunspell")
399
400 ;; XXX: This actually builds all the dictionary variants.
401 (invoke "make" "-C" "speller" "hunspell")))
402 (replace 'install
403 (lambda* (#:key outputs #:allow-other-keys)
404 (let* ((out (assoc-ref %outputs "out"))
405 (hunspell (string-append out "/share/hunspell"))
406 (myspell (string-append out "/share/myspell"))
407 (doc (string-append out "/share/doc/"
408 ,name))
409 (dot-dic ,(string-append "speller/" language ".dic")))
410 (mkdir-p myspell)
411
412 ;; Usually there's only a 'LANGUAGE.dic' file, but for the "en"
413 ;; dictionary, there no 'en.dic'. Instead, there's a set of
414 ;; 'en*.dic' files, hence the 'find-files' call below.
415 (if (file-exists? dot-dic)
416 (install-file dot-dic hunspell)
417 (for-each (lambda (dic)
418 (install-file dic hunspell))
419 (find-files "speller"
420 ,(string-append language ".*\\.dic$"))))
421
422 ;; Install affix files corresponding to installed dictionaries
423 (for-each (lambda (dic)
424 (install-file (string-append
425 "speller/" (basename dic ".dic") ".aff")
426 hunspell))
427 (find-files hunspell ".*\\.dic$"))
428 (symlink hunspell (string-append myspell "/dicts"))
429 (for-each (lambda (file)
430 (install-file file doc))
431 (find-files "."
432 "^(Copyright|.*\\.(txt|org|md))$"))
433 #t))))))
434 (synopsis synopsis)
435 (description
436 "This package provides a dictionary for the Hunspell spell-checking
437 library.")
438 (home-page "http://wordlist.aspell.net/")
439 (license (non-copyleft "file://Copyright"
440 "Word lists come from several sources, all
441 under permissive licensing terms. See the 'Copyright' file."))))
442
443 (define-syntax define-word-list-dictionary
444 (syntax-rules (synopsis)
445 ((_ name language (synopsis text))
446 (define-public name
447 (aspell-word-list language text)))
448 ((_ name language nick (synopsis text))
449 (define-public name
450 (aspell-word-list language text nick)))))
451
452 (define-word-list-dictionary hunspell-dict-en
453 "en"
454 (synopsis "Hunspell dictionary for English"))
455
456 (define-word-list-dictionary hunspell-dict-en-au
457 "en_AU"
458 (synopsis "Hunspell dictionary for Australian English"))
459
460 (define-word-list-dictionary hunspell-dict-en-ca
461 "en_CA"
462 (synopsis "Hunspell dictionary for Canadian English"))
463
464 (define-word-list-dictionary hunspell-dict-en-gb
465 "en_GB-ise" "en-gb"
466 (synopsis "Hunspell dictionary for British English, with -ise endings"))
467
468 (define-word-list-dictionary hunspell-dict-en-gb-ize
469 "en_GB-ize"
470 (synopsis "Hunspell dictionary for British English, with -ize endings"))
471
472 (define-word-list-dictionary hunspell-dict-en-us
473 "en_US"
474 (synopsis "Hunspell dictionary for United States English"))
475
476 (define-public ispell
477 (package
478 (name "ispell")
479 (version "3.4.02")
480 (source
481 (origin
482 (method url-fetch)
483 (uri (string-append "https://www.cs.hmc.edu/~geoff/tars/ispell-"
484 version ".tar.gz"))
485 (sha256
486 (base32 "0b6rqzqjdhwf323sf1dv8qzx5pxa5asz618922r59zjp65660yb6"))))
487 (build-system gnu-build-system)
488 (arguments
489 `(#:parallel-build? #f
490 #:tests? #f ; no tests
491 #:phases
492 (modify-phases %standard-phases
493 (replace 'configure
494 (lambda* (#:key inputs outputs #:allow-other-keys)
495 ;; Based on local.h.linux
496 (let* ((grep (assoc-ref inputs "grep"))
497 (out (assoc-ref outputs "out")))
498 (call-with-output-file "local.h"
499 (lambda (port)
500 (format port "#define MINIMENU~%")
501 (format port "#define USG~%")
502 (format port "#define HAS_RENAME~%")
503 (format port "#define CC \"gcc\"~%")
504 (format port "#define POUNDBANG \"#!~a\"~%" (which "sh"))
505 (format port "#define EGREPCMD \"~a/bin/grep -Ei\"~%" grep)
506 (format port "#define BINDIR \"~a/bin\"~%" out)
507 (format port "#define LIBDIR \"~a/lib/ispell\"~%" out)
508 (format port "#define MAN1DIR \"~a/share/man/man1\"~%" out)
509 (format port "#define MAN45DIR \"~a/share/man/man5\"~%" out))))
510 #t)))))
511 (inputs
512 `(("grep" ,grep)
513 ("ncurses" ,ncurses)))
514 (native-inputs
515 `(("bison" ,bison)))
516 (synopsis "Interactive spell-checking tool for Unix")
517 (description "Ispell is an interactive spell-checking tool supporting many
518 European languages.")
519 (home-page "https://www.cs.hmc.edu/~geoff/ispell.html")
520 (license bsd-3)))