1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2017, 2018, 2019 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 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>
11 ;;; This file is part of GNU Guix.
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26 (define-module (gnu packages aspell)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix build-system gnu)
30 #:use-module (guix licenses)
31 #:use-module (guix utils)
32 #:use-module (gnu packages)
33 #:use-module (gnu packages base)
34 #:use-module (gnu packages compression)
35 #:use-module (gnu packages perl)
36 #:use-module (ice-9 match))
45 (uri (string-append "mirror://gnu/aspell/aspell-"
49 "1wi60ankalmh8ds7nplz434jd7j94gdvbahdwsr539rlad8pxdzr"))
50 (patches (search-patches "aspell-default-dict-dir.patch"))))
51 (build-system gnu-build-system)
54 (modify-phases %standard-phases
55 (add-before 'build 'set-filter-path
56 (lambda* (#:key outputs #:allow-other-keys)
57 ;; Change the default value of 'filter-path' so that filters such
58 ;; as 'tex-filter.so' can be found. By default none of the
59 ;; filters would be found.
60 (let* ((out (assoc-ref outputs "out"))
61 (libdir (string-append out "/lib/aspell-"
62 ,(version-major+minor version))))
63 (substitute* "common/config.cpp"
64 (("\"filter-path(.*)DICT_DIR" _ middle)
65 (string-append "\"filter-path" middle
68 (inputs `(("perl" ,perl)))
71 ;; This is a Guix-specific environment variable that takes a single
72 ;; entry, not an actual search path.
73 (list (search-path-specification
74 (variable "ASPELL_DICT_DIR")
76 (files '("lib/aspell")))))
78 (home-page "http://aspell.net/")
79 (synopsis "Spell checker")
81 "Aspell is a spell-checker which can be used either as a library or as
82 a standalone program. Notable features of Aspell include its full support of
83 documents written in the UTF-8 encoding and its ability to use multiple
84 dictionaries, including personal ones.")
90 ;;; Use 'export ASPELL_CONF="dict-dir $HOME/.guix-profile/lib/aspell"' to use
91 ;;; them, or set the Guix-specific 'ASPELL_DICT_DIR', or just do nothing (as
92 ;;; long as 'HOME' is set, that's fine!).
95 (define* (aspell-dictionary dict-name full-name
96 #:key version sha256 (prefix "aspell6-"))
100 ;; Downcase and replace underscore in package names
101 ;; to follow Guix naming conventions.
102 (string-map (match-lambda
105 (string-downcase dict-name))))
109 (uri (string-append "mirror://gnu/aspell/dict/" dict-name
110 "/" prefix dict-name "-"
113 (build-system gnu-build-system)
116 (modify-phases %standard-phases
118 (lambda* (#:key outputs #:allow-other-keys)
119 (let ((out (assoc-ref outputs "out")))
120 (invoke "./configure")))))
122 (let ((out (assoc-ref %outputs "out")))
123 (list (string-append "dictdir=" out "/lib/aspell")
124 (string-append "datadir=" out "/lib/aspell")))
126 (native-inputs `(("aspell" ,aspell)
128 (synopsis (string-append full-name " dictionary for GNU Aspell")) ; XXX: i18n
130 "This package provides a dictionary for the GNU Aspell spell checker.")
132 (home-page "http://aspell.net/")))
135 (define-public aspell-dict-ar
136 (aspell-dictionary "ar" "Arabic"
141 "1avw40bp8yi5bnkq64ihm2rldgw34lk89yz281q9bmndh95a47h4")))
143 (define-public aspell-dict-be
144 (aspell-dictionary "be" "Belarusian"
149 "1svls9p7rsfi3hs0afh0cssj006qb4v1ik2yzqgj8hm10c6as2sm")))
151 (define-public aspell-dict-ca
152 (let ((version "2.5.0")
154 (base32 "0kbi8fi7a1bys31kfqrlh332gyik0cfdmxgl7n15sa9c305rkgwq")))
156 (inherit (aspell-dictionary "ca" "Catalan"
162 (uri (string-append "https://www.softcatala.org/pub/softcatala/aspell/"
163 version "/aspell6-ca-" version ".tar.bz2"))
165 (home-page "https://www.softcatala.org/pub/softcatala/aspell/"))))
167 (define-public aspell-dict-de
168 (aspell-dictionary "de" "German"
169 #:version "20161207-7-0"
172 "0wamclvp66xfmv5wff96v6gdlnfv4y8lx3f8wvxyzm5imwgms4n2")))
174 (define-public aspell-dict-da
175 (aspell-dictionary "da" "Danish"
180 "1hfkmiyhgrx5lgrb2mffjbdn1hivrm73wcg7x0iid74p2yb0fjpp")))
182 (define-public aspell-dict-el
183 (aspell-dictionary "el" "Greek"
188 "1ljcc30zg2v2h3w5h5jr5im41mw8jbsgvvhdd2cii2yzi8d0zxja")))
190 (define-public aspell-dict-en
191 (aspell-dictionary "en" "English"
192 #:version "2019.10.06-0"
195 "1zai9wrqwgb9z9vfgb22qhrvxvg73jg0ix44j1khm2f6m96lncr4")))
197 (define-public aspell-dict-eo
198 (aspell-dictionary "eo" "Esperanto"
199 #:version "2.1.20000225a-2"
202 "09vf0mbiicbmyb4bwb7v7lgpabnylg0wy7m3hlhl5rjdda6x3lj1")))
204 (define-public aspell-dict-es
205 (aspell-dictionary "es" "Spanish"
209 "1k5g328ac1hdpp6fsg57d8md6i0aqcwlszp3gbmp5706wyhpydmd")))
211 (define-public aspell-dict-fi
212 (aspell-dictionary "fi" "Finnish"
217 "07d5s08ba4dd89cmwy9icc01i6fjdykxlb9ravmhdrhi8mxz1mzq")))
219 (define-public aspell-dict-fr
220 (aspell-dictionary "fr" "French"
225 "14ffy9mn5jqqpp437kannc3559bfdrpk7r36ljkzjalxa53i0hpr")))
227 (define-public aspell-dict-grc
228 (aspell-dictionary "grc" "Ancient Greek"
232 "1zxr8958v37v260fkqd4pg37ns5h5kyqm54hn1hg70wq5cz8h512")))
234 (define-public aspell-dict-he
235 (aspell-dictionary "he" "Hebrew"
239 "13bhbghx5b8g0119g3wxd4n8mlf707y41vlf59irxjj0kynankfn")))
241 (define-public aspell-dict-hi
242 (aspell-dictionary "hi" "Hindi"
247 "0drs374qz4419zx1lf2k281ydxf2750jk5ailafj1x0ncz27h1ys")))
249 (define-public aspell-dict-it
250 (let ((version "2.4-20070901-0")
252 (base32 "0d6ypii3jblprpibazb6ypady536jz62rwxlss1x1raq07rhvvqn")))
254 (inherit (aspell-dictionary "it" "Italian"
258 ;; The version hosted at <https://ftp.gnu.org/gnu/aspell/dict> is even
263 (uri (string-append "mirror://sourceforge/linguistico/"
264 "Dizionario%20italiano%20per%20Aspell/" version "/"
265 "aspell6-it-" version ".tar.bz2"))
268 "http://linguistico.sourceforge.net/pages/dizionario_italiano.html"))))
270 (define-public aspell-dict-mi
271 (aspell-dictionary "mi" "Maori"
275 "12bxplpd348yx8d2q8qvahi9dlp7qf28qmanzhziwc7np8rixvmy")))
277 (define-public aspell-dict-nl
278 (aspell-dictionary "nl" "Dutch"
283 "0ffb87yjsh211hllpc4b9khqqrblial4pzi1h9r3v465z1yhn3j4")))
285 (define-public aspell-dict-nn
286 (aspell-dictionary "nn" "Norwegian Nynorsk"
290 "0w2k5l5rbqpliripgqwiqixz5ghnjf7i9ggbrc4ly4vy1ia10rmc")))
292 (define-public aspell-dict-pt-br
293 (aspell-dictionary "pt_BR" "Brazilian Portuguese"
294 #:version "20131030-12-0"
297 "1xqlpk21s93c6blkdnpk7l62q9fxjvzdv2x86chl8p2x1gdrj3gb")))
299 (define-public aspell-dict-pt-pt
300 (aspell-dictionary "pt_PT" "Portuguese"
301 #:version "20190329-1-0"
304 "0ld0d0ily4jqifjfsxfv4shbicz6ymm2gk56fq9gbzra1j4qnw75")))
306 (define-public aspell-dict-ru
307 (aspell-dictionary "ru" "Russian"
311 "0ip6nq43hcr7vvzbv4lwwmlwgfa60hrhsldh9xy3zg2prv6bcaaw")))
313 (define-public aspell-dict-sv
314 (aspell-dictionary "sv" "Swedish"
319 "02jwkjhr32kvyibnyzgx3smbnm576jwdzg3avdf6zxwckhy5fw4v")))
321 (define-public aspell-dict-uk
322 (aspell-dictionary "uk" "Ukrainian"
326 "137i4njvnslab6l4s291s11xijr5jsy75lbdph32f9y183lagy9m")))
330 ;;; Hunspell packages made from the Aspell word lists.
333 (define* (aspell-word-list language synopsis
335 (nick (string-map (lambda (chr)
339 (string-downcase language))))
341 (name (string-append "hunspell-dict-" nick))
342 (version "2018.04.16")
346 "http://downloads.sourceforge.net/wordlist/scowl-"
350 "11lkrnhwrf5mvrrq45k4mads3n9aswgac8dc25ba61c75alxb5rs"))))
356 (build-system gnu-build-system)
359 (modify-phases %standard-phases
364 (substitute* "speller/make-hunspell-dict"
367 (mkdir "speller/hunspell")
369 ;; XXX: This actually builds all the dictionary variants.
370 (invoke "make" "-C" "speller" "hunspell")))
372 (lambda* (#:key outputs #:allow-other-keys)
373 (let* ((out (assoc-ref %outputs "out"))
374 (hunspell (string-append out "/share/hunspell"))
375 (myspell (string-append out "/share/myspell"))
376 (doc (string-append out "/share/doc/"
378 (dot-dic ,(string-append "speller/" language ".dic")))
381 ;; Usually there's only a 'LANGUAGE.dic' file, but for the "en"
382 ;; dictionary, there no 'en.dic'. Instead, there's a set of
383 ;; 'en*.dic' files, hence the 'find-files' call below.
384 (if (file-exists? dot-dic)
385 (install-file dot-dic hunspell)
386 (for-each (lambda (dic)
387 (install-file dic hunspell))
388 (find-files "speller"
389 ,(string-append language ".*\\.dic$"))))
391 (install-file ,(string-append "speller/" language ".aff")
393 (symlink hunspell (string-append myspell "/dicts"))
394 (for-each (lambda (file)
395 (install-file file doc))
397 "^(Copyright|.*\\.(txt|org|md))$"))
401 "This package provides a dictionary for the Hunspell spell-checking
403 (home-page "http://wordlist.aspell.net/")
404 (license (non-copyleft "file://Copyright"
405 "Word lists come from several sources, all
406 under permissive licensing terms. See the 'Copyright' file."))))
408 (define-syntax define-word-list-dictionary
409 (syntax-rules (synopsis)
410 ((_ name language (synopsis text))
412 (aspell-word-list language text)))
413 ((_ name language nick (synopsis text))
415 (aspell-word-list language text nick)))))
417 (define-word-list-dictionary hunspell-dict-en
419 (synopsis "Hunspell dictionary for English"))
421 (define-word-list-dictionary hunspell-dict-en-au
423 (synopsis "Hunspell dictionary for Australian English"))
425 (define-word-list-dictionary hunspell-dict-en-ca
427 (synopsis "Hunspell dictionary for Canadian English"))
429 (define-word-list-dictionary hunspell-dict-en-gb
431 (synopsis "Hunspell dictionary for British English, with -ise endings"))
433 (define-word-list-dictionary hunspell-dict-en-gb-ize
435 (synopsis "Hunspell dictionary for British English, with -ize endings"))
437 (define-word-list-dictionary hunspell-dict-en-us
439 (synopsis "Hunspell dictionary for United States English"))