1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2017, 2018, 2019 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, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
9 ;;; Copyright © 2019 Jens Mølgaard <jens@zete.tk>
11 ;;; This file is part of GNU Guix.
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.
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.
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/>.
26 (define-module (gnu packages aspell)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix build-system gnu)
30 #:use-module (guix licenses)
31 #:use-module (guix utils)
32 #:use-module (gnu packages)
33 #:use-module (gnu packages base)
34 #:use-module (gnu packages compression)
35 #:use-module (gnu packages perl)
36 #:use-module (ice-9 match))
45 (uri (string-append "mirror://gnu/aspell/aspell-"
49 "1wi60ankalmh8ds7nplz434jd7j94gdvbahdwsr539rlad8pxdzr"))
50 (patches (search-patches "aspell-default-dict-dir.patch"))))
51 (build-system gnu-build-system)
54 (modify-phases %standard-phases
55 (add-before 'build 'set-filter-path
56 (lambda* (#:key outputs #:allow-other-keys)
57 ;; Change the default value of 'filter-path' so that filters such
58 ;; as 'tex-filter.so' can be found. By default none of the
59 ;; filters would be found.
60 (let* ((out (assoc-ref outputs "out"))
61 (libdir (string-append out "/lib/aspell-"
62 ,(version-major+minor version))))
63 (substitute* "common/config.cpp"
64 (("\"filter-path(.*)DICT_DIR" _ middle)
65 (string-append "\"filter-path" middle
68 (inputs `(("perl" ,perl)))
71 ;; This is a Guix-specific environment variable that takes a single
72 ;; entry, not an actual search path.
73 (list (search-path-specification
74 (variable "ASPELL_DICT_DIR")
76 (files '("lib/aspell")))))
78 (home-page "http://aspell.net/")
79 (synopsis "Spell checker")
81 "Aspell is a spell-checker which can be used either as a library or as
82 a standalone program. Notable features of Aspell include its full support of
83 documents written in the UTF-8 encoding and its ability to use multiple
84 dictionaries, including personal ones.")
90 ;;; Use 'export ASPELL_CONF="dict-dir $HOME/.guix-profile/lib/aspell"' to use
91 ;;; them, or set the Guix-specific 'ASPELL_DICT_DIR', or just do nothing (as
92 ;;; long as 'HOME' is set, that's fine!).
95 (define* (aspell-dictionary dict-name full-name
96 #:key version sha256 (prefix "aspell6-"))
100 ;; Downcase and replace underscore in package names
101 ;; to follow Guix naming conventions.
102 (string-map (match-lambda
105 (string-downcase dict-name))))
109 (uri (string-append "mirror://gnu/aspell/dict/" dict-name
110 "/" prefix dict-name "-"
113 (build-system gnu-build-system)
116 (modify-phases %standard-phases
118 (lambda* (#:key outputs #:allow-other-keys)
119 (let ((out (assoc-ref outputs "out")))
120 (invoke "./configure")))))
122 (let ((out (assoc-ref %outputs "out")))
123 (list (string-append "dictdir=" out "/lib/aspell")
124 (string-append "datadir=" out "/lib/aspell")))
126 (native-inputs `(("aspell" ,aspell)
128 (synopsis (string-append full-name " dictionary for GNU Aspell")) ; XXX: i18n
130 "This package provides a dictionary for the GNU Aspell spell checker.")
132 (home-page "http://aspell.net/")))
135 (define-public aspell-dict-ar
136 (aspell-dictionary "ar" "Arabic"
141 "1avw40bp8yi5bnkq64ihm2rldgw34lk89yz281q9bmndh95a47h4")))
143 (define-public aspell-dict-be
144 (aspell-dictionary "be" "Belarusian"
149 "1svls9p7rsfi3hs0afh0cssj006qb4v1ik2yzqgj8hm10c6as2sm")))
151 (define-public aspell-dict-ca
152 (aspell-dictionary "ca" "Catalan"
156 "1fb5y5kgvk25nlsfvc8cai978hg66x3pbp9py56pldc7vxzf9npb")))
158 (define-public aspell-dict-de
159 (aspell-dictionary "de" "German"
160 #:version "20030222-1"
163 "01p92qj66cqb346gk7hjfynaap5sbcn85xz07kjfdq623ghr8v5s")))
165 (define-public aspell-dict-da
166 (aspell-dictionary "da" "Danish"
171 "1hfkmiyhgrx5lgrb2mffjbdn1hivrm73wcg7x0iid74p2yb0fjpp")))
173 (define-public aspell-dict-el
174 (aspell-dictionary "el" "Greek"
179 "1ljcc30zg2v2h3w5h5jr5im41mw8jbsgvvhdd2cii2yzi8d0zxja")))
181 (define-public aspell-dict-en
182 (aspell-dictionary "en" "English"
183 #:version "2018.04.16-0"
186 "0bxxdzkk9g27plg22y9qzsx9cfjw3aa29w5bmzs561qc9gkp247i")))
188 (define-public aspell-dict-eo
189 (aspell-dictionary "eo" "Esperanto"
190 #:version "2.1.20000225a-2"
193 "09vf0mbiicbmyb4bwb7v7lgpabnylg0wy7m3hlhl5rjdda6x3lj1")))
195 (define-public aspell-dict-es
196 (aspell-dictionary "es" "Spanish"
200 "1k5g328ac1hdpp6fsg57d8md6i0aqcwlszp3gbmp5706wyhpydmd")))
202 (define-public aspell-dict-fi
203 (aspell-dictionary "fi" "Finnish"
208 "07d5s08ba4dd89cmwy9icc01i6fjdykxlb9ravmhdrhi8mxz1mzq")))
210 (define-public aspell-dict-fr
211 (aspell-dictionary "fr" "French"
216 "14ffy9mn5jqqpp437kannc3559bfdrpk7r36ljkzjalxa53i0hpr")))
218 (define-public aspell-dict-grc
219 (aspell-dictionary "grc" "Ancient Greek"
223 "1zxr8958v37v260fkqd4pg37ns5h5kyqm54hn1hg70wq5cz8h512")))
225 (define-public aspell-dict-he
226 (aspell-dictionary "he" "Hebrew"
230 "13bhbghx5b8g0119g3wxd4n8mlf707y41vlf59irxjj0kynankfn")))
232 (define-public aspell-dict-hi
233 (aspell-dictionary "hi" "Hindi"
238 "0drs374qz4419zx1lf2k281ydxf2750jk5ailafj1x0ncz27h1ys")))
240 (define-public aspell-dict-it
241 (let ((version "2.4-20070901-0")
243 (base32 "0d6ypii3jblprpibazb6ypady536jz62rwxlss1x1raq07rhvvqn")))
245 (inherit (aspell-dictionary "it" "Italian"
249 ;; The version hosted at <https://ftp.gnu.org/gnu/aspell/dict> is even
254 (uri (string-append "mirror://sourceforge/linguistico/"
255 "Dizionario%20italiano%20per%20Aspell/" version "/"
256 "aspell6-it-" version ".tar.bz2"))
259 "http://linguistico.sourceforge.net/pages/dizionario_italiano.html"))))
261 (define-public aspell-dict-mi
262 (aspell-dictionary "mi" "Maori"
266 "12bxplpd348yx8d2q8qvahi9dlp7qf28qmanzhziwc7np8rixvmy")))
268 (define-public aspell-dict-nl
269 (aspell-dictionary "nl" "Dutch"
274 "0ffb87yjsh211hllpc4b9khqqrblial4pzi1h9r3v465z1yhn3j4")))
276 (define-public aspell-dict-nn
277 (aspell-dictionary "nn" "Norwegian Nynorsk"
281 "0w2k5l5rbqpliripgqwiqixz5ghnjf7i9ggbrc4ly4vy1ia10rmc")))
283 (define-public aspell-dict-pt-br
284 (aspell-dictionary "pt_BR" "Brazilian Portuguese"
285 #:version "20090702-0"
289 "1y09lx9zf2rnp55r16b2vgj953l3538z1vaqgflg9mdvm555bz3p")))
291 (define-public aspell-dict-pt-pt
292 (aspell-dictionary "pt_PT" "Portuguese"
293 #:version "20070510-0"
297 "1mnr994cwlag6shy8865ky99lymysiln07mbldcncahg90dagdxq")))
299 (define-public aspell-dict-ru
300 (aspell-dictionary "ru" "Russian"
304 "0ip6nq43hcr7vvzbv4lwwmlwgfa60hrhsldh9xy3zg2prv6bcaaw")))
306 (define-public aspell-dict-sv
307 (aspell-dictionary "sv" "Swedish"
312 "02jwkjhr32kvyibnyzgx3smbnm576jwdzg3avdf6zxwckhy5fw4v")))
314 (define-public aspell-dict-uk
315 (aspell-dictionary "uk" "Ukrainian"
319 "137i4njvnslab6l4s291s11xijr5jsy75lbdph32f9y183lagy9m")))
323 ;;; Hunspell packages made from the Aspell word lists.
326 (define* (aspell-word-list language synopsis
328 (nick (string-map (lambda (chr)
332 (string-downcase language))))
334 (name (string-append "hunspell-dict-" nick))
335 (version "2018.04.16")
339 "http://downloads.sourceforge.net/wordlist/scowl-"
343 "11lkrnhwrf5mvrrq45k4mads3n9aswgac8dc25ba61c75alxb5rs"))))
349 (build-system gnu-build-system)
352 (modify-phases %standard-phases
357 (substitute* "speller/make-hunspell-dict"
360 (mkdir "speller/hunspell")
362 ;; XXX: This actually builds all the dictionary variants.
363 (invoke "make" "-C" "speller" "hunspell")))
365 (lambda* (#:key outputs #:allow-other-keys)
366 (let* ((out (assoc-ref %outputs "out"))
367 (hunspell (string-append out "/share/hunspell"))
368 (myspell (string-append out "/share/myspell"))
369 (doc (string-append out "/share/doc/"
371 (dot-dic ,(string-append "speller/" language ".dic")))
374 ;; Usually there's only a 'LANGUAGE.dic' file, but for the "en"
375 ;; dictionary, there no 'en.dic'. Instead, there's a set of
376 ;; 'en*.dic' files, hence the 'find-files' call below.
377 (if (file-exists? dot-dic)
378 (install-file dot-dic hunspell)
379 (for-each (lambda (dic)
380 (install-file dic hunspell))
381 (find-files "speller"
382 ,(string-append language ".*\\.dic$"))))
384 (install-file ,(string-append "speller/" language ".aff")
386 (symlink hunspell (string-append myspell "/dicts"))
387 (for-each (lambda (file)
388 (install-file file doc))
390 "^(Copyright|.*\\.(txt|org|md))$"))
394 "This package provides a dictionary for the Hunspell spell-checking
396 (home-page "http://wordlist.aspell.net/")
397 (license (non-copyleft "file://Copyright"
398 "Word lists come from several sources, all
399 under permissive licensing terms. See the 'Copyright' file."))))
401 (define-syntax define-word-list-dictionary
402 (syntax-rules (synopsis)
403 ((_ name language (synopsis text))
405 (aspell-word-list language text)))
406 ((_ name language nick (synopsis text))
408 (aspell-word-list language text nick)))))
410 (define-word-list-dictionary hunspell-dict-en
412 (synopsis "Hunspell dictionary for English"))
414 (define-word-list-dictionary hunspell-dict-en-au
416 (synopsis "Hunspell dictionary for Australian English"))
418 (define-word-list-dictionary hunspell-dict-en-ca
420 (synopsis "Hunspell dictionary for Canadian English"))
422 (define-word-list-dictionary hunspell-dict-en-gb
424 (synopsis "Hunspell dictionary for British English, with -ise endings"))
426 (define-word-list-dictionary hunspell-dict-en-gb-ize
428 (synopsis "Hunspell dictionary for British English, with -ize endings"))
430 (define-word-list-dictionary hunspell-dict-en-us
432 (synopsis "Hunspell dictionary for United States English"))