Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / aspell.scm
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>
10 ;;; Copyright © 2020 Timotej Lazar <timotej.lazar@araneo.si>
11 ;;;
12 ;;; This file is part of GNU Guix.
13 ;;;
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.
18 ;;;
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.
23 ;;;
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/>.
26
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))
38
39 (define-public aspell
40 (package
41 (name "aspell")
42 (version "0.60.8")
43 (source
44 (origin
45 (method url-fetch)
46 (uri (string-append "mirror://gnu/aspell/aspell-"
47 version ".tar.gz"))
48 (sha256
49 (base32
50 "1wi60ankalmh8ds7nplz434jd7j94gdvbahdwsr539rlad8pxdzr"))
51 (patches (search-patches "aspell-default-dict-dir.patch"))))
52 (build-system gnu-build-system)
53 (arguments
54 `(#:phases
55 (modify-phases %standard-phases
56 (add-before 'build 'set-filter-path
57 (lambda* (#:key outputs #:allow-other-keys)
58 ;; Change the default value of 'filter-path' so that filters such
59 ;; as 'tex-filter.so' can be found. By default none of the
60 ;; filters would be found.
61 (let* ((out (assoc-ref outputs "out"))
62 (libdir (string-append out "/lib/aspell-"
63 ,(version-major+minor version))))
64 (substitute* "common/config.cpp"
65 (("\"filter-path(.*)DICT_DIR" _ middle)
66 (string-append "\"filter-path" middle
67 "\"" libdir "\"")))
68 #t))))))
69 (inputs `(("perl" ,perl)))
70
71 (native-search-paths
72 ;; This is a Guix-specific environment variable that takes a single
73 ;; entry, not an actual search path.
74 (list (search-path-specification
75 (variable "ASPELL_DICT_DIR")
76 (separator #f)
77 (files '("lib/aspell")))))
78
79 (home-page "http://aspell.net/")
80 (synopsis "Spell checker")
81 (description
82 "Aspell is a spell-checker which can be used either as a library or as
83 a standalone program. Notable features of Aspell include its full support of
84 documents written in the UTF-8 encoding and its ability to use multiple
85 dictionaries, including personal ones.")
86 (license lgpl2.1+)))
87
88 ;;;
89 ;;; Dictionaries.
90 ;;;
91 ;;; Use 'export ASPELL_CONF="dict-dir $HOME/.guix-profile/lib/aspell"' to use
92 ;;; them, or set the Guix-specific 'ASPELL_DICT_DIR', or just do nothing (as
93 ;;; long as 'HOME' is set, that's fine!).
94 ;;;
95
96 (define* (aspell-dictionary dict-name full-name
97 #:key version sha256 (prefix "aspell6-"))
98 (package
99 (name (string-append
100 "aspell-dict-"
101 ;; Downcase and replace underscore in package names
102 ;; to follow Guix naming conventions.
103 (string-map (match-lambda
104 (#\_ #\-)
105 (chr chr))
106 (string-downcase dict-name))))
107 (version version)
108 (source (origin
109 (method url-fetch)
110 (uri (string-append "mirror://gnu/aspell/dict/" dict-name
111 "/" prefix dict-name "-"
112 version ".tar.bz2"))
113 (sha256 sha256)))
114 (build-system gnu-build-system)
115 (arguments
116 `(#:phases
117 (modify-phases %standard-phases
118 (replace 'configure
119 (lambda* (#:key outputs #:allow-other-keys)
120 (let ((out (assoc-ref outputs "out")))
121 (invoke "./configure")))))
122 #:make-flags
123 (let ((out (assoc-ref %outputs "out")))
124 (list (string-append "dictdir=" out "/lib/aspell")
125 (string-append "datadir=" out "/lib/aspell")))
126 #:tests? #f))
127 (native-inputs `(("aspell" ,aspell)
128 ("which" ,which)))
129 (synopsis (string-append full-name " dictionary for GNU Aspell")) ; XXX: i18n
130 (description
131 "This package provides a dictionary for the GNU Aspell spell checker.")
132 (license gpl2+)
133 (home-page "http://aspell.net/")))
134
135
136 (define-public aspell-dict-ar
137 (aspell-dictionary "ar" "Arabic"
138 #:version "1.2-0"
139 #:prefix "aspell6-"
140 #:sha256
141 (base32
142 "1avw40bp8yi5bnkq64ihm2rldgw34lk89yz281q9bmndh95a47h4")))
143
144 (define-public aspell-dict-be
145 (aspell-dictionary "be" "Belarusian"
146 #:version "0.01"
147 #:prefix "aspell5-"
148 #:sha256
149 (base32
150 "1svls9p7rsfi3hs0afh0cssj006qb4v1ik2yzqgj8hm10c6as2sm")))
151
152 (define-public aspell-dict-ca
153 (let ((version "2.5.0")
154 (sha256
155 (base32 "0kbi8fi7a1bys31kfqrlh332gyik0cfdmxgl7n15sa9c305rkgwq")))
156 (package
157 (inherit (aspell-dictionary "ca" "Catalan"
158 #:version version
159 #:sha256 sha256))
160 (source
161 (origin
162 (method url-fetch)
163 (uri (string-append "https://www.softcatala.org/pub/softcatala/aspell/"
164 version "/aspell6-ca-" version ".tar.bz2"))
165 (sha256 sha256)))
166 (home-page "https://www.softcatala.org/pub/softcatala/aspell/"))))
167
168 (define-public aspell-dict-de
169 (aspell-dictionary "de" "German"
170 #:version "20161207-7-0"
171 #:sha256
172 (base32
173 "0wamclvp66xfmv5wff96v6gdlnfv4y8lx3f8wvxyzm5imwgms4n2")))
174
175 (define-public aspell-dict-da
176 (aspell-dictionary "da" "Danish"
177 #:version "1.6.36-11-0"
178 #:sha256
179 (base32
180 "1xz2haayvwlxgss9jf1x2311a1ixbk75q2vgfprjhibsmb7cpinv")))
181
182 (define-public aspell-dict-el
183 (aspell-dictionary "el" "Greek"
184 #:version "0.08-0"
185 #:prefix "aspell6-"
186 #:sha256
187 (base32
188 "1ljcc30zg2v2h3w5h5jr5im41mw8jbsgvvhdd2cii2yzi8d0zxja")))
189
190 (define-public aspell-dict-en
191 (aspell-dictionary "en" "English"
192 #:version "2019.10.06-0"
193 #:sha256
194 (base32
195 "1zai9wrqwgb9z9vfgb22qhrvxvg73jg0ix44j1khm2f6m96lncr4")))
196
197 (define-public aspell-dict-eo
198 (aspell-dictionary "eo" "Esperanto"
199 #:version "2.1.20000225a-2"
200 #:sha256
201 (base32
202 "09vf0mbiicbmyb4bwb7v7lgpabnylg0wy7m3hlhl5rjdda6x3lj1")))
203
204 (define-public aspell-dict-es
205 (aspell-dictionary "es" "Spanish"
206 #:version "1.11-2"
207 #:sha256
208 (base32
209 "1k5g328ac1hdpp6fsg57d8md6i0aqcwlszp3gbmp5706wyhpydmd")))
210
211 (define-public aspell-dict-fi
212 (aspell-dictionary "fi" "Finnish"
213 #:version "0.7-0"
214 #:prefix "aspell6-"
215 #:sha256
216 (base32
217 "07d5s08ba4dd89cmwy9icc01i6fjdykxlb9ravmhdrhi8mxz1mzq")))
218
219 (define-public aspell-dict-fr
220 (aspell-dictionary "fr" "French"
221 #:version "0.50-3"
222 #:prefix "aspell-"
223 #:sha256
224 (base32
225 "14ffy9mn5jqqpp437kannc3559bfdrpk7r36ljkzjalxa53i0hpr")))
226
227 (define-public aspell-dict-grc
228 (aspell-dictionary "grc" "Ancient Greek"
229 #:version "0.02-0"
230 #:sha256
231 (base32
232 "1zxr8958v37v260fkqd4pg37ns5h5kyqm54hn1hg70wq5cz8h512")))
233
234 (define-public aspell-dict-he
235 (aspell-dictionary "he" "Hebrew"
236 #:version "1.0-0"
237 #:sha256
238 (base32
239 "13bhbghx5b8g0119g3wxd4n8mlf707y41vlf59irxjj0kynankfn")))
240
241 (define-public aspell-dict-hi
242 (aspell-dictionary "hi" "Hindi"
243 #:version "0.02-0"
244 #:prefix "aspell6-"
245 #:sha256
246 (base32
247 "0drs374qz4419zx1lf2k281ydxf2750jk5ailafj1x0ncz27h1ys")))
248
249 (define-public aspell-dict-it
250 (let ((version "2.4-20070901-0")
251 (sha256
252 (base32 "0d6ypii3jblprpibazb6ypady536jz62rwxlss1x1raq07rhvvqn")))
253 (package
254 (inherit (aspell-dictionary "it" "Italian"
255 #:version version
256 #:sha256 sha256))
257
258 ;; The version hosted at <https://ftp.gnu.org/gnu/aspell/dict> is even
259 ;; more out of date.
260 (source
261 (origin
262 (method url-fetch)
263 (uri (string-append "mirror://sourceforge/linguistico/"
264 "Dizionario%20italiano%20per%20Aspell/" version "/"
265 "aspell6-it-" version ".tar.bz2"))
266 (sha256 sha256)))
267 (home-page
268 "http://linguistico.sourceforge.net/pages/dizionario_italiano.html"))))
269
270 (define-public aspell-dict-mi
271 (aspell-dictionary "mi" "Maori"
272 #:version "0.50-0"
273 #:sha256
274 (base32
275 "12bxplpd348yx8d2q8qvahi9dlp7qf28qmanzhziwc7np8rixvmy")))
276
277 (define-public aspell-dict-nl
278 (aspell-dictionary "nl" "Dutch"
279 #:version "0.50-2"
280 #:prefix "aspell-"
281 #:sha256
282 (base32
283 "0ffb87yjsh211hllpc4b9khqqrblial4pzi1h9r3v465z1yhn3j4")))
284
285 (define-public aspell-dict-nn
286 (aspell-dictionary "nn" "Norwegian Nynorsk"
287 #:version "0.50.1-1"
288 #:sha256
289 (base32
290 "0w2k5l5rbqpliripgqwiqixz5ghnjf7i9ggbrc4ly4vy1ia10rmc")))
291
292 (define-public aspell-dict-pt-br
293 (aspell-dictionary "pt_BR" "Brazilian Portuguese"
294 #:version "20131030-12-0"
295 #:sha256
296 (base32
297 "1xqlpk21s93c6blkdnpk7l62q9fxjvzdv2x86chl8p2x1gdrj3gb")))
298
299 (define-public aspell-dict-pt-pt
300 (aspell-dictionary "pt_PT" "Portuguese"
301 #:version "20190329-1-0"
302 #:sha256
303 (base32
304 "0ld0d0ily4jqifjfsxfv4shbicz6ymm2gk56fq9gbzra1j4qnw75")))
305
306 (define-public aspell-dict-ru
307 (aspell-dictionary "ru" "Russian"
308 #:version "0.99f7-1"
309 #:sha256
310 (base32
311 "0ip6nq43hcr7vvzbv4lwwmlwgfa60hrhsldh9xy3zg2prv6bcaaw")))
312
313 (define-public aspell-dict-sl
314 (aspell-dictionary "sl" "Slovenian"
315 #:version "0.50-0"
316 #:prefix "aspell-"
317 #:sha256
318 (base32
319 "1l9kc5g35flq8kw9jhn2n0bjb4sipjs4qkqzgggs438kywkx2rp5")))
320
321 (define-public aspell-dict-sv
322 (aspell-dictionary "sv" "Swedish"
323 #:version "0.51-0"
324 #:prefix "aspell-"
325 #:sha256
326 (base32
327 "02jwkjhr32kvyibnyzgx3smbnm576jwdzg3avdf6zxwckhy5fw4v")))
328
329 (define-public aspell-dict-uk
330 (aspell-dictionary "uk" "Ukrainian"
331 #:version "1.4.0-0"
332 #:sha256
333 (base32
334 "137i4njvnslab6l4s291s11xijr5jsy75lbdph32f9y183lagy9m")))
335
336 \f
337 ;;;
338 ;;; Hunspell packages made from the Aspell word lists.
339 ;;;
340
341 (define* (aspell-word-list language synopsis
342 #:optional
343 (nick (string-map (lambda (chr)
344 (if (char=? #\_ chr)
345 #\-
346 chr))
347 (string-downcase language))))
348 (package
349 (name (string-append "hunspell-dict-" nick))
350 (version "2018.04.16")
351 (source (origin
352 (method url-fetch)
353 (uri (string-append
354 "http://downloads.sourceforge.net/wordlist/scowl-"
355 version ".tar.gz"))
356 (sha256
357 (base32
358 "11lkrnhwrf5mvrrq45k4mads3n9aswgac8dc25ba61c75alxb5rs"))))
359 (native-inputs
360 `(("tar" ,tar)
361 ("gzip" ,gzip)
362 ("perl" ,perl)
363 ("aspell" ,aspell)))
364 (build-system gnu-build-system)
365 (arguments
366 `(#:phases
367 (modify-phases %standard-phases
368 (delete 'configure)
369 (delete 'check)
370 (replace 'build
371 (lambda _
372 (substitute* "speller/make-hunspell-dict"
373 (("zip -9 .*$")
374 "return\n"))
375 (mkdir "speller/hunspell")
376
377 ;; XXX: This actually builds all the dictionary variants.
378 (invoke "make" "-C" "speller" "hunspell")))
379 (replace 'install
380 (lambda* (#:key outputs #:allow-other-keys)
381 (let* ((out (assoc-ref %outputs "out"))
382 (hunspell (string-append out "/share/hunspell"))
383 (myspell (string-append out "/share/myspell"))
384 (doc (string-append out "/share/doc/"
385 ,name))
386 (dot-dic ,(string-append "speller/" language ".dic")))
387 (mkdir-p myspell)
388
389 ;; Usually there's only a 'LANGUAGE.dic' file, but for the "en"
390 ;; dictionary, there no 'en.dic'. Instead, there's a set of
391 ;; 'en*.dic' files, hence the 'find-files' call below.
392 (if (file-exists? dot-dic)
393 (install-file dot-dic hunspell)
394 (for-each (lambda (dic)
395 (install-file dic hunspell))
396 (find-files "speller"
397 ,(string-append language ".*\\.dic$"))))
398
399 (install-file ,(string-append "speller/" language ".aff")
400 hunspell)
401 (symlink hunspell (string-append myspell "/dicts"))
402 (for-each (lambda (file)
403 (install-file file doc))
404 (find-files "."
405 "^(Copyright|.*\\.(txt|org|md))$"))
406 #t))))))
407 (synopsis synopsis)
408 (description
409 "This package provides a dictionary for the Hunspell spell-checking
410 library.")
411 (home-page "http://wordlist.aspell.net/")
412 (license (non-copyleft "file://Copyright"
413 "Word lists come from several sources, all
414 under permissive licensing terms. See the 'Copyright' file."))))
415
416 (define-syntax define-word-list-dictionary
417 (syntax-rules (synopsis)
418 ((_ name language (synopsis text))
419 (define-public name
420 (aspell-word-list language text)))
421 ((_ name language nick (synopsis text))
422 (define-public name
423 (aspell-word-list language text nick)))))
424
425 (define-word-list-dictionary hunspell-dict-en
426 "en"
427 (synopsis "Hunspell dictionary for English"))
428
429 (define-word-list-dictionary hunspell-dict-en-au
430 "en_AU"
431 (synopsis "Hunspell dictionary for Australian English"))
432
433 (define-word-list-dictionary hunspell-dict-en-ca
434 "en_CA"
435 (synopsis "Hunspell dictionary for Canadian English"))
436
437 (define-word-list-dictionary hunspell-dict-en-gb
438 "en_GB-ise" "en-gb"
439 (synopsis "Hunspell dictionary for British English, with -ise endings"))
440
441 (define-word-list-dictionary hunspell-dict-en-gb-ize
442 "en_GB-ize"
443 (synopsis "Hunspell dictionary for British English, with -ize endings"))
444
445 (define-word-list-dictionary hunspell-dict-en-us
446 "en_US"
447 (synopsis "Hunspell dictionary for United States English"))