1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2017, 2018 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>
10 ;;; Copyright © 2020 Timotej Lazar <timotej.lazar@araneo.si>
12 ;;; This file is part of GNU Guix.
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27 (define-module (gnu packages aspell)
28 #:use-module (guix packages)
29 #:use-module (guix download)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix licenses)
32 #:use-module (guix utils)
33 #:use-module (gnu packages)
34 #:use-module (gnu packages base)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages perl)
37 #:use-module (ice-9 match))
46 (uri (string-append "mirror://gnu/aspell/aspell-"
50 "1qgn5psfyhbrnap275xjfrzppf5a83fb67gpql0kfqv37al869gm"))
51 (patches (search-patches "aspell-default-dict-dir.patch"
52 "aspell-gcc-compat.patch"))))
53 (build-system gnu-build-system)
56 (modify-phases %standard-phases
57 (add-before 'build 'set-filter-path
58 (lambda* (#:key outputs #:allow-other-keys)
59 ;; Change the default value of 'filter-path' so that filters such
60 ;; as 'tex-filter.so' can be found. By default none of the
61 ;; filters would be found.
62 (let* ((out (assoc-ref outputs "out"))
63 (libdir (string-append out "/lib/aspell-"
64 ,(version-major+minor version))))
65 (substitute* "common/config.cpp"
66 (("\"filter-path(.*)DICT_DIR" _ middle)
67 (string-append "\"filter-path" middle
70 (add-after 'install 'wrap-aspell
71 (lambda* (#:key outputs #:allow-other-keys)
72 (let ((bin/aspell (string-append (assoc-ref outputs "out")
74 (wrap-program bin/aspell
76 ("${ASPELL_CONF:-\"dict-dir ${GUIX_PROFILE:-$HOME/.guix-profile}/lib/aspell\"}")))
78 (inputs `(("perl" ,perl)))
81 ;; This is a Guix-specific environment variable that takes a single
82 ;; entry, not an actual search path.
83 (list (search-path-specification
84 (variable "ASPELL_DICT_DIR")
86 (files '("lib/aspell")))))
88 (home-page "http://aspell.net/")
89 (synopsis "Spell checker")
91 "Aspell is a spell-checker which can be used either as a library or as
92 a standalone program. Notable features of Aspell include its full support of
93 documents written in the UTF-8 encoding and its ability to use multiple
94 dictionaries, including personal ones.")
100 ;;; Use 'export ASPELL_CONF="dict-dir $HOME/.guix-profile/lib/aspell"' to use
101 ;;; them, or set the Guix-specific 'ASPELL_DICT_DIR', or just do nothing (as
102 ;;; long as 'HOME' is set, that's fine!).
105 (define* (aspell-dictionary dict-name full-name
106 #:key version sha256 (prefix "aspell6-"))
110 ;; Downcase and replace underscore in package names
111 ;; to follow Guix naming conventions.
112 (string-map (match-lambda
115 (string-downcase dict-name))))
119 (uri (string-append "mirror://gnu/aspell/dict/" dict-name
120 "/" prefix dict-name "-"
123 (build-system gnu-build-system)
126 (modify-phases %standard-phases
128 (lambda* (#:key outputs #:allow-other-keys)
129 (let ((out (assoc-ref outputs "out")))
130 (invoke "./configure")))))
132 (let ((out (assoc-ref %outputs "out")))
133 (list (string-append "dictdir=" out "/lib/aspell")
134 (string-append "datadir=" out "/lib/aspell")))
136 (native-inputs `(("aspell" ,aspell)
138 (synopsis (string-append full-name " dictionary for GNU Aspell")) ; XXX: i18n
140 "This package provides a dictionary for the GNU Aspell spell checker.")
142 (home-page "http://aspell.net/")))
145 (define-public aspell-dict-ar
146 (aspell-dictionary "ar" "Arabic"
151 "1avw40bp8yi5bnkq64ihm2rldgw34lk89yz281q9bmndh95a47h4")))
153 (define-public aspell-dict-be
154 (aspell-dictionary "be" "Belarusian"
159 "1svls9p7rsfi3hs0afh0cssj006qb4v1ik2yzqgj8hm10c6as2sm")))
161 (define-public aspell-dict-ca
162 (let ((version "2.5.0")
164 (base32 "0kbi8fi7a1bys31kfqrlh332gyik0cfdmxgl7n15sa9c305rkgwq")))
166 (inherit (aspell-dictionary "ca" "Catalan"
172 (uri (string-append "https://www.softcatala.org/pub/softcatala/aspell/"
173 version "/aspell6-ca-" version ".tar.bz2"))
175 (home-page "https://www.softcatala.org/pub/softcatala/aspell/"))))
177 (define-public aspell-dict-de
178 (aspell-dictionary "de" "German"
179 #:version "20161207-7-0"
182 "0wamclvp66xfmv5wff96v6gdlnfv4y8lx3f8wvxyzm5imwgms4n2")))
184 (define-public aspell-dict-da
185 (aspell-dictionary "da" "Danish"
190 "1hfkmiyhgrx5lgrb2mffjbdn1hivrm73wcg7x0iid74p2yb0fjpp")))
192 (define-public aspell-dict-el
193 (aspell-dictionary "el" "Greek"
198 "1ljcc30zg2v2h3w5h5jr5im41mw8jbsgvvhdd2cii2yzi8d0zxja")))
200 (define-public aspell-dict-en
201 (aspell-dictionary "en" "English"
202 #:version "2019.10.06-0"
205 "1zai9wrqwgb9z9vfgb22qhrvxvg73jg0ix44j1khm2f6m96lncr4")))
207 (define-public aspell-dict-eo
208 (aspell-dictionary "eo" "Esperanto"
209 #:version "2.1.20000225a-2"
212 "09vf0mbiicbmyb4bwb7v7lgpabnylg0wy7m3hlhl5rjdda6x3lj1")))
214 (define-public aspell-dict-es
215 (aspell-dictionary "es" "Spanish"
219 "1k5g328ac1hdpp6fsg57d8md6i0aqcwlszp3gbmp5706wyhpydmd")))
221 (define-public aspell-dict-fi
222 (aspell-dictionary "fi" "Finnish"
227 "07d5s08ba4dd89cmwy9icc01i6fjdykxlb9ravmhdrhi8mxz1mzq")))
229 (define-public aspell-dict-fr
230 (aspell-dictionary "fr" "French"
235 "14ffy9mn5jqqpp437kannc3559bfdrpk7r36ljkzjalxa53i0hpr")))
237 (define-public aspell-dict-grc
238 (aspell-dictionary "grc" "Ancient Greek"
242 "1zxr8958v37v260fkqd4pg37ns5h5kyqm54hn1hg70wq5cz8h512")))
244 (define-public aspell-dict-he
245 (aspell-dictionary "he" "Hebrew"
249 "13bhbghx5b8g0119g3wxd4n8mlf707y41vlf59irxjj0kynankfn")))
251 (define-public aspell-dict-hi
252 (aspell-dictionary "hi" "Hindi"
257 "0drs374qz4419zx1lf2k281ydxf2750jk5ailafj1x0ncz27h1ys")))
259 (define-public aspell-dict-it
260 (let ((version "2.4-20070901-0")
262 (base32 "0d6ypii3jblprpibazb6ypady536jz62rwxlss1x1raq07rhvvqn")))
264 (inherit (aspell-dictionary "it" "Italian"
268 ;; The version hosted at <https://ftp.gnu.org/gnu/aspell/dict> is even
273 (uri (string-append "mirror://sourceforge/linguistico/"
274 "Dizionario%20italiano%20per%20Aspell/" version "/"
275 "aspell6-it-" version ".tar.bz2"))
278 "http://linguistico.sourceforge.net/pages/dizionario_italiano.html"))))
280 (define-public aspell-dict-mi
281 (aspell-dictionary "mi" "Maori"
285 "12bxplpd348yx8d2q8qvahi9dlp7qf28qmanzhziwc7np8rixvmy")))
287 (define-public aspell-dict-nl
288 (aspell-dictionary "nl" "Dutch"
293 "0ffb87yjsh211hllpc4b9khqqrblial4pzi1h9r3v465z1yhn3j4")))
295 (define-public aspell-dict-nn
296 (aspell-dictionary "nn" "Norwegian Nynorsk"
300 "0w2k5l5rbqpliripgqwiqixz5ghnjf7i9ggbrc4ly4vy1ia10rmc")))
302 (define-public aspell-dict-pt-br
303 (aspell-dictionary "pt_BR" "Brazilian Portuguese"
304 #:version "20131030-12-0"
307 "1xqlpk21s93c6blkdnpk7l62q9fxjvzdv2x86chl8p2x1gdrj3gb")))
309 (define-public aspell-dict-pt-pt
310 (aspell-dictionary "pt_PT" "Portuguese"
311 #:version "20190329-1-0"
314 "0ld0d0ily4jqifjfsxfv4shbicz6ymm2gk56fq9gbzra1j4qnw75")))
316 (define-public aspell-dict-ru
317 (aspell-dictionary "ru" "Russian"
321 "0ip6nq43hcr7vvzbv4lwwmlwgfa60hrhsldh9xy3zg2prv6bcaaw")))
323 (define-public aspell-dict-sl
324 (aspell-dictionary "sl" "Slovenian"
329 "1l9kc5g35flq8kw9jhn2n0bjb4sipjs4qkqzgggs438kywkx2rp5")))
331 (define-public aspell-dict-sv
332 (aspell-dictionary "sv" "Swedish"
337 "02jwkjhr32kvyibnyzgx3smbnm576jwdzg3avdf6zxwckhy5fw4v")))
339 (define-public aspell-dict-uk
340 (aspell-dictionary "uk" "Ukrainian"
344 "137i4njvnslab6l4s291s11xijr5jsy75lbdph32f9y183lagy9m")))
348 ;;; Hunspell packages made from the Aspell word lists.
351 (define* (aspell-word-list language synopsis
353 (nick (string-map (lambda (chr)
357 (string-downcase language))))
359 (name (string-append "hunspell-dict-" nick))
360 (version "2018.04.16")
364 "http://downloads.sourceforge.net/wordlist/scowl-"
368 "11lkrnhwrf5mvrrq45k4mads3n9aswgac8dc25ba61c75alxb5rs"))))
374 (build-system gnu-build-system)
377 (modify-phases %standard-phases
382 (substitute* "speller/make-hunspell-dict"
385 (mkdir "speller/hunspell")
387 ;; XXX: This actually builds all the dictionary variants.
388 (invoke "make" "-C" "speller" "hunspell")))
390 (lambda* (#:key outputs #:allow-other-keys)
391 (let* ((out (assoc-ref %outputs "out"))
392 (hunspell (string-append out "/share/hunspell"))
393 (myspell (string-append out "/share/myspell"))
394 (doc (string-append out "/share/doc/"
396 (dot-dic ,(string-append "speller/" language ".dic")))
399 ;; Usually there's only a 'LANGUAGE.dic' file, but for the "en"
400 ;; dictionary, there no 'en.dic'. Instead, there's a set of
401 ;; 'en*.dic' files, hence the 'find-files' call below.
402 (if (file-exists? dot-dic)
403 (install-file dot-dic hunspell)
404 (for-each (lambda (dic)
405 (install-file dic hunspell))
406 (find-files "speller"
407 ,(string-append language ".*\\.dic$"))))
409 (install-file ,(string-append "speller/" language ".aff")
411 (symlink hunspell (string-append myspell "/dicts"))
412 (for-each (lambda (file)
413 (install-file file doc))
415 "^(Copyright|.*\\.(txt|org|md))$"))
419 "This package provides a dictionary for the Hunspell spell-checking
421 (home-page "http://wordlist.aspell.net/")
422 (license (non-copyleft "file://Copyright"
423 "Word lists come from several sources, all
424 under permissive licensing terms. See the 'Copyright' file."))))
426 (define-syntax define-word-list-dictionary
427 (syntax-rules (synopsis)
428 ((_ name language (synopsis text))
430 (aspell-word-list language text)))
431 ((_ name language nick (synopsis text))
433 (aspell-word-list language text nick)))))
435 (define-word-list-dictionary hunspell-dict-en
437 (synopsis "Hunspell dictionary for English"))
439 (define-word-list-dictionary hunspell-dict-en-au
441 (synopsis "Hunspell dictionary for Australian English"))
443 (define-word-list-dictionary hunspell-dict-en-ca
445 (synopsis "Hunspell dictionary for Canadian English"))
447 (define-word-list-dictionary hunspell-dict-en-gb
449 (synopsis "Hunspell dictionary for British English, with -ise endings"))
451 (define-word-list-dictionary hunspell-dict-en-gb-ize
453 (synopsis "Hunspell dictionary for British English, with -ize endings"))
455 (define-word-list-dictionary hunspell-dict-en-us
457 (synopsis "Hunspell dictionary for United States English"))