gnu: python-mako: Update to 1.0.7.
[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>
0e1b4d8e 5;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
4cf9f57b 6;;; Copyright © 2016 Christopher Andersson <christopher@8bits.nu>
d109b1e8 7;;; Copyright © 2016 Theodoros Foradis <theodoros@foradis.org>
625761a5 8;;; Copyright © 2016, 2017 Tobias Geerinckx-Rice <me@tobias.gr>
708d0ceb
LC
9;;;
10;;; This file is part of GNU Guix.
11;;;
12;;; GNU Guix is free software; you can redistribute it and/or modify it
13;;; under the terms of the GNU General Public License as published by
14;;; the Free Software Foundation; either version 3 of the License, or (at
15;;; your option) any later version.
16;;;
17;;; GNU Guix is distributed in the hope that it will be useful, but
18;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;;; GNU General Public License for more details.
21;;;
22;;; You should have received a copy of the GNU General Public License
23;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
1ffa7090 25(define-module (gnu packages aspell)
708d0ceb
LC
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix build-system gnu)
29 #:use-module (guix licenses)
6d35b1c9 30 #:use-module (gnu packages)
085bcca3
LC
31 #:use-module (gnu packages base)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages perl))
708d0ceb
LC
34
35(define-public aspell
36 (package
37 (name "aspell")
38 (version "0.60.6.1")
39 (source
40 (origin
41 (method url-fetch)
42 (uri (string-append "mirror://gnu/aspell/aspell-"
43 version ".tar.gz"))
44 (sha256
45 (base32
6d35b1c9
LC
46 "1qgn5psfyhbrnap275xjfrzppf5a83fb67gpql0kfqv37al869gm"))
47 (patches (search-patches "aspell-default-dict-dir.patch"))))
708d0ceb 48 (build-system gnu-build-system)
81fc64da
FB
49 (arguments
50 `(#:phases
51 (modify-phases %standard-phases
52 (add-after 'install 'wrap-aspell
53 (lambda* (#:key outputs #:allow-other-keys)
54 (let ((bin/aspell (string-append (assoc-ref outputs "out")
55 "/bin/aspell")))
56 (wrap-program bin/aspell
57 '("ASPELL_CONF" "" =
58 ("${ASPELL_CONF:-\"dict-dir ${GUIX_PROFILE:-$HOME/.guix-profile}/lib/aspell\"}")))))))))
708d0ceb 59 (inputs `(("perl" ,perl)))
6d35b1c9
LC
60
61 (native-search-paths
62 ;; This is a Guix-specific environment variable that takes a single
63 ;; entry, not an actual search path.
64 (list (search-path-specification
65 (variable "ASPELL_DICT_DIR")
66 (separator #f)
67 (files '("lib/aspell")))))
68
708d0ceb 69 (home-page "http://aspell.net/")
f50d2669 70 (synopsis "Spell checker")
708d0ceb 71 (description
a22dc0c4
LC
72 "Aspell is a spell-checker which can be used either as a library or as
73a standalone program. Notable features of Aspell include its full support of
74documents written in the UTF-8 encoding and its ability to use multiple
75dictionaries, including personal ones.")
708d0ceb 76 (license lgpl2.1+)))
15756a7a 77
15756a7a
LC
78;;;
79;;; Dictionaries.
80;;;
707ee324 81;;; Use 'export ASPELL_CONF="dict-dir $HOME/.guix-profile/lib/aspell"' to use
6d35b1c9
LC
82;;; them, or set the Guix-specific 'ASPELL_DICT_DIR', or just do nothing (as
83;;; long as 'HOME' is set, that's fine!).
15756a7a
LC
84;;;
85
86(define* (aspell-dictionary dict-name full-name
87 #:key version sha256 (prefix "aspell6-"))
88 (package
89 (name (string-append "aspell-dict-" dict-name))
90 (version version)
91 (source (origin
92 (method url-fetch)
93 (uri (string-append "mirror://gnu/aspell/dict/" dict-name
94 "/" prefix dict-name "-"
95 version ".tar.bz2"))
96 (sha256 sha256)))
97 (build-system gnu-build-system)
98 (arguments
707ee324
TGR
99 `(#:phases
100 (modify-phases %standard-phases
101 (replace 'configure
102 (lambda* (#:key outputs #:allow-other-keys)
103 (let ((out (assoc-ref outputs "out")))
104 (zero? (system* "./configure"))))))
105 #:make-flags
106 (let ((out (assoc-ref %outputs "out")))
107 (list (string-append "dictdir=" out "/lib/aspell")
108 (string-append "datadir=" out "/lib/aspell")))
109 #:tests? #f))
15756a7a
LC
110 (native-inputs `(("aspell" ,aspell)
111 ("which" ,which)))
112 (synopsis (string-append full-name " dictionary for GNU Aspell")) ; XXX: i18n
113 (description
114 "This package provides a dictionary for the GNU Aspell spell checker.")
115 (license gpl2+)
116 (home-page "http://aspell.net/")))
117
99b9857b
LC
118
119(define-public aspell-dict-ca
120 (aspell-dictionary "ca" "Catalan"
121 #:version "2.1.5-1"
122 #:sha256
123 (base32
124 "1fb5y5kgvk25nlsfvc8cai978hg66x3pbp9py56pldc7vxzf9npb")))
15756a7a 125
06550e07
JD
126(define-public aspell-dict-de
127 (aspell-dictionary "de" "German"
128 #:version "20030222-1"
129 #:sha256
130 (base32
131 "01p92qj66cqb346gk7hjfynaap5sbcn85xz07kjfdq623ghr8v5s")))
132
74a40ddd
EF
133(define-public aspell-dict-el
134 (aspell-dictionary "el" "Greek"
135 #:version "0.08-0"
136 #:prefix "aspell6-"
137 #:sha256
138 (base32
139 "1ljcc30zg2v2h3w5h5jr5im41mw8jbsgvvhdd2cii2yzi8d0zxja")))
140
15756a7a
LC
141(define-public aspell-dict-en
142 (aspell-dictionary "en" "English"
0e1b4d8e 143 #:version "2017.08.24-0"
15756a7a
LC
144 #:sha256
145 (base32
0e1b4d8e 146 "0z2vvm1by485cm0sna21cmw6zb771c2l2lnn676zmrwm46q65d89")))
15756a7a
LC
147
148(define-public aspell-dict-eo
149 (aspell-dictionary "eo" "Esperanto"
150 #:version "2.1.20000225a-2"
151 #:sha256
152 (base32
153 "09vf0mbiicbmyb4bwb7v7lgpabnylg0wy7m3hlhl5rjdda6x3lj1")))
154
155(define-public aspell-dict-es
156 (aspell-dictionary "es" "Spanish"
157 #:version "1.11-2"
158 #:sha256
159 (base32
160 "1k5g328ac1hdpp6fsg57d8md6i0aqcwlszp3gbmp5706wyhpydmd")))
161
162(define-public aspell-dict-fr
163 (aspell-dictionary "fr" "French"
164 #:version "0.50-3"
165 #:prefix "aspell-"
166 #:sha256
167 (base32
168 "14ffy9mn5jqqpp437kannc3559bfdrpk7r36ljkzjalxa53i0hpr")))
5d9ecd15 169
74a40ddd
EF
170(define-public aspell-dict-grc
171 (aspell-dictionary "grc" "Ancient Greek"
172 #:version "0.02-0"
5d9ecd15
AK
173 #:sha256
174 (base32
74a40ddd
EF
175 "1zxr8958v37v260fkqd4pg37ns5h5kyqm54hn1hg70wq5cz8h512")))
176
177(define-public aspell-dict-he
178 (aspell-dictionary "he" "Hebrew"
179 #:version "1.0-0"
180 #:sha256
181 (base32
182 "13bhbghx5b8g0119g3wxd4n8mlf707y41vlf59irxjj0kynankfn")))
3a6a0f60
FB
183
184(define-public aspell-dict-it
185 (aspell-dictionary "it" "Italian"
186 #:version "2.2_20050523-0"
187 #:sha256
188 (base32
189 "1gdf7bc1a0kmxsmphdqq8pl01h667mjsj6hihy6kqy14k5qdq69v")))
467c498b
JR
190
191(define-public aspell-dict-nl
192 (aspell-dictionary "nl" "Dutch"
193 #:version "0.50-2"
194 #:prefix "aspell-"
195 #:sha256
196 (base32
197 "0ffb87yjsh211hllpc4b9khqqrblial4pzi1h9r3v465z1yhn3j4")))
8553fe57 198
74a40ddd
EF
199(define-public aspell-dict-pt-br
200 (aspell-dictionary "pt-br" "Brazilian Portuguese"
201 #:version "20090702-0"
202 #:prefix "aspell6-"
8553fe57
EF
203 #:sha256
204 (base32
74a40ddd
EF
205 "1y09lx9zf2rnp55r16b2vgj953l3538z1vaqgflg9mdvm555bz3p")))
206
207(define-public aspell-dict-ru
208 (aspell-dictionary "ru" "Russian"
209 #:version "0.99f7-1"
210 #:sha256
211 (base32
212 "0ip6nq43hcr7vvzbv4lwwmlwgfa60hrhsldh9xy3zg2prv6bcaaw")))
4cf9f57b
CA
213
214(define-public aspell-dict-sv
215 (aspell-dictionary "sv" "Swedish"
216 #:version "0.51-0"
217 #:prefix "aspell-"
218 #:sha256
219 (base32
220 "02jwkjhr32kvyibnyzgx3smbnm576jwdzg3avdf6zxwckhy5fw4v")))
850812de 221
085bcca3
LC
222\f
223;;;
224;;; Hunspell packages made from the Aspell word lists.
225;;;
226
227(define* (aspell-word-list language synopsis
228 #:optional
229 (nick (string-map (lambda (chr)
230 (if (char=? #\_ chr)
231 #\-
232 chr))
233 (string-downcase language))))
234 (package
235 (name (string-append "hunspell-dict-" nick))
236 (version "2017.08.24")
237 (source (origin
238 (method url-fetch)
239 (uri (string-append
240 "http://downloads.sourceforge.net/wordlist/scowl-"
241 version ".tar.gz"))
242 (sha256
243 (base32
244 "1kdhydzg5z5x20ad2j1x5hbdhvy08ljkfdi2v3gbyvghbagxm15s"))))
245 (native-inputs
246 `(("tar" ,tar)
247 ("gzip" ,gzip)
248 ("perl" ,perl)
249 ("aspell" ,aspell)))
250 (build-system gnu-build-system)
251 (arguments
252 `(#:phases
253 (modify-phases %standard-phases
254 (delete 'configure)
255 (delete 'check)
256 (replace 'build
257 (lambda _
258 (substitute* "speller/make-hunspell-dict"
259 (("zip -9 .*$")
260 "return\n"))
261 (mkdir "speller/hunspell")
262
263 ;; XXX: This actually builds all the dictionary variants.
264 (zero? (system* "make" "-C" "speller" "hunspell"))))
265 (replace 'install
266 (lambda* (#:key outputs #:allow-other-keys)
267 (let* ((out (assoc-ref %outputs "out"))
268 (hunspell (string-append out "/share/hunspell"))
269 (myspell (string-append out "/share/myspell"))
270 (doc (string-append out "/share/doc/"
22c334fa
LC
271 ,name))
272 (dot-dic ,(string-append "speller/" language ".dic")))
085bcca3 273 (mkdir-p myspell)
22c334fa
LC
274
275 ;; Usually there's only a 'LANGUAGE.dic' file, but for the "en"
276 ;; dictionary, there no 'en.dic'. Instead, there's a set of
277 ;; 'en*.dic' files, hence the 'find-files' call below.
278 (if (file-exists? dot-dic)
279 (install-file dot-dic hunspell)
280 (for-each (lambda (dic)
281 (install-file dic hunspell))
282 (find-files "speller"
283 ,(string-append language ".*\\.dic$"))))
284
085bcca3
LC
285 (install-file ,(string-append "speller/" language ".aff")
286 hunspell)
287 (symlink hunspell (string-append myspell "/dicts"))
288 (for-each (lambda (file)
289 (install-file file doc))
290 (find-files "."
291 "^(Copyright|.*\\.(txt|org|md))$"))
292 #t))))))
293 (synopsis synopsis)
294 (description
295 "This package provides a dictionary for the Hunspell spell-checking
296library.")
297 (home-page "http://wordlist.aspell.net/")
298 (license (non-copyleft "file://Copyright"
299 "Word lists come from several sources, all
300under permissive licensing terms. See the 'Copyright' file."))))
301
302(define-syntax define-word-list-dictionary
303 (syntax-rules (synopsis)
304 ((_ name language (synopsis text))
305 (define-public name
306 (aspell-word-list language text)))
307 ((_ name language nick (synopsis text))
308 (define-public name
309 (aspell-word-list language text nick)))))
310
311(define-word-list-dictionary hunspell-dict-en
312 "en"
313 (synopsis "Hunspell dictionary for English"))
314
315(define-word-list-dictionary hunspell-dict-en-au
316 "en_AU"
317 (synopsis "Hunspell dictionary for Australian English"))
318
319(define-word-list-dictionary hunspell-dict-en-ca
320 "en_CA"
321 (synopsis "Hunspell dictionary for Canadian English"))
322
323(define-word-list-dictionary hunspell-dict-en-gb
324 "en_GB-ise" "en-gb"
325 (synopsis "Hunspell dictionary for British English, with -ise endings"))
326
327(define-word-list-dictionary hunspell-dict-en-gb-ize
328 "en_GB-ize"
329 (synopsis "Hunspell dictionary for British English, with -ize endings"))
330
331(define-word-list-dictionary hunspell-dict-en-us
332 "en_US"
333 (synopsis "Hunspell dictionary for United States English"))