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