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