diff options
author | Ludovic Courtès <ludo@gnu.org> | 2017-10-27 09:28:46 -0700 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2017-10-27 09:33:15 -0700 |
commit | 085bcca313c3827f7c56e7c345d4606588db9085 (patch) | |
tree | 283bef67a9a163d50c490266f0e3fff965318264 /gnu/packages/aspell.scm | |
parent | d3f9589842df47ecdaf558bc675d3de327ef16fa (diff) | |
download | guix-085bcca313c3827f7c56e7c345d4606588db9085.tar.gz |
gnu: Add hunspell-dict-en*.
* gnu/packages/aspell.scm (aspell-word-list): New procedure. (define-word-list-dictionary): New macro. (hunspell-dict-en, hunspell-dict-en-au, hunspell-dict-en-ca) (hunspell-dict-en-gb, hunspell-dict-en-gb-ize, hunspell-dict-en-us): New variables.
Diffstat (limited to 'gnu/packages/aspell.scm')
-rw-r--r-- | gnu/packages/aspell.scm | 106 |
1 files changed, 104 insertions, 2 deletions
diff --git a/gnu/packages/aspell.scm b/gnu/packages/aspell.scm index c97d32260b..a78e91793a 100644 --- a/gnu/packages/aspell.scm +++ b/gnu/packages/aspell.scm @@ -28,8 +28,9 @@ #:use-module (guix build-system gnu) #:use-module (guix licenses) #:use-module (gnu packages) - #:use-module (gnu packages perl) - #:use-module (gnu packages base)) + #:use-module (gnu packages base) + #:use-module (gnu packages compression) + #:use-module (gnu packages perl)) (define-public aspell (package @@ -210,3 +211,104 @@ dictionaries, including personal ones.") #:sha256 (base32 "1y09lx9zf2rnp55r16b2vgj953l3538z1vaqgflg9mdvm555bz3p"))) + + +;;; +;;; Hunspell packages made from the Aspell word lists. +;;; + +(define* (aspell-word-list language synopsis + #:optional + (nick (string-map (lambda (chr) + (if (char=? #\_ chr) + #\- + chr)) + (string-downcase language)))) + (package + (name (string-append "hunspell-dict-" nick)) + (version "2017.08.24") + (source (origin + (method url-fetch) + (uri (string-append + "http://downloads.sourceforge.net/wordlist/scowl-" + version ".tar.gz")) + (sha256 + (base32 + "1kdhydzg5z5x20ad2j1x5hbdhvy08ljkfdi2v3gbyvghbagxm15s")))) + (native-inputs + `(("tar" ,tar) + ("gzip" ,gzip) + ("perl" ,perl) + ("aspell" ,aspell))) + (build-system gnu-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (delete 'configure) + (delete 'check) + (replace 'build + (lambda _ + (substitute* "speller/make-hunspell-dict" + (("zip -9 .*$") + "return\n")) + (mkdir "speller/hunspell") + + ;; XXX: This actually builds all the dictionary variants. + (zero? (system* "make" "-C" "speller" "hunspell")))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref %outputs "out")) + (hunspell (string-append out "/share/hunspell")) + (myspell (string-append out "/share/myspell")) + (doc (string-append out "/share/doc/" + ,name))) + (mkdir-p myspell) + (install-file ,(string-append "speller/" language ".aff") + hunspell) + (symlink hunspell (string-append myspell "/dicts")) + (for-each (lambda (file) + (install-file file doc)) + (find-files "." + "^(Copyright|.*\\.(txt|org|md))$")) + #t)))))) + (synopsis synopsis) + (description + "This package provides a dictionary for the Hunspell spell-checking +library.") + (home-page "http://wordlist.aspell.net/") + (license (non-copyleft "file://Copyright" + "Word lists come from several sources, all +under permissive licensing terms. See the 'Copyright' file.")))) + +(define-syntax define-word-list-dictionary + (syntax-rules (synopsis) + ((_ name language (synopsis text)) + (define-public name + (aspell-word-list language text))) + ((_ name language nick (synopsis text)) + (define-public name + (aspell-word-list language text nick))))) + +(define-word-list-dictionary hunspell-dict-en + "en" + (synopsis "Hunspell dictionary for English")) + +(define-word-list-dictionary hunspell-dict-en-au + "en_AU" + (synopsis "Hunspell dictionary for Australian English")) + +(define-word-list-dictionary hunspell-dict-en-ca + "en_CA" + (synopsis "Hunspell dictionary for Canadian English")) + +(define-word-list-dictionary hunspell-dict-en-gb + "en_GB-ise" "en-gb" + (synopsis "Hunspell dictionary for British English, with -ise endings")) + +(define-word-list-dictionary hunspell-dict-en-gb-ize + "en_GB-ize" + (synopsis "Hunspell dictionary for British English, with -ize endings")) + +(define-word-list-dictionary hunspell-dict-en-us + "en_US" + (synopsis "Hunspell dictionary for United States English")) |