Commit | Line | Data |
---|---|---|
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") | |
4a822462 | 41 | (version "0.60.6.1") |
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 | |
4a822462 EF |
49 | "1qgn5psfyhbrnap275xjfrzppf5a83fb67gpql0kfqv37al869gm")) |
50 | (patches (search-patches "aspell-default-dict-dir.patch" | |
51 | "aspell-gcc-compat.patch")))) | |
708d0ceb | 52 | (build-system gnu-build-system) |
81fc64da FB |
53 | (arguments |
54 | `(#:phases | |
55 | (modify-phases %standard-phases | |
a2908f5a LC |
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))) | |
81fc64da FB |
69 | (add-after 'install 'wrap-aspell |
70 | (lambda* (#:key outputs #:allow-other-keys) | |
71 | (let ((bin/aspell (string-append (assoc-ref outputs "out") | |
72 | "/bin/aspell"))) | |
73 | (wrap-program bin/aspell | |
74 | '("ASPELL_CONF" "" = | |
d3da21d2 MW |
75 | ("${ASPELL_CONF:-\"dict-dir ${GUIX_PROFILE:-$HOME/.guix-profile}/lib/aspell\"}"))) |
76 | #t)))))) | |
708d0ceb | 77 | (inputs `(("perl" ,perl))) |
6d35b1c9 LC |
78 | |
79 | (native-search-paths | |
80 | ;; This is a Guix-specific environment variable that takes a single | |
81 | ;; entry, not an actual search path. | |
82 | (list (search-path-specification | |
83 | (variable "ASPELL_DICT_DIR") | |
84 | (separator #f) | |
85 | (files '("lib/aspell"))))) | |
86 | ||
708d0ceb | 87 | (home-page "http://aspell.net/") |
f50d2669 | 88 | (synopsis "Spell checker") |
708d0ceb | 89 | (description |
a22dc0c4 LC |
90 | "Aspell is a spell-checker which can be used either as a library or as |
91 | a standalone program. Notable features of Aspell include its full support of | |
92 | documents written in the UTF-8 encoding and its ability to use multiple | |
93 | dictionaries, including personal ones.") | |
708d0ceb | 94 | (license lgpl2.1+))) |
15756a7a | 95 | |
15756a7a LC |
96 | ;;; |
97 | ;;; Dictionaries. | |
98 | ;;; | |
707ee324 | 99 | ;;; Use 'export ASPELL_CONF="dict-dir $HOME/.guix-profile/lib/aspell"' to use |
6d35b1c9 LC |
100 | ;;; them, or set the Guix-specific 'ASPELL_DICT_DIR', or just do nothing (as |
101 | ;;; long as 'HOME' is set, that's fine!). | |
15756a7a LC |
102 | ;;; |
103 | ||
104 | (define* (aspell-dictionary dict-name full-name | |
105 | #:key version sha256 (prefix "aspell6-")) | |
106 | (package | |
cd37b144 JM |
107 | (name (string-append |
108 | "aspell-dict-" | |
109 | ;; Downcase and replace underscore in package names | |
110 | ;; to follow Guix naming conventions. | |
111 | (string-map (match-lambda | |
112 | (#\_ #\-) | |
113 | (chr chr)) | |
114 | (string-downcase dict-name)))) | |
15756a7a LC |
115 | (version version) |
116 | (source (origin | |
117 | (method url-fetch) | |
118 | (uri (string-append "mirror://gnu/aspell/dict/" dict-name | |
119 | "/" prefix dict-name "-" | |
120 | version ".tar.bz2")) | |
121 | (sha256 sha256))) | |
122 | (build-system gnu-build-system) | |
123 | (arguments | |
707ee324 TGR |
124 | `(#:phases |
125 | (modify-phases %standard-phases | |
126 | (replace 'configure | |
127 | (lambda* (#:key outputs #:allow-other-keys) | |
128 | (let ((out (assoc-ref outputs "out"))) | |
5f55ca21 | 129 | (invoke "./configure"))))) |
707ee324 TGR |
130 | #:make-flags |
131 | (let ((out (assoc-ref %outputs "out"))) | |
132 | (list (string-append "dictdir=" out "/lib/aspell") | |
133 | (string-append "datadir=" out "/lib/aspell"))) | |
134 | #:tests? #f)) | |
15756a7a LC |
135 | (native-inputs `(("aspell" ,aspell) |
136 | ("which" ,which))) | |
137 | (synopsis (string-append full-name " dictionary for GNU Aspell")) ; XXX: i18n | |
138 | (description | |
139 | "This package provides a dictionary for the GNU Aspell spell checker.") | |
140 | (license gpl2+) | |
141 | (home-page "http://aspell.net/"))) | |
142 | ||
99b9857b | 143 | |
964595dd JM |
144 | (define-public aspell-dict-ar |
145 | (aspell-dictionary "ar" "Arabic" | |
146 | #:version "1.2-0" | |
4a822462 | 147 | #:prefix "aspell6-" |
964595dd JM |
148 | #:sha256 |
149 | (base32 | |
150 | "1avw40bp8yi5bnkq64ihm2rldgw34lk89yz281q9bmndh95a47h4"))) | |
151 | ||
8ac3476d JM |
152 | (define-public aspell-dict-be |
153 | (aspell-dictionary "be" "Belarusian" | |
154 | #:version "0.01" | |
155 | #:prefix "aspell5-" | |
156 | #:sha256 | |
157 | (base32 | |
158 | "1svls9p7rsfi3hs0afh0cssj006qb4v1ik2yzqgj8hm10c6as2sm"))) | |
159 | ||
99b9857b LC |
160 | (define-public aspell-dict-ca |
161 | (aspell-dictionary "ca" "Catalan" | |
162 | #:version "2.1.5-1" | |
163 | #:sha256 | |
164 | (base32 | |
165 | "1fb5y5kgvk25nlsfvc8cai978hg66x3pbp9py56pldc7vxzf9npb"))) | |
15756a7a | 166 | |
06550e07 JD |
167 | (define-public aspell-dict-de |
168 | (aspell-dictionary "de" "German" | |
4dfc7369 | 169 | #:version "20161207-7-0" |
06550e07 JD |
170 | #:sha256 |
171 | (base32 | |
4dfc7369 | 172 | "0wamclvp66xfmv5wff96v6gdlnfv4y8lx3f8wvxyzm5imwgms4n2"))) |
06550e07 | 173 | |
4bb9528c JM |
174 | (define-public aspell-dict-da |
175 | (aspell-dictionary "da" "Danish" | |
176 | #:version "1.4.42-1" | |
177 | #:prefix "aspell5-" | |
178 | #:sha256 | |
179 | (base32 | |
180 | "1hfkmiyhgrx5lgrb2mffjbdn1hivrm73wcg7x0iid74p2yb0fjpp"))) | |
181 | ||
74a40ddd EF |
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 | ||
15756a7a LC |
190 | (define-public aspell-dict-en |
191 | (aspell-dictionary "en" "English" | |
9d0abf0f | 192 | #:version "2019.10.06-0" |
15756a7a LC |
193 | #:sha256 |
194 | (base32 | |
9d0abf0f | 195 | "1zai9wrqwgb9z9vfgb22qhrvxvg73jg0ix44j1khm2f6m96lncr4"))) |
15756a7a LC |
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 | ||
c066a050 JM |
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 | ||
15756a7a LC |
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"))) | |
5d9ecd15 | 226 | |
74a40ddd EF |
227 | (define-public aspell-dict-grc |
228 | (aspell-dictionary "grc" "Ancient Greek" | |
229 | #:version "0.02-0" | |
5d9ecd15 AK |
230 | #:sha256 |
231 | (base32 | |
74a40ddd EF |
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"))) | |
3a6a0f60 | 240 | |
77fe5258 JM |
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 | ||
3a6a0f60 | 249 | (define-public aspell-dict-it |
8dbd8e42 TGR |
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")))) | |
467c498b | 269 | |
c5a88aa0 JM |
270 | (define-public aspell-dict-mi |
271 | (aspell-dictionary "mi" "Maori" | |
272 | #:version "0.50-0" | |
273 | #:sha256 | |
274 | (base32 | |
275 | "12bxplpd348yx8d2q8qvahi9dlp7qf28qmanzhziwc7np8rixvmy"))) | |
276 | ||
467c498b JR |
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"))) | |
8553fe57 | 284 | |
c9400f03 JM |
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 | ||
74a40ddd | 292 | (define-public aspell-dict-pt-br |
cd37b144 | 293 | (aspell-dictionary "pt_BR" "Brazilian Portuguese" |
947141fd | 294 | #:version "20131030-12-0" |
8553fe57 EF |
295 | #:sha256 |
296 | (base32 | |
947141fd | 297 | "1xqlpk21s93c6blkdnpk7l62q9fxjvzdv2x86chl8p2x1gdrj3gb"))) |
74a40ddd | 298 | |
a1fa54f0 | 299 | (define-public aspell-dict-pt-pt |
cd37b144 | 300 | (aspell-dictionary "pt_PT" "Portuguese" |
9eb6d712 | 301 | #:version "20190329-1-0" |
a1fa54f0 JM |
302 | #:sha256 |
303 | (base32 | |
9eb6d712 | 304 | "0ld0d0ily4jqifjfsxfv4shbicz6ymm2gk56fq9gbzra1j4qnw75"))) |
a1fa54f0 | 305 | |
74a40ddd EF |
306 | (define-public aspell-dict-ru |
307 | (aspell-dictionary "ru" "Russian" | |
308 | #:version "0.99f7-1" | |
309 | #:sha256 | |
310 | (base32 | |
311 | "0ip6nq43hcr7vvzbv4lwwmlwgfa60hrhsldh9xy3zg2prv6bcaaw"))) | |
4cf9f57b CA |
312 | |
313 | (define-public aspell-dict-sv | |
314 | (aspell-dictionary "sv" "Swedish" | |
315 | #:version "0.51-0" | |
316 | #:prefix "aspell-" | |
317 | #:sha256 | |
318 | (base32 | |
319 | "02jwkjhr32kvyibnyzgx3smbnm576jwdzg3avdf6zxwckhy5fw4v"))) | |
850812de | 320 | |
e77dd15a JM |
321 | (define-public aspell-dict-uk |
322 | (aspell-dictionary "uk" "Ukrainian" | |
323 | #:version "1.4.0-0" | |
324 | #:sha256 | |
325 | (base32 | |
326 | "137i4njvnslab6l4s291s11xijr5jsy75lbdph32f9y183lagy9m"))) | |
327 | ||
085bcca3 LC |
328 | \f |
329 | ;;; | |
330 | ;;; Hunspell packages made from the Aspell word lists. | |
331 | ;;; | |
332 | ||
333 | (define* (aspell-word-list language synopsis | |
334 | #:optional | |
335 | (nick (string-map (lambda (chr) | |
336 | (if (char=? #\_ chr) | |
337 | #\- | |
338 | chr)) | |
339 | (string-downcase language)))) | |
340 | (package | |
341 | (name (string-append "hunspell-dict-" nick)) | |
210e43c7 | 342 | (version "2018.04.16") |
085bcca3 LC |
343 | (source (origin |
344 | (method url-fetch) | |
345 | (uri (string-append | |
346 | "http://downloads.sourceforge.net/wordlist/scowl-" | |
347 | version ".tar.gz")) | |
348 | (sha256 | |
349 | (base32 | |
210e43c7 | 350 | "11lkrnhwrf5mvrrq45k4mads3n9aswgac8dc25ba61c75alxb5rs")))) |
085bcca3 LC |
351 | (native-inputs |
352 | `(("tar" ,tar) | |
353 | ("gzip" ,gzip) | |
354 | ("perl" ,perl) | |
355 | ("aspell" ,aspell))) | |
356 | (build-system gnu-build-system) | |
357 | (arguments | |
358 | `(#:phases | |
359 | (modify-phases %standard-phases | |
360 | (delete 'configure) | |
361 | (delete 'check) | |
362 | (replace 'build | |
363 | (lambda _ | |
364 | (substitute* "speller/make-hunspell-dict" | |
365 | (("zip -9 .*$") | |
366 | "return\n")) | |
367 | (mkdir "speller/hunspell") | |
368 | ||
369 | ;; XXX: This actually builds all the dictionary variants. | |
210e43c7 | 370 | (invoke "make" "-C" "speller" "hunspell"))) |
085bcca3 LC |
371 | (replace 'install |
372 | (lambda* (#:key outputs #:allow-other-keys) | |
373 | (let* ((out (assoc-ref %outputs "out")) | |
374 | (hunspell (string-append out "/share/hunspell")) | |
375 | (myspell (string-append out "/share/myspell")) | |
376 | (doc (string-append out "/share/doc/" | |
22c334fa LC |
377 | ,name)) |
378 | (dot-dic ,(string-append "speller/" language ".dic"))) | |
085bcca3 | 379 | (mkdir-p myspell) |
22c334fa LC |
380 | |
381 | ;; Usually there's only a 'LANGUAGE.dic' file, but for the "en" | |
382 | ;; dictionary, there no 'en.dic'. Instead, there's a set of | |
383 | ;; 'en*.dic' files, hence the 'find-files' call below. | |
384 | (if (file-exists? dot-dic) | |
385 | (install-file dot-dic hunspell) | |
386 | (for-each (lambda (dic) | |
387 | (install-file dic hunspell)) | |
388 | (find-files "speller" | |
389 | ,(string-append language ".*\\.dic$")))) | |
390 | ||
085bcca3 LC |
391 | (install-file ,(string-append "speller/" language ".aff") |
392 | hunspell) | |
393 | (symlink hunspell (string-append myspell "/dicts")) | |
394 | (for-each (lambda (file) | |
395 | (install-file file doc)) | |
396 | (find-files "." | |
397 | "^(Copyright|.*\\.(txt|org|md))$")) | |
398 | #t)))))) | |
399 | (synopsis synopsis) | |
400 | (description | |
401 | "This package provides a dictionary for the Hunspell spell-checking | |
402 | library.") | |
403 | (home-page "http://wordlist.aspell.net/") | |
404 | (license (non-copyleft "file://Copyright" | |
405 | "Word lists come from several sources, all | |
406 | under permissive licensing terms. See the 'Copyright' file.")))) | |
407 | ||
408 | (define-syntax define-word-list-dictionary | |
409 | (syntax-rules (synopsis) | |
410 | ((_ name language (synopsis text)) | |
411 | (define-public name | |
412 | (aspell-word-list language text))) | |
413 | ((_ name language nick (synopsis text)) | |
414 | (define-public name | |
415 | (aspell-word-list language text nick))))) | |
416 | ||
417 | (define-word-list-dictionary hunspell-dict-en | |
418 | "en" | |
419 | (synopsis "Hunspell dictionary for English")) | |
420 | ||
421 | (define-word-list-dictionary hunspell-dict-en-au | |
422 | "en_AU" | |
423 | (synopsis "Hunspell dictionary for Australian English")) | |
424 | ||
425 | (define-word-list-dictionary hunspell-dict-en-ca | |
426 | "en_CA" | |
427 | (synopsis "Hunspell dictionary for Canadian English")) | |
428 | ||
429 | (define-word-list-dictionary hunspell-dict-en-gb | |
430 | "en_GB-ise" "en-gb" | |
431 | (synopsis "Hunspell dictionary for British English, with -ise endings")) | |
432 | ||
433 | (define-word-list-dictionary hunspell-dict-en-gb-ize | |
434 | "en_GB-ize" | |
435 | (synopsis "Hunspell dictionary for British English, with -ize endings")) | |
436 | ||
437 | (define-word-list-dictionary hunspell-dict-en-us | |
438 | "en_US" | |
439 | (synopsis "Hunspell dictionary for United States English")) |