gnu: aspell: Update to 0.60.8.
[jackhill/guix/guix.git] / gnu / packages / aspell.scm
CommitLineData
708d0ceb 1;;; GNU Guix --- Functional package management for GNU
22c334fa 2;;; Copyright © 2013, 2014, 2015, 2017, 2018 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>
708d0ceb
LC
10;;;
11;;; This file is part of GNU Guix.
12;;;
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.
17;;;
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.
22;;;
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/>.
25
1ffa7090 26(define-module (gnu packages aspell)
708d0ceb
LC
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix build-system gnu)
30 #:use-module (guix licenses)
a2908f5a 31 #:use-module (guix utils)
6d35b1c9 32 #:use-module (gnu packages)
085bcca3
LC
33 #:use-module (gnu packages base)
34 #:use-module (gnu packages compression)
cd37b144
JM
35 #:use-module (gnu packages perl)
36 #:use-module (ice-9 match))
708d0ceb
LC
37
38(define-public aspell
39 (package
40 (name "aspell")
4fcb6a35 41 (version "0.60.8")
708d0ceb
LC
42 (source
43 (origin
44 (method url-fetch)
45 (uri (string-append "mirror://gnu/aspell/aspell-"
46 version ".tar.gz"))
47 (sha256
48 (base32
4fcb6a35
EF
49 "1wi60ankalmh8ds7nplz434jd7j94gdvbahdwsr539rlad8pxdzr"))
50 (patches (search-patches "aspell-default-dict-dir.patch"))))
708d0ceb 51 (build-system gnu-build-system)
81fc64da
FB
52 (arguments
53 `(#:phases
54 (modify-phases %standard-phases
a2908f5a
LC
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
66 "\"" libdir "\"")))
67 #t)))
81fc64da
FB
68 (add-after 'install 'wrap-aspell
69 (lambda* (#:key outputs #:allow-other-keys)
70 (let ((bin/aspell (string-append (assoc-ref outputs "out")
71 "/bin/aspell")))
72 (wrap-program bin/aspell
73 '("ASPELL_CONF" "" =
d3da21d2
MW
74 ("${ASPELL_CONF:-\"dict-dir ${GUIX_PROFILE:-$HOME/.guix-profile}/lib/aspell\"}")))
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"))
120 (sha256 sha256)))
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"
4fcb6a35 146 #:prefix "aspell6-"
964595dd
JM
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
LC
159(define-public aspell-dict-ca
160 (aspell-dictionary "ca" "Catalan"
161 #:version "2.1.5-1"
162 #:sha256
163 (base32
164 "1fb5y5kgvk25nlsfvc8cai978hg66x3pbp9py56pldc7vxzf9npb")))
15756a7a 165
06550e07
JD
166(define-public aspell-dict-de
167 (aspell-dictionary "de" "German"
168 #:version "20030222-1"
169 #:sha256
170 (base32
171 "01p92qj66cqb346gk7hjfynaap5sbcn85xz07kjfdq623ghr8v5s")))
172
4bb9528c
JM
173(define-public aspell-dict-da
174 (aspell-dictionary "da" "Danish"
175 #:version "1.4.42-1"
176 #:prefix "aspell5-"
177 #:sha256
178 (base32
179 "1hfkmiyhgrx5lgrb2mffjbdn1hivrm73wcg7x0iid74p2yb0fjpp")))
180
74a40ddd
EF
181(define-public aspell-dict-el
182 (aspell-dictionary "el" "Greek"
183 #:version "0.08-0"
184 #:prefix "aspell6-"
185 #:sha256
186 (base32
187 "1ljcc30zg2v2h3w5h5jr5im41mw8jbsgvvhdd2cii2yzi8d0zxja")))
188
15756a7a
LC
189(define-public aspell-dict-en
190 (aspell-dictionary "en" "English"
3bb3d7f3 191 #:version "2018.04.16-0"
15756a7a
LC
192 #:sha256
193 (base32
3bb3d7f3 194 "0bxxdzkk9g27plg22y9qzsx9cfjw3aa29w5bmzs561qc9gkp247i")))
15756a7a
LC
195
196(define-public aspell-dict-eo
197 (aspell-dictionary "eo" "Esperanto"
198 #:version "2.1.20000225a-2"
199 #:sha256
200 (base32
201 "09vf0mbiicbmyb4bwb7v7lgpabnylg0wy7m3hlhl5rjdda6x3lj1")))
202
203(define-public aspell-dict-es
204 (aspell-dictionary "es" "Spanish"
205 #:version "1.11-2"
206 #:sha256
207 (base32
208 "1k5g328ac1hdpp6fsg57d8md6i0aqcwlszp3gbmp5706wyhpydmd")))
209
c066a050
JM
210(define-public aspell-dict-fi
211 (aspell-dictionary "fi" "Finnish"
212 #:version "0.7-0"
213 #:prefix "aspell6-"
214 #:sha256
215 (base32
216 "07d5s08ba4dd89cmwy9icc01i6fjdykxlb9ravmhdrhi8mxz1mzq")))
217
15756a7a
LC
218(define-public aspell-dict-fr
219 (aspell-dictionary "fr" "French"
220 #:version "0.50-3"
221 #:prefix "aspell-"
222 #:sha256
223 (base32
224 "14ffy9mn5jqqpp437kannc3559bfdrpk7r36ljkzjalxa53i0hpr")))
5d9ecd15 225
74a40ddd
EF
226(define-public aspell-dict-grc
227 (aspell-dictionary "grc" "Ancient Greek"
228 #:version "0.02-0"
5d9ecd15
AK
229 #:sha256
230 (base32
74a40ddd
EF
231 "1zxr8958v37v260fkqd4pg37ns5h5kyqm54hn1hg70wq5cz8h512")))
232
233(define-public aspell-dict-he
234 (aspell-dictionary "he" "Hebrew"
235 #:version "1.0-0"
236 #:sha256
237 (base32
238 "13bhbghx5b8g0119g3wxd4n8mlf707y41vlf59irxjj0kynankfn")))
3a6a0f60 239
77fe5258
JM
240(define-public aspell-dict-hi
241 (aspell-dictionary "hi" "Hindi"
242 #:version "0.02-0"
243 #:prefix "aspell6-"
244 #:sha256
245 (base32
246 "0drs374qz4419zx1lf2k281ydxf2750jk5ailafj1x0ncz27h1ys")))
247
3a6a0f60 248(define-public aspell-dict-it
8dbd8e42
TGR
249 (let ((version "2.4-20070901-0")
250 (sha256
251 (base32 "0d6ypii3jblprpibazb6ypady536jz62rwxlss1x1raq07rhvvqn")))
252 (package
253 (inherit (aspell-dictionary "it" "Italian"
254 #:version version
255 #:sha256 sha256))
256
257 ;; The version hosted at <https://ftp.gnu.org/gnu/aspell/dict> is even
258 ;; more out of date.
259 (source
260 (origin
261 (method url-fetch)
262 (uri (string-append "mirror://sourceforge/linguistico/"
263 "Dizionario%20italiano%20per%20Aspell/" version "/"
264 "aspell6-it-" version ".tar.bz2"))
265 (sha256 sha256)))
266 (home-page
267 "http://linguistico.sourceforge.net/pages/dizionario_italiano.html"))))
467c498b 268
c5a88aa0
JM
269(define-public aspell-dict-mi
270 (aspell-dictionary "mi" "Maori"
271 #:version "0.50-0"
272 #:sha256
273 (base32
274 "12bxplpd348yx8d2q8qvahi9dlp7qf28qmanzhziwc7np8rixvmy")))
275
467c498b
JR
276(define-public aspell-dict-nl
277 (aspell-dictionary "nl" "Dutch"
278 #:version "0.50-2"
279 #:prefix "aspell-"
280 #:sha256
281 (base32
282 "0ffb87yjsh211hllpc4b9khqqrblial4pzi1h9r3v465z1yhn3j4")))
8553fe57 283
c9400f03
JM
284(define-public aspell-dict-nn
285 (aspell-dictionary "nn" "Norwegian Nynorsk"
286 #:version "0.50.1-1"
287 #:sha256
288 (base32
289 "0w2k5l5rbqpliripgqwiqixz5ghnjf7i9ggbrc4ly4vy1ia10rmc")))
290
74a40ddd 291(define-public aspell-dict-pt-br
cd37b144 292 (aspell-dictionary "pt_BR" "Brazilian Portuguese"
74a40ddd
EF
293 #:version "20090702-0"
294 #:prefix "aspell6-"
8553fe57
EF
295 #:sha256
296 (base32
74a40ddd
EF
297 "1y09lx9zf2rnp55r16b2vgj953l3538z1vaqgflg9mdvm555bz3p")))
298
a1fa54f0 299(define-public aspell-dict-pt-pt
cd37b144 300 (aspell-dictionary "pt_PT" "Portuguese"
a1fa54f0
JM
301 #:version "20070510-0"
302 #:prefix "aspell6-"
303 #:sha256
304 (base32
305 "1mnr994cwlag6shy8865ky99lymysiln07mbldcncahg90dagdxq")))
306
74a40ddd
EF
307(define-public aspell-dict-ru
308 (aspell-dictionary "ru" "Russian"
309 #:version "0.99f7-1"
310 #:sha256
311 (base32
312 "0ip6nq43hcr7vvzbv4lwwmlwgfa60hrhsldh9xy3zg2prv6bcaaw")))
4cf9f57b
CA
313
314(define-public aspell-dict-sv
315 (aspell-dictionary "sv" "Swedish"
316 #:version "0.51-0"
317 #:prefix "aspell-"
318 #:sha256
319 (base32
320 "02jwkjhr32kvyibnyzgx3smbnm576jwdzg3avdf6zxwckhy5fw4v")))
850812de 321
e77dd15a
JM
322(define-public aspell-dict-uk
323 (aspell-dictionary "uk" "Ukrainian"
324 #:version "1.4.0-0"
325 #:sha256
326 (base32
327 "137i4njvnslab6l4s291s11xijr5jsy75lbdph32f9y183lagy9m")))
328
085bcca3
LC
329\f
330;;;
331;;; Hunspell packages made from the Aspell word lists.
332;;;
333
334(define* (aspell-word-list language synopsis
335 #:optional
336 (nick (string-map (lambda (chr)
337 (if (char=? #\_ chr)
338 #\-
339 chr))
340 (string-downcase language))))
341 (package
342 (name (string-append "hunspell-dict-" nick))
210e43c7 343 (version "2018.04.16")
085bcca3
LC
344 (source (origin
345 (method url-fetch)
346 (uri (string-append
347 "http://downloads.sourceforge.net/wordlist/scowl-"
348 version ".tar.gz"))
349 (sha256
350 (base32
210e43c7 351 "11lkrnhwrf5mvrrq45k4mads3n9aswgac8dc25ba61c75alxb5rs"))))
085bcca3
LC
352 (native-inputs
353 `(("tar" ,tar)
354 ("gzip" ,gzip)
355 ("perl" ,perl)
356 ("aspell" ,aspell)))
357 (build-system gnu-build-system)
358 (arguments
359 `(#:phases
360 (modify-phases %standard-phases
361 (delete 'configure)
362 (delete 'check)
363 (replace 'build
364 (lambda _
365 (substitute* "speller/make-hunspell-dict"
366 (("zip -9 .*$")
367 "return\n"))
368 (mkdir "speller/hunspell")
369
370 ;; XXX: This actually builds all the dictionary variants.
210e43c7 371 (invoke "make" "-C" "speller" "hunspell")))
085bcca3
LC
372 (replace 'install
373 (lambda* (#:key outputs #:allow-other-keys)
374 (let* ((out (assoc-ref %outputs "out"))
375 (hunspell (string-append out "/share/hunspell"))
376 (myspell (string-append out "/share/myspell"))
377 (doc (string-append out "/share/doc/"
22c334fa
LC
378 ,name))
379 (dot-dic ,(string-append "speller/" language ".dic")))
085bcca3 380 (mkdir-p myspell)
22c334fa
LC
381
382 ;; Usually there's only a 'LANGUAGE.dic' file, but for the "en"
383 ;; dictionary, there no 'en.dic'. Instead, there's a set of
384 ;; 'en*.dic' files, hence the 'find-files' call below.
385 (if (file-exists? dot-dic)
386 (install-file dot-dic hunspell)
387 (for-each (lambda (dic)
388 (install-file dic hunspell))
389 (find-files "speller"
390 ,(string-append language ".*\\.dic$"))))
391
085bcca3
LC
392 (install-file ,(string-append "speller/" language ".aff")
393 hunspell)
394 (symlink hunspell (string-append myspell "/dicts"))
395 (for-each (lambda (file)
396 (install-file file doc))
397 (find-files "."
398 "^(Copyright|.*\\.(txt|org|md))$"))
399 #t))))))
400 (synopsis synopsis)
401 (description
402 "This package provides a dictionary for the Hunspell spell-checking
403library.")
404 (home-page "http://wordlist.aspell.net/")
405 (license (non-copyleft "file://Copyright"
406 "Word lists come from several sources, all
407under permissive licensing terms. See the 'Copyright' file."))))
408
409(define-syntax define-word-list-dictionary
410 (syntax-rules (synopsis)
411 ((_ name language (synopsis text))
412 (define-public name
413 (aspell-word-list language text)))
414 ((_ name language nick (synopsis text))
415 (define-public name
416 (aspell-word-list language text nick)))))
417
418(define-word-list-dictionary hunspell-dict-en
419 "en"
420 (synopsis "Hunspell dictionary for English"))
421
422(define-word-list-dictionary hunspell-dict-en-au
423 "en_AU"
424 (synopsis "Hunspell dictionary for Australian English"))
425
426(define-word-list-dictionary hunspell-dict-en-ca
427 "en_CA"
428 (synopsis "Hunspell dictionary for Canadian English"))
429
430(define-word-list-dictionary hunspell-dict-en-gb
431 "en_GB-ise" "en-gb"
432 (synopsis "Hunspell dictionary for British English, with -ise endings"))
433
434(define-word-list-dictionary hunspell-dict-en-gb-ize
435 "en_GB-ize"
436 (synopsis "Hunspell dictionary for British English, with -ize endings"))
437
438(define-word-list-dictionary hunspell-dict-en-us
439 "en_US"
440 (synopsis "Hunspell dictionary for United States English"))