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>
17 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
50 (replacement aspell/replacement)
54 (uri (string-append "mirror://gnu/aspell/aspell-"
58 "1wi60ankalmh8ds7nplz434jd7j94gdvbahdwsr539rlad8pxdzr"))
59 (patches (search-patches "aspell-default-dict-dir.patch"))))
60 (build-system gnu-build-system)
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
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")
85 (files '("lib/aspell")))))
87 (home-page "http://aspell.net/")
88 (synopsis "Spell checker")
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.")
96 ;; Replacement package with security fixes.
97 (define aspell/replacement
102 (inherit (package-source aspell))
103 (patches (append (origin-patches (package-source aspell))
104 (search-patches "aspell-CVE-2019-25051.patch")))))))
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!).
114 (define* (aspell-dictionary dict-name full-name
115 #:key version sha256 (prefix "aspell6-"))
119 ;; Downcase and replace underscore in package names
120 ;; to follow Guix naming conventions.
121 (string-map (match-lambda
124 (string-downcase dict-name))))
128 (uri (string-append "mirror://gnu/aspell/dict/" dict-name
129 "/" prefix dict-name "-"
131 (hash (content-hash sha256))))
132 (build-system gnu-build-system)
135 (modify-phases %standard-phases
137 (lambda* (#:key outputs #:allow-other-keys)
138 (let ((out (assoc-ref outputs "out")))
139 (invoke "./configure")))))
141 (let ((out (assoc-ref %outputs "out")))
142 (list (string-append "dictdir=" out "/lib/aspell")
143 (string-append "datadir=" out "/lib/aspell")))
145 (native-inputs (list aspell which))
146 (synopsis (string-append full-name " dictionary for GNU Aspell")) ; XXX: i18n
148 "This package provides a dictionary for the GNU Aspell spell checker.")
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/")))
158 (define-public aspell-dict-ar
159 (aspell-dictionary "ar" "Arabic"
164 "1avw40bp8yi5bnkq64ihm2rldgw34lk89yz281q9bmndh95a47h4")))
166 (define-public aspell-dict-be
167 (aspell-dictionary "be" "Belarusian"
172 "1svls9p7rsfi3hs0afh0cssj006qb4v1ik2yzqgj8hm10c6as2sm")))
174 (define-public aspell-dict-ca
175 (let ((version "2.5.0")
177 (base32 "0kbi8fi7a1bys31kfqrlh332gyik0cfdmxgl7n15sa9c305rkgwq")))
179 (inherit (aspell-dictionary "ca" "Catalan"
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/"))))
190 (define-public aspell-dict-cs
191 (aspell-dictionary "cs" "Czech"
192 #:version "20040614-1"
195 "0rihj4hsw96pd9casvmpvw3r8040pfa28p1h73x4vyn20zwr3h01")))
197 (define-public aspell-dict-de
198 (aspell-dictionary "de" "German"
199 #:version "20161207-7-0"
202 "0wamclvp66xfmv5wff96v6gdlnfv4y8lx3f8wvxyzm5imwgms4n2")))
204 (define-public aspell-dict-da
205 (aspell-dictionary "da" "Danish"
206 #:version "1.6.36-11-0"
209 "1xz2haayvwlxgss9jf1x2311a1ixbk75q2vgfprjhibsmb7cpinv")))
211 (define-public aspell-dict-el
212 (aspell-dictionary "el" "Greek"
217 "1ljcc30zg2v2h3w5h5jr5im41mw8jbsgvvhdd2cii2yzi8d0zxja")))
219 (define-public aspell-dict-en
220 (aspell-dictionary "en" "English"
221 #:version "2020.12.07-0"
224 "1cwzqkm8gr1w51rpckwlvb43sb0b5nbwy7s8ns5vi250515773sc")))
226 (define-public aspell-dict-eo
227 (aspell-dictionary "eo" "Esperanto"
228 #:version "2.1.20000225a-2"
231 "09vf0mbiicbmyb4bwb7v7lgpabnylg0wy7m3hlhl5rjdda6x3lj1")))
233 (define-public aspell-dict-es
234 (aspell-dictionary "es" "Spanish"
238 "1k5g328ac1hdpp6fsg57d8md6i0aqcwlszp3gbmp5706wyhpydmd")))
240 (define-public aspell-dict-fi
241 (aspell-dictionary "fi" "Finnish"
246 "07d5s08ba4dd89cmwy9icc01i6fjdykxlb9ravmhdrhi8mxz1mzq")))
248 (define-public aspell-dict-fr
249 (aspell-dictionary "fr" "French"
254 "14ffy9mn5jqqpp437kannc3559bfdrpk7r36ljkzjalxa53i0hpr")))
256 (define-public aspell-dict-grc
257 (aspell-dictionary "grc" "Ancient Greek"
261 "1zxr8958v37v260fkqd4pg37ns5h5kyqm54hn1hg70wq5cz8h512")))
263 (define-public aspell-dict-he
264 (aspell-dictionary "he" "Hebrew"
268 "13bhbghx5b8g0119g3wxd4n8mlf707y41vlf59irxjj0kynankfn")))
270 (define-public aspell-dict-hi
271 (aspell-dictionary "hi" "Hindi"
276 "0drs374qz4419zx1lf2k281ydxf2750jk5ailafj1x0ncz27h1ys")))
278 (define-public aspell-dict-it
279 (let ((version "2.4-20070901-0")
281 (base32 "0d6ypii3jblprpibazb6ypady536jz62rwxlss1x1raq07rhvvqn")))
283 (inherit (aspell-dictionary "it" "Italian"
287 ;; The version hosted at <https://ftp.gnu.org/gnu/aspell/dict> is even
292 (uri (string-append "mirror://sourceforge/linguistico/"
293 "Dizionario%20italiano%20per%20Aspell/" version "/"
294 "aspell6-it-" version ".tar.bz2"))
295 (hash (content-hash sha256))))
297 "http://linguistico.sourceforge.net/pages/dizionario_italiano.html"))))
299 (define-public aspell-dict-mi
300 (aspell-dictionary "mi" "Maori"
305 "12bxplpd348yx8d2q8qvahi9dlp7qf28qmanzhziwc7np8rixvmy")))
307 (define-public aspell-dict-nl
308 (aspell-dictionary "nl" "Dutch"
313 "0ffb87yjsh211hllpc4b9khqqrblial4pzi1h9r3v465z1yhn3j4")))
315 (define-public aspell-dict-nn
316 (aspell-dictionary "nn" "Norwegian Nynorsk"
321 "0w2k5l5rbqpliripgqwiqixz5ghnjf7i9ggbrc4ly4vy1ia10rmc")))
323 (define-public aspell-dict-pl
324 (aspell-dictionary "pl" "Polish"
329 "1a3ccji6k5gys7l3ilr2lh5pzxgzb7ipc5vb737svl6nqgdy8757")))
331 (define-public aspell-dict-pt-br
332 (aspell-dictionary "pt_BR" "Brazilian Portuguese"
333 #:version "20131030-12-0"
336 "1xqlpk21s93c6blkdnpk7l62q9fxjvzdv2x86chl8p2x1gdrj3gb")))
338 (define-public aspell-dict-pt-pt
339 (aspell-dictionary "pt_PT" "Portuguese"
340 #:version "20190329-1-0"
343 "0ld0d0ily4jqifjfsxfv4shbicz6ymm2gk56fq9gbzra1j4qnw75")))
345 (define-public aspell-dict-ru
346 (aspell-dictionary "ru" "Russian"
350 "0ip6nq43hcr7vvzbv4lwwmlwgfa60hrhsldh9xy3zg2prv6bcaaw")))
352 (define-public aspell-dict-sl
353 (aspell-dictionary "sl" "Slovenian"
358 "1l9kc5g35flq8kw9jhn2n0bjb4sipjs4qkqzgggs438kywkx2rp5")))
360 (define-public aspell-dict-sv
361 (aspell-dictionary "sv" "Swedish"
366 "02jwkjhr32kvyibnyzgx3smbnm576jwdzg3avdf6zxwckhy5fw4v")))
368 (define-public aspell-dict-uk
369 (aspell-dictionary "uk" "Ukrainian"
373 "137i4njvnslab6l4s291s11xijr5jsy75lbdph32f9y183lagy9m")))
375 (define-public aspell-dict-ro
376 (aspell-dictionary "ro" "Romanian"
381 "0gb8j9iy1acdl11jq76idgc2lbc1rq3w04favn8cyh55d1v8phsk")))
385 ;;; Hunspell packages made from the Aspell word lists.
388 (define* (aspell-word-list language synopsis
390 (nick (string-map (lambda (chr)
394 (string-downcase language))))
396 (name (string-append "hunspell-dict-" nick))
397 (version "2018.04.16")
401 "mirror://sourceforge/wordlist/SCOWL/"
402 version "/scowl-" version ".tar.gz"))
405 "11lkrnhwrf5mvrrq45k4mads3n9aswgac8dc25ba61c75alxb5rs"))))
407 (list tar gzip perl aspell))
408 (build-system gnu-build-system)
411 (modify-phases %standard-phases
412 (add-after 'unpack 'make-reproducible
414 (substitute* "speller/README_en.txt.sh"
415 (("\\bdate\\b") ""))))
420 (substitute* "speller/make-hunspell-dict"
423 (mkdir "speller/hunspell")
425 ;; XXX: This actually builds all the dictionary variants.
426 (invoke "make" "-C" "speller" "hunspell")))
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/"
434 (dot-dic ,(string-append "speller/" language ".dic")))
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$"))))
447 ;; Install affix files corresponding to installed dictionaries
448 (for-each (lambda (dic)
449 (install-file (string-append
450 "speller/" (basename dic ".dic") ".aff")
452 (find-files hunspell ".*\\.dic$"))
453 (symlink hunspell (string-append myspell "/dicts"))
454 (for-each (lambda (file)
455 (install-file file doc))
457 "^(Copyright|.*\\.(txt|org|md))$"))
461 "This package provides a dictionary for the Hunspell spell-checking
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."))))
468 (define-syntax define-word-list-dictionary
469 (syntax-rules (synopsis)
470 ((_ name language (synopsis text))
472 (aspell-word-list language text)))
473 ((_ name language nick (synopsis text))
475 (aspell-word-list language text nick)))))
477 (define-word-list-dictionary hunspell-dict-en
479 (synopsis "Hunspell dictionary for English"))
481 (define-word-list-dictionary hunspell-dict-en-au
483 (synopsis "Hunspell dictionary for Australian English"))
485 (define-word-list-dictionary hunspell-dict-en-ca
487 (synopsis "Hunspell dictionary for Canadian English"))
489 (define-word-list-dictionary hunspell-dict-en-gb
491 (synopsis "Hunspell dictionary for British English, with -ise endings"))
493 (define-word-list-dictionary hunspell-dict-en-gb-ize
495 (synopsis "Hunspell dictionary for British English, with -ize endings"))
497 (define-word-list-dictionary hunspell-dict-en-us
499 (synopsis "Hunspell dictionary for United States English"))
501 (define-public ispell
508 (uri (string-append "https://www.cs.hmc.edu/~geoff/tars/ispell-"
511 (base32 "00jni7gvdswjd9sdwip5ixnvjg2qzv56mn3m8gdgl9gxwgnns36g"))))
512 (build-system gnu-build-system)
514 `(#:parallel-build? #f
515 #:tests? #f ; no tests
517 (modify-phases %standard-phases
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"
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)))))))))
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")