gnu: Add python-pyshp.
[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>
387497f0 5;;; Copyright © 2016, 2017, 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
4cf9f57b 6;;; Copyright © 2016 Christopher Andersson <christopher@8bits.nu>
d109b1e8 7;;; Copyright © 2016 Theodoros Foradis <theodoros@foradis.org>
853665ff 8;;; Copyright © 2016, 2017, 2019, 2021 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>
fe5b5f8c
JK
12;;; Copyright © 2020 Jonathan Brielmaier <jonathan.brielmaier@web.de>
13;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
1b5c7052 14;;; Copyright © 2020 Noah Landis <noahlandis@posteo.net>
847f5233 15;;; Copyright © 2021 Sergiu Ivanov <sivanov@colimite.fr>
708d0ceb
LC
16;;;
17;;; This file is part of GNU Guix.
18;;;
19;;; GNU Guix is free software; you can redistribute it and/or modify it
20;;; under the terms of the GNU General Public License as published by
21;;; the Free Software Foundation; either version 3 of the License, or (at
22;;; your option) any later version.
23;;;
24;;; GNU Guix is distributed in the hope that it will be useful, but
25;;; WITHOUT ANY WARRANTY; without even the implied warranty of
26;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27;;; GNU General Public License for more details.
28;;;
29;;; You should have received a copy of the GNU General Public License
30;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
31
1ffa7090 32(define-module (gnu packages aspell)
708d0ceb
LC
33 #:use-module (guix packages)
34 #:use-module (guix download)
35 #:use-module (guix build-system gnu)
36 #:use-module (guix licenses)
a2908f5a 37 #:use-module (guix utils)
6d35b1c9 38 #:use-module (gnu packages)
085bcca3 39 #:use-module (gnu packages base)
fe5b5f8c 40 #:use-module (gnu packages bison)
085bcca3 41 #:use-module (gnu packages compression)
fe5b5f8c 42 #:use-module (gnu packages ncurses)
cd37b144
JM
43 #:use-module (gnu packages perl)
44 #:use-module (ice-9 match))
708d0ceb
LC
45
46(define-public aspell
47 (package
48 (name "aspell")
2387e2f2 49 (version "0.60.8")
708d0ceb
LC
50 (source
51 (origin
52 (method url-fetch)
53 (uri (string-append "mirror://gnu/aspell/aspell-"
54 version ".tar.gz"))
55 (sha256
56 (base32
2387e2f2
LC
57 "1wi60ankalmh8ds7nplz434jd7j94gdvbahdwsr539rlad8pxdzr"))
58 (patches (search-patches "aspell-default-dict-dir.patch"))))
708d0ceb 59 (build-system gnu-build-system)
81fc64da
FB
60 (arguments
61 `(#:phases
62 (modify-phases %standard-phases
a2908f5a
LC
63 (add-before 'build 'set-filter-path
64 (lambda* (#:key outputs #:allow-other-keys)
65 ;; Change the default value of 'filter-path' so that filters such
66 ;; as 'tex-filter.so' can be found. By default none of the
67 ;; filters would be found.
68 (let* ((out (assoc-ref outputs "out"))
69 (libdir (string-append out "/lib/aspell-"
70 ,(version-major+minor version))))
71 (substitute* "common/config.cpp"
72 (("\"filter-path(.*)DICT_DIR" _ middle)
73 (string-append "\"filter-path" middle
74 "\"" libdir "\"")))
d3da21d2 75 #t))))))
708d0ceb 76 (inputs `(("perl" ,perl)))
6d35b1c9
LC
77
78 (native-search-paths
79 ;; This is a Guix-specific environment variable that takes a single
80 ;; entry, not an actual search path.
81 (list (search-path-specification
82 (variable "ASPELL_DICT_DIR")
83 (separator #f)
84 (files '("lib/aspell")))))
85
708d0ceb 86 (home-page "http://aspell.net/")
f50d2669 87 (synopsis "Spell checker")
708d0ceb 88 (description
a22dc0c4
LC
89 "Aspell is a spell-checker which can be used either as a library or as
90a standalone program. Notable features of Aspell include its full support of
91documents written in the UTF-8 encoding and its ability to use multiple
92dictionaries, including personal ones.")
708d0ceb 93 (license lgpl2.1+)))
15756a7a 94
15756a7a
LC
95;;;
96;;; Dictionaries.
97;;;
707ee324 98;;; Use 'export ASPELL_CONF="dict-dir $HOME/.guix-profile/lib/aspell"' to use
6d35b1c9
LC
99;;; them, or set the Guix-specific 'ASPELL_DICT_DIR', or just do nothing (as
100;;; long as 'HOME' is set, that's fine!).
15756a7a
LC
101;;;
102
103(define* (aspell-dictionary dict-name full-name
104 #:key version sha256 (prefix "aspell6-"))
105 (package
cd37b144
JM
106 (name (string-append
107 "aspell-dict-"
108 ;; Downcase and replace underscore in package names
109 ;; to follow Guix naming conventions.
110 (string-map (match-lambda
111 (#\_ #\-)
112 (chr chr))
113 (string-downcase dict-name))))
15756a7a
LC
114 (version version)
115 (source (origin
116 (method url-fetch)
117 (uri (string-append "mirror://gnu/aspell/dict/" dict-name
118 "/" prefix dict-name "-"
119 version ".tar.bz2"))
ce0be567 120 (hash (content-hash sha256))))
15756a7a
LC
121 (build-system gnu-build-system)
122 (arguments
707ee324
TGR
123 `(#:phases
124 (modify-phases %standard-phases
125 (replace 'configure
126 (lambda* (#:key outputs #:allow-other-keys)
127 (let ((out (assoc-ref outputs "out")))
5f55ca21 128 (invoke "./configure")))))
707ee324
TGR
129 #:make-flags
130 (let ((out (assoc-ref %outputs "out")))
131 (list (string-append "dictdir=" out "/lib/aspell")
132 (string-append "datadir=" out "/lib/aspell")))
133 #:tests? #f))
15756a7a
LC
134 (native-inputs `(("aspell" ,aspell)
135 ("which" ,which)))
136 (synopsis (string-append full-name " dictionary for GNU Aspell")) ; XXX: i18n
137 (description
138 "This package provides a dictionary for the GNU Aspell spell checker.")
139 (license gpl2+)
140 (home-page "http://aspell.net/")))
141
99b9857b 142
964595dd
JM
143(define-public aspell-dict-ar
144 (aspell-dictionary "ar" "Arabic"
145 #:version "1.2-0"
146 #:prefix "aspell6-"
147 #:sha256
148 (base32
149 "1avw40bp8yi5bnkq64ihm2rldgw34lk89yz281q9bmndh95a47h4")))
150
8ac3476d
JM
151(define-public aspell-dict-be
152 (aspell-dictionary "be" "Belarusian"
153 #:version "0.01"
154 #:prefix "aspell5-"
155 #:sha256
156 (base32
157 "1svls9p7rsfi3hs0afh0cssj006qb4v1ik2yzqgj8hm10c6as2sm")))
158
99b9857b 159(define-public aspell-dict-ca
9b451091
TGR
160 (let ((version "2.5.0")
161 (sha256
162 (base32 "0kbi8fi7a1bys31kfqrlh332gyik0cfdmxgl7n15sa9c305rkgwq")))
163 (package
164 (inherit (aspell-dictionary "ca" "Catalan"
165 #:version version
166 #:sha256 sha256))
167 (source
168 (origin
169 (method url-fetch)
170 (uri (string-append "https://www.softcatala.org/pub/softcatala/aspell/"
171 version "/aspell6-ca-" version ".tar.bz2"))
ce0be567 172 (hash (content-hash sha256))))
9b451091 173 (home-page "https://www.softcatala.org/pub/softcatala/aspell/"))))
15756a7a 174
1b5c7052
NL
175(define-public aspell-dict-cs
176 (aspell-dictionary "cs" "Czech"
177 #:version "20040614-1"
178 #:sha256
179 (base32
180 "0rihj4hsw96pd9casvmpvw3r8040pfa28p1h73x4vyn20zwr3h01")))
181
06550e07
JD
182(define-public aspell-dict-de
183 (aspell-dictionary "de" "German"
4dfc7369 184 #:version "20161207-7-0"
06550e07
JD
185 #:sha256
186 (base32
4dfc7369 187 "0wamclvp66xfmv5wff96v6gdlnfv4y8lx3f8wvxyzm5imwgms4n2")))
06550e07 188
4bb9528c
JM
189(define-public aspell-dict-da
190 (aspell-dictionary "da" "Danish"
ecc8c5d4 191 #:version "1.6.36-11-0"
4bb9528c
JM
192 #:sha256
193 (base32
ecc8c5d4 194 "1xz2haayvwlxgss9jf1x2311a1ixbk75q2vgfprjhibsmb7cpinv")))
4bb9528c 195
74a40ddd
EF
196(define-public aspell-dict-el
197 (aspell-dictionary "el" "Greek"
198 #:version "0.08-0"
199 #:prefix "aspell6-"
200 #:sha256
201 (base32
202 "1ljcc30zg2v2h3w5h5jr5im41mw8jbsgvvhdd2cii2yzi8d0zxja")))
203
15756a7a
LC
204(define-public aspell-dict-en
205 (aspell-dictionary "en" "English"
0c495a0d 206 #:version "2020.12.07-0"
15756a7a
LC
207 #:sha256
208 (base32
0c495a0d 209 "1cwzqkm8gr1w51rpckwlvb43sb0b5nbwy7s8ns5vi250515773sc")))
15756a7a
LC
210
211(define-public aspell-dict-eo
212 (aspell-dictionary "eo" "Esperanto"
213 #:version "2.1.20000225a-2"
214 #:sha256
215 (base32
216 "09vf0mbiicbmyb4bwb7v7lgpabnylg0wy7m3hlhl5rjdda6x3lj1")))
217
218(define-public aspell-dict-es
219 (aspell-dictionary "es" "Spanish"
220 #:version "1.11-2"
221 #:sha256
222 (base32
223 "1k5g328ac1hdpp6fsg57d8md6i0aqcwlszp3gbmp5706wyhpydmd")))
224
c066a050
JM
225(define-public aspell-dict-fi
226 (aspell-dictionary "fi" "Finnish"
227 #:version "0.7-0"
228 #:prefix "aspell6-"
229 #:sha256
230 (base32
231 "07d5s08ba4dd89cmwy9icc01i6fjdykxlb9ravmhdrhi8mxz1mzq")))
232
15756a7a
LC
233(define-public aspell-dict-fr
234 (aspell-dictionary "fr" "French"
235 #:version "0.50-3"
236 #:prefix "aspell-"
237 #:sha256
238 (base32
239 "14ffy9mn5jqqpp437kannc3559bfdrpk7r36ljkzjalxa53i0hpr")))
5d9ecd15 240
74a40ddd
EF
241(define-public aspell-dict-grc
242 (aspell-dictionary "grc" "Ancient Greek"
243 #:version "0.02-0"
5d9ecd15
AK
244 #:sha256
245 (base32
74a40ddd
EF
246 "1zxr8958v37v260fkqd4pg37ns5h5kyqm54hn1hg70wq5cz8h512")))
247
248(define-public aspell-dict-he
249 (aspell-dictionary "he" "Hebrew"
250 #:version "1.0-0"
251 #:sha256
252 (base32
253 "13bhbghx5b8g0119g3wxd4n8mlf707y41vlf59irxjj0kynankfn")))
3a6a0f60 254
77fe5258
JM
255(define-public aspell-dict-hi
256 (aspell-dictionary "hi" "Hindi"
257 #:version "0.02-0"
258 #:prefix "aspell6-"
259 #:sha256
260 (base32
261 "0drs374qz4419zx1lf2k281ydxf2750jk5ailafj1x0ncz27h1ys")))
262
3a6a0f60 263(define-public aspell-dict-it
8dbd8e42
TGR
264 (let ((version "2.4-20070901-0")
265 (sha256
266 (base32 "0d6ypii3jblprpibazb6ypady536jz62rwxlss1x1raq07rhvvqn")))
267 (package
268 (inherit (aspell-dictionary "it" "Italian"
269 #:version version
270 #:sha256 sha256))
271
272 ;; The version hosted at <https://ftp.gnu.org/gnu/aspell/dict> is even
273 ;; more out of date.
274 (source
275 (origin
276 (method url-fetch)
277 (uri (string-append "mirror://sourceforge/linguistico/"
278 "Dizionario%20italiano%20per%20Aspell/" version "/"
279 "aspell6-it-" version ".tar.bz2"))
ce0be567 280 (hash (content-hash sha256))))
8dbd8e42
TGR
281 (home-page
282 "http://linguistico.sourceforge.net/pages/dizionario_italiano.html"))))
467c498b 283
c5a88aa0
JM
284(define-public aspell-dict-mi
285 (aspell-dictionary "mi" "Maori"
286 #:version "0.50-0"
6b79a93d 287 #:prefix "aspell-"
c5a88aa0
JM
288 #:sha256
289 (base32
290 "12bxplpd348yx8d2q8qvahi9dlp7qf28qmanzhziwc7np8rixvmy")))
291
467c498b
JR
292(define-public aspell-dict-nl
293 (aspell-dictionary "nl" "Dutch"
294 #:version "0.50-2"
295 #:prefix "aspell-"
296 #:sha256
297 (base32
298 "0ffb87yjsh211hllpc4b9khqqrblial4pzi1h9r3v465z1yhn3j4")))
8553fe57 299
c9400f03
JM
300(define-public aspell-dict-nn
301 (aspell-dictionary "nn" "Norwegian Nynorsk"
302 #:version "0.50.1-1"
520a97bd 303 #:prefix "aspell-"
c9400f03
JM
304 #:sha256
305 (base32
306 "0w2k5l5rbqpliripgqwiqixz5ghnjf7i9ggbrc4ly4vy1ia10rmc")))
307
e118837e
MK
308(define-public aspell-dict-pl
309 (aspell-dictionary "pl" "Polish"
310 #:version "0.51-0"
77948afd 311 #:prefix "aspell-"
e118837e
MK
312 #:sha256
313 (base32
314 "1a3ccji6k5gys7l3ilr2lh5pzxgzb7ipc5vb737svl6nqgdy8757")))
315
74a40ddd 316(define-public aspell-dict-pt-br
cd37b144 317 (aspell-dictionary "pt_BR" "Brazilian Portuguese"
947141fd 318 #:version "20131030-12-0"
8553fe57
EF
319 #:sha256
320 (base32
947141fd 321 "1xqlpk21s93c6blkdnpk7l62q9fxjvzdv2x86chl8p2x1gdrj3gb")))
74a40ddd 322
a1fa54f0 323(define-public aspell-dict-pt-pt
cd37b144 324 (aspell-dictionary "pt_PT" "Portuguese"
9eb6d712 325 #:version "20190329-1-0"
a1fa54f0
JM
326 #:sha256
327 (base32
9eb6d712 328 "0ld0d0ily4jqifjfsxfv4shbicz6ymm2gk56fq9gbzra1j4qnw75")))
a1fa54f0 329
74a40ddd
EF
330(define-public aspell-dict-ru
331 (aspell-dictionary "ru" "Russian"
332 #:version "0.99f7-1"
333 #:sha256
334 (base32
335 "0ip6nq43hcr7vvzbv4lwwmlwgfa60hrhsldh9xy3zg2prv6bcaaw")))
4cf9f57b 336
5e8a7edc
TL
337(define-public aspell-dict-sl
338 (aspell-dictionary "sl" "Slovenian"
339 #:version "0.50-0"
340 #:prefix "aspell-"
341 #:sha256
342 (base32
343 "1l9kc5g35flq8kw9jhn2n0bjb4sipjs4qkqzgggs438kywkx2rp5")))
344
4cf9f57b
CA
345(define-public aspell-dict-sv
346 (aspell-dictionary "sv" "Swedish"
347 #:version "0.51-0"
348 #:prefix "aspell-"
349 #:sha256
350 (base32
351 "02jwkjhr32kvyibnyzgx3smbnm576jwdzg3avdf6zxwckhy5fw4v")))
850812de 352
e77dd15a
JM
353(define-public aspell-dict-uk
354 (aspell-dictionary "uk" "Ukrainian"
355 #:version "1.4.0-0"
356 #:sha256
357 (base32
358 "137i4njvnslab6l4s291s11xijr5jsy75lbdph32f9y183lagy9m")))
359
847f5233
SI
360(define-public aspell-dict-ro
361 (aspell-dictionary "ro" "Romanian"
362 #:version "3.3-2"
363 #:prefix "aspell5-"
364 #:sha256
365 (base32
366 "0gb8j9iy1acdl11jq76idgc2lbc1rq3w04favn8cyh55d1v8phsk")))
367
085bcca3
LC
368\f
369;;;
370;;; Hunspell packages made from the Aspell word lists.
371;;;
372
373(define* (aspell-word-list language synopsis
374 #:optional
375 (nick (string-map (lambda (chr)
376 (if (char=? #\_ chr)
377 #\-
378 chr))
379 (string-downcase language))))
380 (package
381 (name (string-append "hunspell-dict-" nick))
210e43c7 382 (version "2018.04.16")
085bcca3
LC
383 (source (origin
384 (method url-fetch)
385 (uri (string-append
387497f0
EF
386 "mirror://sourceforge/wordlist/SCOWL/"
387 version "/scowl-" version ".tar.gz"))
085bcca3
LC
388 (sha256
389 (base32
210e43c7 390 "11lkrnhwrf5mvrrq45k4mads3n9aswgac8dc25ba61c75alxb5rs"))))
085bcca3
LC
391 (native-inputs
392 `(("tar" ,tar)
393 ("gzip" ,gzip)
394 ("perl" ,perl)
395 ("aspell" ,aspell)))
396 (build-system gnu-build-system)
397 (arguments
398 `(#:phases
399 (modify-phases %standard-phases
be528eb5
TGR
400 (add-after 'unpack 'make-reproducible
401 (lambda _
402 (substitute* "speller/README_en.txt.sh"
403 (("\\bdate\\b") ""))))
085bcca3
LC
404 (delete 'configure)
405 (delete 'check)
406 (replace 'build
407 (lambda _
408 (substitute* "speller/make-hunspell-dict"
409 (("zip -9 .*$")
410 "return\n"))
411 (mkdir "speller/hunspell")
412
413 ;; XXX: This actually builds all the dictionary variants.
210e43c7 414 (invoke "make" "-C" "speller" "hunspell")))
085bcca3
LC
415 (replace 'install
416 (lambda* (#:key outputs #:allow-other-keys)
417 (let* ((out (assoc-ref %outputs "out"))
418 (hunspell (string-append out "/share/hunspell"))
419 (myspell (string-append out "/share/myspell"))
420 (doc (string-append out "/share/doc/"
22c334fa
LC
421 ,name))
422 (dot-dic ,(string-append "speller/" language ".dic")))
085bcca3 423 (mkdir-p myspell)
22c334fa
LC
424
425 ;; Usually there's only a 'LANGUAGE.dic' file, but for the "en"
426 ;; dictionary, there no 'en.dic'. Instead, there's a set of
427 ;; 'en*.dic' files, hence the 'find-files' call below.
428 (if (file-exists? dot-dic)
429 (install-file dot-dic hunspell)
430 (for-each (lambda (dic)
431 (install-file dic hunspell))
432 (find-files "speller"
433 ,(string-append language ".*\\.dic$"))))
434
2a29f476
JL
435 ;; Install affix files corresponding to installed dictionaries
436 (for-each (lambda (dic)
437 (install-file (string-append
438 "speller/" (basename dic ".dic") ".aff")
439 hunspell))
440 (find-files hunspell ".*\\.dic$"))
085bcca3
LC
441 (symlink hunspell (string-append myspell "/dicts"))
442 (for-each (lambda (file)
443 (install-file file doc))
444 (find-files "."
445 "^(Copyright|.*\\.(txt|org|md))$"))
446 #t))))))
447 (synopsis synopsis)
448 (description
449 "This package provides a dictionary for the Hunspell spell-checking
450library.")
451 (home-page "http://wordlist.aspell.net/")
452 (license (non-copyleft "file://Copyright"
453 "Word lists come from several sources, all
454under permissive licensing terms. See the 'Copyright' file."))))
455
456(define-syntax define-word-list-dictionary
457 (syntax-rules (synopsis)
458 ((_ name language (synopsis text))
459 (define-public name
460 (aspell-word-list language text)))
461 ((_ name language nick (synopsis text))
462 (define-public name
463 (aspell-word-list language text nick)))))
464
465(define-word-list-dictionary hunspell-dict-en
466 "en"
467 (synopsis "Hunspell dictionary for English"))
468
469(define-word-list-dictionary hunspell-dict-en-au
470 "en_AU"
471 (synopsis "Hunspell dictionary for Australian English"))
472
473(define-word-list-dictionary hunspell-dict-en-ca
474 "en_CA"
475 (synopsis "Hunspell dictionary for Canadian English"))
476
477(define-word-list-dictionary hunspell-dict-en-gb
478 "en_GB-ise" "en-gb"
479 (synopsis "Hunspell dictionary for British English, with -ise endings"))
480
481(define-word-list-dictionary hunspell-dict-en-gb-ize
482 "en_GB-ize"
483 (synopsis "Hunspell dictionary for British English, with -ize endings"))
484
485(define-word-list-dictionary hunspell-dict-en-us
486 "en_US"
487 (synopsis "Hunspell dictionary for United States English"))
fe5b5f8c
JK
488
489(define-public ispell
490 (package
491 (name "ispell")
c6e36ee2 492 (version "3.4.04")
fe5b5f8c
JK
493 (source
494 (origin
495 (method url-fetch)
496 (uri (string-append "https://www.cs.hmc.edu/~geoff/tars/ispell-"
497 version ".tar.gz"))
498 (sha256
c6e36ee2 499 (base32 "0gp1rwn8grkvz28wgisc2j9w9svldnaiahl3lyis118xabqddg47"))))
fe5b5f8c
JK
500 (build-system gnu-build-system)
501 (arguments
502 `(#:parallel-build? #f
503 #:tests? #f ; no tests
504 #:phases
505 (modify-phases %standard-phases
506 (replace 'configure
507 (lambda* (#:key inputs outputs #:allow-other-keys)
508 ;; Based on local.h.linux
509 (let* ((grep (assoc-ref inputs "grep"))
510 (out (assoc-ref outputs "out")))
511 (call-with-output-file "local.h"
512 (lambda (port)
513 (format port "#define MINIMENU~%")
514 (format port "#define USG~%")
515 (format port "#define HAS_RENAME~%")
516 (format port "#define CC \"gcc\"~%")
517 (format port "#define POUNDBANG \"#!~a\"~%" (which "sh"))
518 (format port "#define EGREPCMD \"~a/bin/grep -Ei\"~%" grep)
519 (format port "#define BINDIR \"~a/bin\"~%" out)
520 (format port "#define LIBDIR \"~a/lib/ispell\"~%" out)
521 (format port "#define MAN1DIR \"~a/share/man/man1\"~%" out)
522 (format port "#define MAN45DIR \"~a/share/man/man5\"~%" out))))
523 #t)))))
524 (inputs
525 `(("grep" ,grep)
526 ("ncurses" ,ncurses)))
527 (native-inputs
528 `(("bison" ,bison)))
529 (synopsis "Interactive spell-checking tool for Unix")
530 (description "Ispell is an interactive spell-checking tool supporting many
531European languages.")
532 (home-page "https://www.cs.hmc.edu/~geoff/ispell.html")
533 (license bsd-3)))