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