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 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>
16 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
52 (uri (string-append "mirror://gnu/aspell/aspell-"
56 "1wi60ankalmh8ds7nplz434jd7j94gdvbahdwsr539rlad8pxdzr"))
57 (patches (search-patches "aspell-default-dict-dir.patch"))))
58 (build-system gnu-build-system)
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
75 (inputs `(("perl" ,perl)))
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")
83 (files '("lib/aspell")))))
85 (home-page "http://aspell.net/")
86 (synopsis "Spell checker")
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.")
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!).
102 (define* (aspell-dictionary dict-name full-name
103 #:key version sha256 (prefix "aspell6-"))
107 ;; Downcase and replace underscore in package names
108 ;; to follow Guix naming conventions.
109 (string-map (match-lambda
112 (string-downcase dict-name))))
116 (uri (string-append "mirror://gnu/aspell/dict/" dict-name
117 "/" prefix dict-name "-"
119 (hash (content-hash sha256))))
120 (build-system gnu-build-system)
123 (modify-phases %standard-phases
125 (lambda* (#:key outputs #:allow-other-keys)
126 (let ((out (assoc-ref outputs "out")))
127 (invoke "./configure")))))
129 (let ((out (assoc-ref %outputs "out")))
130 (list (string-append "dictdir=" out "/lib/aspell")
131 (string-append "datadir=" out "/lib/aspell")))
133 (native-inputs `(("aspell" ,aspell)
135 (synopsis (string-append full-name " dictionary for GNU Aspell")) ; XXX: i18n
137 "This package provides a dictionary for the GNU Aspell spell checker.")
139 (home-page "http://aspell.net/")))
142 (define-public aspell-dict-ar
143 (aspell-dictionary "ar" "Arabic"
148 "1avw40bp8yi5bnkq64ihm2rldgw34lk89yz281q9bmndh95a47h4")))
150 (define-public aspell-dict-be
151 (aspell-dictionary "be" "Belarusian"
156 "1svls9p7rsfi3hs0afh0cssj006qb4v1ik2yzqgj8hm10c6as2sm")))
158 (define-public aspell-dict-ca
159 (let ((version "2.5.0")
161 (base32 "0kbi8fi7a1bys31kfqrlh332gyik0cfdmxgl7n15sa9c305rkgwq")))
163 (inherit (aspell-dictionary "ca" "Catalan"
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/"))))
174 (define-public aspell-dict-cs
175 (aspell-dictionary "cs" "Czech"
176 #:version "20040614-1"
179 "0rihj4hsw96pd9casvmpvw3r8040pfa28p1h73x4vyn20zwr3h01")))
181 (define-public aspell-dict-de
182 (aspell-dictionary "de" "German"
183 #:version "20161207-7-0"
186 "0wamclvp66xfmv5wff96v6gdlnfv4y8lx3f8wvxyzm5imwgms4n2")))
188 (define-public aspell-dict-da
189 (aspell-dictionary "da" "Danish"
190 #:version "1.6.36-11-0"
193 "1xz2haayvwlxgss9jf1x2311a1ixbk75q2vgfprjhibsmb7cpinv")))
195 (define-public aspell-dict-el
196 (aspell-dictionary "el" "Greek"
201 "1ljcc30zg2v2h3w5h5jr5im41mw8jbsgvvhdd2cii2yzi8d0zxja")))
203 (define-public aspell-dict-en
204 (aspell-dictionary "en" "English"
205 #:version "2019.10.06-0"
208 "1zai9wrqwgb9z9vfgb22qhrvxvg73jg0ix44j1khm2f6m96lncr4")))
210 (define-public aspell-dict-eo
211 (aspell-dictionary "eo" "Esperanto"
212 #:version "2.1.20000225a-2"
215 "09vf0mbiicbmyb4bwb7v7lgpabnylg0wy7m3hlhl5rjdda6x3lj1")))
217 (define-public aspell-dict-es
218 (aspell-dictionary "es" "Spanish"
222 "1k5g328ac1hdpp6fsg57d8md6i0aqcwlszp3gbmp5706wyhpydmd")))
224 (define-public aspell-dict-fi
225 (aspell-dictionary "fi" "Finnish"
230 "07d5s08ba4dd89cmwy9icc01i6fjdykxlb9ravmhdrhi8mxz1mzq")))
232 (define-public aspell-dict-fr
233 (aspell-dictionary "fr" "French"
238 "14ffy9mn5jqqpp437kannc3559bfdrpk7r36ljkzjalxa53i0hpr")))
240 (define-public aspell-dict-grc
241 (aspell-dictionary "grc" "Ancient Greek"
245 "1zxr8958v37v260fkqd4pg37ns5h5kyqm54hn1hg70wq5cz8h512")))
247 (define-public aspell-dict-he
248 (aspell-dictionary "he" "Hebrew"
252 "13bhbghx5b8g0119g3wxd4n8mlf707y41vlf59irxjj0kynankfn")))
254 (define-public aspell-dict-hi
255 (aspell-dictionary "hi" "Hindi"
260 "0drs374qz4419zx1lf2k281ydxf2750jk5ailafj1x0ncz27h1ys")))
262 (define-public aspell-dict-it
263 (let ((version "2.4-20070901-0")
265 (base32 "0d6ypii3jblprpibazb6ypady536jz62rwxlss1x1raq07rhvvqn")))
267 (inherit (aspell-dictionary "it" "Italian"
271 ;; The version hosted at <https://ftp.gnu.org/gnu/aspell/dict> is even
276 (uri (string-append "mirror://sourceforge/linguistico/"
277 "Dizionario%20italiano%20per%20Aspell/" version "/"
278 "aspell6-it-" version ".tar.bz2"))
279 (hash (content-hash sha256))))
281 "http://linguistico.sourceforge.net/pages/dizionario_italiano.html"))))
283 (define-public aspell-dict-mi
284 (aspell-dictionary "mi" "Maori"
289 "12bxplpd348yx8d2q8qvahi9dlp7qf28qmanzhziwc7np8rixvmy")))
291 (define-public aspell-dict-nl
292 (aspell-dictionary "nl" "Dutch"
297 "0ffb87yjsh211hllpc4b9khqqrblial4pzi1h9r3v465z1yhn3j4")))
299 (define-public aspell-dict-nn
300 (aspell-dictionary "nn" "Norwegian Nynorsk"
305 "0w2k5l5rbqpliripgqwiqixz5ghnjf7i9ggbrc4ly4vy1ia10rmc")))
307 (define-public aspell-dict-pl
308 (aspell-dictionary "pl" "Polish"
313 "1a3ccji6k5gys7l3ilr2lh5pzxgzb7ipc5vb737svl6nqgdy8757")))
315 (define-public aspell-dict-pt-br
316 (aspell-dictionary "pt_BR" "Brazilian Portuguese"
317 #:version "20131030-12-0"
320 "1xqlpk21s93c6blkdnpk7l62q9fxjvzdv2x86chl8p2x1gdrj3gb")))
322 (define-public aspell-dict-pt-pt
323 (aspell-dictionary "pt_PT" "Portuguese"
324 #:version "20190329-1-0"
327 "0ld0d0ily4jqifjfsxfv4shbicz6ymm2gk56fq9gbzra1j4qnw75")))
329 (define-public aspell-dict-ru
330 (aspell-dictionary "ru" "Russian"
334 "0ip6nq43hcr7vvzbv4lwwmlwgfa60hrhsldh9xy3zg2prv6bcaaw")))
336 (define-public aspell-dict-sl
337 (aspell-dictionary "sl" "Slovenian"
342 "1l9kc5g35flq8kw9jhn2n0bjb4sipjs4qkqzgggs438kywkx2rp5")))
344 (define-public aspell-dict-sv
345 (aspell-dictionary "sv" "Swedish"
350 "02jwkjhr32kvyibnyzgx3smbnm576jwdzg3avdf6zxwckhy5fw4v")))
352 (define-public aspell-dict-uk
353 (aspell-dictionary "uk" "Ukrainian"
357 "137i4njvnslab6l4s291s11xijr5jsy75lbdph32f9y183lagy9m")))
361 ;;; Hunspell packages made from the Aspell word lists.
364 (define* (aspell-word-list language synopsis
366 (nick (string-map (lambda (chr)
370 (string-downcase language))))
372 (name (string-append "hunspell-dict-" nick))
373 (version "2018.04.16")
377 "mirror://sourceforge/wordlist/SCOWL/"
378 version "/scowl-" version ".tar.gz"))
381 "11lkrnhwrf5mvrrq45k4mads3n9aswgac8dc25ba61c75alxb5rs"))))
387 (build-system gnu-build-system)
390 (modify-phases %standard-phases
395 (substitute* "speller/make-hunspell-dict"
398 (mkdir "speller/hunspell")
400 ;; XXX: This actually builds all the dictionary variants.
401 (invoke "make" "-C" "speller" "hunspell")))
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/"
409 (dot-dic ,(string-append "speller/" language ".dic")))
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$"))))
422 ;; Install affix files corresponding to installed dictionaries
423 (for-each (lambda (dic)
424 (install-file (string-append
425 "speller/" (basename dic ".dic") ".aff")
427 (find-files hunspell ".*\\.dic$"))
428 (symlink hunspell (string-append myspell "/dicts"))
429 (for-each (lambda (file)
430 (install-file file doc))
432 "^(Copyright|.*\\.(txt|org|md))$"))
436 "This package provides a dictionary for the Hunspell spell-checking
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."))))
443 (define-syntax define-word-list-dictionary
444 (syntax-rules (synopsis)
445 ((_ name language (synopsis text))
447 (aspell-word-list language text)))
448 ((_ name language nick (synopsis text))
450 (aspell-word-list language text nick)))))
452 (define-word-list-dictionary hunspell-dict-en
454 (synopsis "Hunspell dictionary for English"))
456 (define-word-list-dictionary hunspell-dict-en-au
458 (synopsis "Hunspell dictionary for Australian English"))
460 (define-word-list-dictionary hunspell-dict-en-ca
462 (synopsis "Hunspell dictionary for Canadian English"))
464 (define-word-list-dictionary hunspell-dict-en-gb
466 (synopsis "Hunspell dictionary for British English, with -ise endings"))
468 (define-word-list-dictionary hunspell-dict-en-gb-ize
470 (synopsis "Hunspell dictionary for British English, with -ize endings"))
472 (define-word-list-dictionary hunspell-dict-en-us
474 (synopsis "Hunspell dictionary for United States English"))
476 (define-public ispell
483 (uri (string-append "https://www.cs.hmc.edu/~geoff/tars/ispell-"
487 "1hmfnz55qzfpz7lz0r3m4kkv31smir92ks9s5l1iiwimhr2jxi2x"))))
488 (build-system gnu-build-system)
490 `(#:parallel-build? #f
491 #:tests? #f ; no tests
493 (modify-phases %standard-phases
495 (lambda* (#:key inputs outputs #:allow-other-keys)
496 ;; Based on local.h.linux
497 (let* ((grep (assoc-ref inputs "grep"))
498 (out (assoc-ref outputs "out")))
499 (call-with-output-file "local.h"
501 (format port "#define MINIMENU~%")
502 (format port "#define USG~%")
503 (format port "#define HAS_RENAME~%")
504 (format port "#define CC \"gcc\"~%")
505 (format port "#define POUNDBANG \"#!~a\"~%" (which "sh"))
506 (format port "#define EGREPCMD \"~a/bin/grep -Ei\"~%" grep)
507 (format port "#define BINDIR \"~a/bin\"~%" out)
508 (format port "#define LIBDIR \"~a/lib/ispell\"~%" out)
509 (format port "#define MAN1DIR \"~a/share/man/man1\"~%" out)
510 (format port "#define MAN45DIR \"~a/share/man/man5\"~%" out))))
514 ("ncurses" ,ncurses)))
517 (synopsis "Interactive spell-checking tool for Unix")
518 (description "Ispell is an interactive spell-checking tool supporting many
519 European languages.")
520 (home-page "https://www.cs.hmc.edu/~geoff/ispell.html")