guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/02: gnu: Add hunspell-dict-en*.


From: Ludovic Courtès
Subject: 02/02: gnu: Add hunspell-dict-en*.
Date: Fri, 27 Oct 2017 12:33:25 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 085bcca313c3827f7c56e7c345d4606588db9085
Author: Ludovic Courtès <address@hidden>
Date:   Fri Oct 27 09:28:46 2017 -0700

    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.
---
 gnu/packages/aspell.scm | 106 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 104 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/aspell.scm b/gnu/packages/aspell.scm
index c97d322..a78e917 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"))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]