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, 2019 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>
10 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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 (guix utils)
31 #:use-module (gnu packages)
32 #:use-module (gnu packages base)
33 #:use-module (gnu packages compression)
34 #:use-module (gnu packages perl))
43 (uri (string-append "mirror://gnu/aspell/aspell-"
47 "1qgn5psfyhbrnap275xjfrzppf5a83fb67gpql0kfqv37al869gm"))
48 (patches (search-patches "aspell-default-dict-dir.patch"))))
49 (build-system gnu-build-system)
52 (modify-phases %standard-phases
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
66 (add-after 'install 'wrap-aspell
67 (lambda* (#:key outputs #:allow-other-keys)
68 (let ((bin/aspell (string-append (assoc-ref outputs "out")
70 (wrap-program bin/aspell
72 ("${ASPELL_CONF:-\"dict-dir ${GUIX_PROFILE:-$HOME/.guix-profile}/lib/aspell\"}")))
74 (inputs `(("perl" ,perl)))
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")
82 (files '("lib/aspell")))))
84 (home-page "http://aspell.net/")
85 (synopsis "Spell checker")
87 "Aspell is a spell-checker which can be used either as a library or as
88 a standalone program. Notable features of Aspell include its full support of
89 documents written in the UTF-8 encoding and its ability to use multiple
90 dictionaries, including personal ones.")
96 ;;; Use 'export ASPELL_CONF="dict-dir $HOME/.guix-profile/lib/aspell"' to use
97 ;;; them, or set the Guix-specific 'ASPELL_DICT_DIR', or just do nothing (as
98 ;;; long as 'HOME' is set, that's fine!).
101 (define* (aspell-dictionary dict-name full-name
102 #:key version sha256 (prefix "aspell6-"))
104 (name (string-append "aspell-dict-" dict-name))
108 (uri (string-append "mirror://gnu/aspell/dict/" dict-name
109 "/" prefix dict-name "-"
112 (build-system gnu-build-system)
115 (modify-phases %standard-phases
117 (lambda* (#:key outputs #:allow-other-keys)
118 (let ((out (assoc-ref outputs "out")))
119 (invoke "./configure")))))
121 (let ((out (assoc-ref %outputs "out")))
122 (list (string-append "dictdir=" out "/lib/aspell")
123 (string-append "datadir=" out "/lib/aspell")))
125 (native-inputs `(("aspell" ,aspell)
127 (synopsis (string-append full-name " dictionary for GNU Aspell")) ; XXX: i18n
129 "This package provides a dictionary for the GNU Aspell spell checker.")
131 (home-page "http://aspell.net/")))
134 (define-public aspell-dict-ca
135 (aspell-dictionary "ca" "Catalan"
139 "1fb5y5kgvk25nlsfvc8cai978hg66x3pbp9py56pldc7vxzf9npb")))
141 (define-public aspell-dict-de
142 (aspell-dictionary "de" "German"
143 #:version "20030222-1"
146 "01p92qj66cqb346gk7hjfynaap5sbcn85xz07kjfdq623ghr8v5s")))
148 (define-public aspell-dict-el
149 (aspell-dictionary "el" "Greek"
154 "1ljcc30zg2v2h3w5h5jr5im41mw8jbsgvvhdd2cii2yzi8d0zxja")))
156 (define-public aspell-dict-en
157 (aspell-dictionary "en" "English"
158 #:version "2018.04.16-0"
161 "0bxxdzkk9g27plg22y9qzsx9cfjw3aa29w5bmzs561qc9gkp247i")))
163 (define-public aspell-dict-eo
164 (aspell-dictionary "eo" "Esperanto"
165 #:version "2.1.20000225a-2"
168 "09vf0mbiicbmyb4bwb7v7lgpabnylg0wy7m3hlhl5rjdda6x3lj1")))
170 (define-public aspell-dict-es
171 (aspell-dictionary "es" "Spanish"
175 "1k5g328ac1hdpp6fsg57d8md6i0aqcwlszp3gbmp5706wyhpydmd")))
177 (define-public aspell-dict-fr
178 (aspell-dictionary "fr" "French"
183 "14ffy9mn5jqqpp437kannc3559bfdrpk7r36ljkzjalxa53i0hpr")))
185 (define-public aspell-dict-grc
186 (aspell-dictionary "grc" "Ancient Greek"
190 "1zxr8958v37v260fkqd4pg37ns5h5kyqm54hn1hg70wq5cz8h512")))
192 (define-public aspell-dict-he
193 (aspell-dictionary "he" "Hebrew"
197 "13bhbghx5b8g0119g3wxd4n8mlf707y41vlf59irxjj0kynankfn")))
199 (define-public aspell-dict-it
200 (aspell-dictionary "it" "Italian"
201 #:version "2.2_20050523-0"
204 "1gdf7bc1a0kmxsmphdqq8pl01h667mjsj6hihy6kqy14k5qdq69v")))
206 (define-public aspell-dict-nl
207 (aspell-dictionary "nl" "Dutch"
212 "0ffb87yjsh211hllpc4b9khqqrblial4pzi1h9r3v465z1yhn3j4")))
214 (define-public aspell-dict-pt-br
215 (aspell-dictionary "pt-br" "Brazilian Portuguese"
216 #:version "20090702-0"
220 "1y09lx9zf2rnp55r16b2vgj953l3538z1vaqgflg9mdvm555bz3p")))
222 (define-public aspell-dict-ru
223 (aspell-dictionary "ru" "Russian"
227 "0ip6nq43hcr7vvzbv4lwwmlwgfa60hrhsldh9xy3zg2prv6bcaaw")))
229 (define-public aspell-dict-sv
230 (aspell-dictionary "sv" "Swedish"
235 "02jwkjhr32kvyibnyzgx3smbnm576jwdzg3avdf6zxwckhy5fw4v")))
239 ;;; Hunspell packages made from the Aspell word lists.
242 (define* (aspell-word-list language synopsis
244 (nick (string-map (lambda (chr)
248 (string-downcase language))))
250 (name (string-append "hunspell-dict-" nick))
251 (version "2018.04.16")
255 "http://downloads.sourceforge.net/wordlist/scowl-"
259 "11lkrnhwrf5mvrrq45k4mads3n9aswgac8dc25ba61c75alxb5rs"))))
265 (build-system gnu-build-system)
268 (modify-phases %standard-phases
273 (substitute* "speller/make-hunspell-dict"
276 (mkdir "speller/hunspell")
278 ;; XXX: This actually builds all the dictionary variants.
279 (invoke "make" "-C" "speller" "hunspell")))
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/"
287 (dot-dic ,(string-append "speller/" language ".dic")))
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$"))))
300 (install-file ,(string-append "speller/" language ".aff")
302 (symlink hunspell (string-append myspell "/dicts"))
303 (for-each (lambda (file)
304 (install-file file doc))
306 "^(Copyright|.*\\.(txt|org|md))$"))
310 "This package provides a dictionary for the Hunspell spell-checking
312 (home-page "http://wordlist.aspell.net/")
313 (license (non-copyleft "file://Copyright"
314 "Word lists come from several sources, all
315 under permissive licensing terms. See the 'Copyright' file."))))
317 (define-syntax define-word-list-dictionary
318 (syntax-rules (synopsis)
319 ((_ name language (synopsis text))
321 (aspell-word-list language text)))
322 ((_ name language nick (synopsis text))
324 (aspell-word-list language text nick)))))
326 (define-word-list-dictionary hunspell-dict-en
328 (synopsis "Hunspell dictionary for English"))
330 (define-word-list-dictionary hunspell-dict-en-au
332 (synopsis "Hunspell dictionary for Australian English"))
334 (define-word-list-dictionary hunspell-dict-en-ca
336 (synopsis "Hunspell dictionary for Canadian English"))
338 (define-word-list-dictionary hunspell-dict-en-gb
340 (synopsis "Hunspell dictionary for British English, with -ise endings"))
342 (define-word-list-dictionary hunspell-dict-en-gb-ize
344 (synopsis "Hunspell dictionary for British English, with -ize endings"))
346 (define-word-list-dictionary hunspell-dict-en-us
348 (synopsis "Hunspell dictionary for United States English"))