gnu: ruby-pandoc-ruby: Use pandoc instead of ghc-pandoc.
[jackhill/guix/guix.git] / gnu / packages / aspell.scm
CommitLineData
708d0ceb 1;;; GNU Guix --- Functional package management for GNU
ce0be567 2;;; Copyright © 2013, 2014, 2015, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
0833d0c0 3;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com>
8553fe57 4;;; Copyright © 2016 John Darrington <jmd@gnu.org>
210e43c7 5;;; Copyright © 2016, 2017, 2019 Efraim Flashner <efraim@flashner.co.il>
4cf9f57b 6;;; Copyright © 2016 Christopher Andersson <christopher@8bits.nu>
d109b1e8 7;;; Copyright © 2016 Theodoros Foradis <theodoros@foradis.org>
8dbd8e42 8;;; Copyright © 2016, 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
964595dd 9;;; Copyright © 2019 Jens Mølgaard <jens@zete.tk>
5e8a7edc 10;;; Copyright © 2020 Timotej Lazar <timotej.lazar@araneo.si>
e118837e 11;;; Copyright © 2020 Marcin Karpezo <sirmacik@wioo.waw.pl>
708d0ceb
LC
12;;;
13;;; This file is part of GNU Guix.
14;;;
15;;; GNU Guix is free software; you can redistribute it and/or modify it
16;;; under the terms of the GNU General Public License as published by
17;;; the Free Software Foundation; either version 3 of the License, or (at
18;;; your option) any later version.
19;;;
20;;; GNU Guix is distributed in the hope that it will be useful, but
21;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23;;; GNU General Public License for more details.
24;;;
25;;; You should have received a copy of the GNU General Public License
26;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27
1ffa7090 28(define-module (gnu packages aspell)
708d0ceb
LC
29 #:use-module (guix packages)
30 #:use-module (guix download)
31 #:use-module (guix build-system gnu)
32 #:use-module (guix licenses)
a2908f5a 33 #:use-module (guix utils)
6d35b1c9 34 #:use-module (gnu packages)
085bcca3
LC
35 #:use-module (gnu packages base)
36 #:use-module (gnu packages compression)
cd37b144
JM
37 #:use-module (gnu packages perl)
38 #:use-module (ice-9 match))
708d0ceb
LC
39
40(define-public aspell
41 (package
42 (name "aspell")
2387e2f2 43 (version "0.60.8")
708d0ceb
LC
44 (source
45 (origin
46 (method url-fetch)
47 (uri (string-append "mirror://gnu/aspell/aspell-"
48 version ".tar.gz"))
49 (sha256
50 (base32
2387e2f2
LC
51 "1wi60ankalmh8ds7nplz434jd7j94gdvbahdwsr539rlad8pxdzr"))
52 (patches (search-patches "aspell-default-dict-dir.patch"))))
708d0ceb 53 (build-system gnu-build-system)
81fc64da
FB
54 (arguments
55 `(#:phases
56 (modify-phases %standard-phases
a2908f5a
LC
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
68 "\"" libdir "\"")))
d3da21d2 69 #t))))))
708d0ceb 70 (inputs `(("perl" ,perl)))
6d35b1c9
LC
71
72 (native-search-paths
73 ;; This is a Guix-specific environment variable that takes a single
74 ;; entry, not an actual search path.
75 (list (search-path-specification
76 (variable "ASPELL_DICT_DIR")
77 (separator #f)
78 (files '("lib/aspell")))))
79
708d0ceb 80 (home-page "http://aspell.net/")
f50d2669 81 (synopsis "Spell checker")
708d0ceb 82 (description
a22dc0c4
LC
83 "Aspell is a spell-checker which can be used either as a library or as
84a standalone program. Notable features of Aspell include its full support of
85documents written in the UTF-8 encoding and its ability to use multiple
86dictionaries, including personal ones.")
708d0ceb 87 (license lgpl2.1+)))
15756a7a 88
15756a7a
LC
89;;;
90;;; Dictionaries.
91;;;
707ee324 92;;; Use 'export ASPELL_CONF="dict-dir $HOME/.guix-profile/lib/aspell"' to use
6d35b1c9
LC
93;;; them, or set the Guix-specific 'ASPELL_DICT_DIR', or just do nothing (as
94;;; long as 'HOME' is set, that's fine!).
15756a7a
LC
95;;;
96
97(define* (aspell-dictionary dict-name full-name
98 #:key version sha256 (prefix "aspell6-"))
99 (package
cd37b144
JM
100 (name (string-append
101 "aspell-dict-"
102 ;; Downcase and replace underscore in package names
103 ;; to follow Guix naming conventions.
104 (string-map (match-lambda
105 (#\_ #\-)
106 (chr chr))
107 (string-downcase dict-name))))
15756a7a
LC
108 (version version)
109 (source (origin
110 (method url-fetch)
111 (uri (string-append "mirror://gnu/aspell/dict/" dict-name
112 "/" prefix dict-name "-"
113 version ".tar.bz2"))
ce0be567 114 (hash (content-hash sha256))))
15756a7a
LC
115 (build-system gnu-build-system)
116 (arguments
707ee324
TGR
117 `(#:phases
118 (modify-phases %standard-phases
119 (replace 'configure
120 (lambda* (#:key outputs #:allow-other-keys)
121 (let ((out (assoc-ref outputs "out")))
5f55ca21 122 (invoke "./configure")))))
707ee324
TGR
123 #:make-flags
124 (let ((out (assoc-ref %outputs "out")))
125 (list (string-append "dictdir=" out "/lib/aspell")
126 (string-append "datadir=" out "/lib/aspell")))
127 #:tests? #f))
15756a7a
LC
128 (native-inputs `(("aspell" ,aspell)
129 ("which" ,which)))
130 (synopsis (string-append full-name " dictionary for GNU Aspell")) ; XXX: i18n
131 (description
132 "This package provides a dictionary for the GNU Aspell spell checker.")
133 (license gpl2+)
134 (home-page "http://aspell.net/")))
135
99b9857b 136
964595dd
JM
137(define-public aspell-dict-ar
138 (aspell-dictionary "ar" "Arabic"
139 #:version "1.2-0"
140 #:prefix "aspell6-"
141 #:sha256
142 (base32
143 "1avw40bp8yi5bnkq64ihm2rldgw34lk89yz281q9bmndh95a47h4")))
144
8ac3476d
JM
145(define-public aspell-dict-be
146 (aspell-dictionary "be" "Belarusian"
147 #:version "0.01"
148 #:prefix "aspell5-"
149 #:sha256
150 (base32
151 "1svls9p7rsfi3hs0afh0cssj006qb4v1ik2yzqgj8hm10c6as2sm")))
152
99b9857b 153(define-public aspell-dict-ca
9b451091
TGR
154 (let ((version "2.5.0")
155 (sha256
156 (base32 "0kbi8fi7a1bys31kfqrlh332gyik0cfdmxgl7n15sa9c305rkgwq")))
157 (package
158 (inherit (aspell-dictionary "ca" "Catalan"
159 #:version version
160 #:sha256 sha256))
161 (source
162 (origin
163 (method url-fetch)
164 (uri (string-append "https://www.softcatala.org/pub/softcatala/aspell/"
165 version "/aspell6-ca-" version ".tar.bz2"))
ce0be567 166 (hash (content-hash sha256))))
9b451091 167 (home-page "https://www.softcatala.org/pub/softcatala/aspell/"))))
15756a7a 168
06550e07
JD
169(define-public aspell-dict-de
170 (aspell-dictionary "de" "German"
4dfc7369 171 #:version "20161207-7-0"
06550e07
JD
172 #:sha256
173 (base32
4dfc7369 174 "0wamclvp66xfmv5wff96v6gdlnfv4y8lx3f8wvxyzm5imwgms4n2")))
06550e07 175
4bb9528c
JM
176(define-public aspell-dict-da
177 (aspell-dictionary "da" "Danish"
ecc8c5d4 178 #:version "1.6.36-11-0"
4bb9528c
JM
179 #:sha256
180 (base32
ecc8c5d4 181 "1xz2haayvwlxgss9jf1x2311a1ixbk75q2vgfprjhibsmb7cpinv")))
4bb9528c 182
74a40ddd
EF
183(define-public aspell-dict-el
184 (aspell-dictionary "el" "Greek"
185 #:version "0.08-0"
186 #:prefix "aspell6-"
187 #:sha256
188 (base32
189 "1ljcc30zg2v2h3w5h5jr5im41mw8jbsgvvhdd2cii2yzi8d0zxja")))
190
15756a7a
LC
191(define-public aspell-dict-en
192 (aspell-dictionary "en" "English"
9d0abf0f 193 #:version "2019.10.06-0"
15756a7a
LC
194 #:sha256
195 (base32
9d0abf0f 196 "1zai9wrqwgb9z9vfgb22qhrvxvg73jg0ix44j1khm2f6m96lncr4")))
15756a7a
LC
197
198(define-public aspell-dict-eo
199 (aspell-dictionary "eo" "Esperanto"
200 #:version "2.1.20000225a-2"
201 #:sha256
202 (base32
203 "09vf0mbiicbmyb4bwb7v7lgpabnylg0wy7m3hlhl5rjdda6x3lj1")))
204
205(define-public aspell-dict-es
206 (aspell-dictionary "es" "Spanish"
207 #:version "1.11-2"
208 #:sha256
209 (base32
210 "1k5g328ac1hdpp6fsg57d8md6i0aqcwlszp3gbmp5706wyhpydmd")))
211
c066a050
JM
212(define-public aspell-dict-fi
213 (aspell-dictionary "fi" "Finnish"
214 #:version "0.7-0"
215 #:prefix "aspell6-"
216 #:sha256
217 (base32
218 "07d5s08ba4dd89cmwy9icc01i6fjdykxlb9ravmhdrhi8mxz1mzq")))
219
15756a7a
LC
220(define-public aspell-dict-fr
221 (aspell-dictionary "fr" "French"
222 #:version "0.50-3"
223 #:prefix "aspell-"
224 #:sha256
225 (base32
226 "14ffy9mn5jqqpp437kannc3559bfdrpk7r36ljkzjalxa53i0hpr")))
5d9ecd15 227
74a40ddd
EF
228(define-public aspell-dict-grc
229 (aspell-dictionary "grc" "Ancient Greek"
230 #:version "0.02-0"
5d9ecd15
AK
231 #:sha256
232 (base32
74a40ddd
EF
233 "1zxr8958v37v260fkqd4pg37ns5h5kyqm54hn1hg70wq5cz8h512")))
234
235(define-public aspell-dict-he
236 (aspell-dictionary "he" "Hebrew"
237 #:version "1.0-0"
238 #:sha256
239 (base32
240 "13bhbghx5b8g0119g3wxd4n8mlf707y41vlf59irxjj0kynankfn")))
3a6a0f60 241
77fe5258
JM
242(define-public aspell-dict-hi
243 (aspell-dictionary "hi" "Hindi"
244 #:version "0.02-0"
245 #:prefix "aspell6-"
246 #:sha256
247 (base32
248 "0drs374qz4419zx1lf2k281ydxf2750jk5ailafj1x0ncz27h1ys")))
249
3a6a0f60 250(define-public aspell-dict-it
8dbd8e42
TGR
251 (let ((version "2.4-20070901-0")
252 (sha256
253 (base32 "0d6ypii3jblprpibazb6ypady536jz62rwxlss1x1raq07rhvvqn")))
254 (package
255 (inherit (aspell-dictionary "it" "Italian"
256 #:version version
257 #:sha256 sha256))
258
259 ;; The version hosted at <https://ftp.gnu.org/gnu/aspell/dict> is even
260 ;; more out of date.
261 (source
262 (origin
263 (method url-fetch)
264 (uri (string-append "mirror://sourceforge/linguistico/"
265 "Dizionario%20italiano%20per%20Aspell/" version "/"
266 "aspell6-it-" version ".tar.bz2"))
ce0be567 267 (hash (content-hash sha256))))
8dbd8e42
TGR
268 (home-page
269 "http://linguistico.sourceforge.net/pages/dizionario_italiano.html"))))
467c498b 270
c5a88aa0
JM
271(define-public aspell-dict-mi
272 (aspell-dictionary "mi" "Maori"
273 #:version "0.50-0"
274 #:sha256
275 (base32
276 "12bxplpd348yx8d2q8qvahi9dlp7qf28qmanzhziwc7np8rixvmy")))
277
467c498b
JR
278(define-public aspell-dict-nl
279 (aspell-dictionary "nl" "Dutch"
280 #:version "0.50-2"
281 #:prefix "aspell-"
282 #:sha256
283 (base32
284 "0ffb87yjsh211hllpc4b9khqqrblial4pzi1h9r3v465z1yhn3j4")))
8553fe57 285
c9400f03
JM
286(define-public aspell-dict-nn
287 (aspell-dictionary "nn" "Norwegian Nynorsk"
288 #:version "0.50.1-1"
289 #:sha256
290 (base32
291 "0w2k5l5rbqpliripgqwiqixz5ghnjf7i9ggbrc4ly4vy1ia10rmc")))
292
e118837e
MK
293(define-public aspell-dict-pl
294 (aspell-dictionary "pl" "Polish"
295 #:version "0.51-0"
296 #:sha256
297 (base32
298 "1a3ccji6k5gys7l3ilr2lh5pzxgzb7ipc5vb737svl6nqgdy8757")))
299
74a40ddd 300(define-public aspell-dict-pt-br
cd37b144 301 (aspell-dictionary "pt_BR" "Brazilian Portuguese"
947141fd 302 #:version "20131030-12-0"
8553fe57
EF
303 #:sha256
304 (base32
947141fd 305 "1xqlpk21s93c6blkdnpk7l62q9fxjvzdv2x86chl8p2x1gdrj3gb")))
74a40ddd 306
a1fa54f0 307(define-public aspell-dict-pt-pt
cd37b144 308 (aspell-dictionary "pt_PT" "Portuguese"
9eb6d712 309 #:version "20190329-1-0"
a1fa54f0
JM
310 #:sha256
311 (base32
9eb6d712 312 "0ld0d0ily4jqifjfsxfv4shbicz6ymm2gk56fq9gbzra1j4qnw75")))
a1fa54f0 313
74a40ddd
EF
314(define-public aspell-dict-ru
315 (aspell-dictionary "ru" "Russian"
316 #:version "0.99f7-1"
317 #:sha256
318 (base32
319 "0ip6nq43hcr7vvzbv4lwwmlwgfa60hrhsldh9xy3zg2prv6bcaaw")))
4cf9f57b 320
5e8a7edc
TL
321(define-public aspell-dict-sl
322 (aspell-dictionary "sl" "Slovenian"
323 #:version "0.50-0"
324 #:prefix "aspell-"
325 #:sha256
326 (base32
327 "1l9kc5g35flq8kw9jhn2n0bjb4sipjs4qkqzgggs438kywkx2rp5")))
328
4cf9f57b
CA
329(define-public aspell-dict-sv
330 (aspell-dictionary "sv" "Swedish"
331 #:version "0.51-0"
332 #:prefix "aspell-"
333 #:sha256
334 (base32
335 "02jwkjhr32kvyibnyzgx3smbnm576jwdzg3avdf6zxwckhy5fw4v")))
850812de 336
e77dd15a
JM
337(define-public aspell-dict-uk
338 (aspell-dictionary "uk" "Ukrainian"
339 #:version "1.4.0-0"
340 #:sha256
341 (base32
342 "137i4njvnslab6l4s291s11xijr5jsy75lbdph32f9y183lagy9m")))
343
085bcca3
LC
344\f
345;;;
346;;; Hunspell packages made from the Aspell word lists.
347;;;
348
349(define* (aspell-word-list language synopsis
350 #:optional
351 (nick (string-map (lambda (chr)
352 (if (char=? #\_ chr)
353 #\-
354 chr))
355 (string-downcase language))))
356 (package
357 (name (string-append "hunspell-dict-" nick))
210e43c7 358 (version "2018.04.16")
085bcca3
LC
359 (source (origin
360 (method url-fetch)
361 (uri (string-append
362 "http://downloads.sourceforge.net/wordlist/scowl-"
363 version ".tar.gz"))
364 (sha256
365 (base32
210e43c7 366 "11lkrnhwrf5mvrrq45k4mads3n9aswgac8dc25ba61c75alxb5rs"))))
085bcca3
LC
367 (native-inputs
368 `(("tar" ,tar)
369 ("gzip" ,gzip)
370 ("perl" ,perl)
371 ("aspell" ,aspell)))
372 (build-system gnu-build-system)
373 (arguments
374 `(#:phases
375 (modify-phases %standard-phases
376 (delete 'configure)
377 (delete 'check)
378 (replace 'build
379 (lambda _
380 (substitute* "speller/make-hunspell-dict"
381 (("zip -9 .*$")
382 "return\n"))
383 (mkdir "speller/hunspell")
384
385 ;; XXX: This actually builds all the dictionary variants.
210e43c7 386 (invoke "make" "-C" "speller" "hunspell")))
085bcca3
LC
387 (replace 'install
388 (lambda* (#:key outputs #:allow-other-keys)
389 (let* ((out (assoc-ref %outputs "out"))
390 (hunspell (string-append out "/share/hunspell"))
391 (myspell (string-append out "/share/myspell"))
392 (doc (string-append out "/share/doc/"
22c334fa
LC
393 ,name))
394 (dot-dic ,(string-append "speller/" language ".dic")))
085bcca3 395 (mkdir-p myspell)
22c334fa
LC
396
397 ;; Usually there's only a 'LANGUAGE.dic' file, but for the "en"
398 ;; dictionary, there no 'en.dic'. Instead, there's a set of
399 ;; 'en*.dic' files, hence the 'find-files' call below.
400 (if (file-exists? dot-dic)
401 (install-file dot-dic hunspell)
402 (for-each (lambda (dic)
403 (install-file dic hunspell))
404 (find-files "speller"
405 ,(string-append language ".*\\.dic$"))))
406
2a29f476
JL
407 ;; Install affix files corresponding to installed dictionaries
408 (for-each (lambda (dic)
409 (install-file (string-append
410 "speller/" (basename dic ".dic") ".aff")
411 hunspell))
412 (find-files hunspell ".*\\.dic$"))
085bcca3
LC
413 (symlink hunspell (string-append myspell "/dicts"))
414 (for-each (lambda (file)
415 (install-file file doc))
416 (find-files "."
417 "^(Copyright|.*\\.(txt|org|md))$"))
418 #t))))))
419 (synopsis synopsis)
420 (description
421 "This package provides a dictionary for the Hunspell spell-checking
422library.")
423 (home-page "http://wordlist.aspell.net/")
424 (license (non-copyleft "file://Copyright"
425 "Word lists come from several sources, all
426under permissive licensing terms. See the 'Copyright' file."))))
427
428(define-syntax define-word-list-dictionary
429 (syntax-rules (synopsis)
430 ((_ name language (synopsis text))
431 (define-public name
432 (aspell-word-list language text)))
433 ((_ name language nick (synopsis text))
434 (define-public name
435 (aspell-word-list language text nick)))))
436
437(define-word-list-dictionary hunspell-dict-en
438 "en"
439 (synopsis "Hunspell dictionary for English"))
440
441(define-word-list-dictionary hunspell-dict-en-au
442 "en_AU"
443 (synopsis "Hunspell dictionary for Australian English"))
444
445(define-word-list-dictionary hunspell-dict-en-ca
446 "en_CA"
447 (synopsis "Hunspell dictionary for Canadian English"))
448
449(define-word-list-dictionary hunspell-dict-en-gb
450 "en_GB-ise" "en-gb"
451 (synopsis "Hunspell dictionary for British English, with -ise endings"))
452
453(define-word-list-dictionary hunspell-dict-en-gb-ize
454 "en_GB-ize"
455 (synopsis "Hunspell dictionary for British English, with -ize endings"))
456
457(define-word-list-dictionary hunspell-dict-en-us
458 "en_US"
459 (synopsis "Hunspell dictionary for United States English"))