guix-devel
[Top][All Lists]
Advanced

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

Hunspell dictionaries


From: paul
Subject: Hunspell dictionaries
Date: Sat, 31 Oct 2020 21:03:30 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Icedove/78.3.3

Dear Guixers,

I was packaging an Italian dictionary for Hunspell, when I found this link listing all the Hunspell dictionaries supported by Libreoffice [0].

This lead me to think about a function for defining dictionary packages (very much based on aspell-dictionary from (gnu packages aspell)).


(define* (hunspell-dictionary dict-name full-name #:key home-page license)
  (package
    (name (string-append
           "hunspell-dict-"
           ;; Downcase and replace underscore in package names
           ;; to follow Guix naming conventions.
           (string-map (match-lambda
                         (#\_ #\-)
                         (chr chr))
                       (string-downcase dict-name))))
    (version (package-version libreoffice))
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url (string-append "https://anongit.freedesktop.org/git/"
                                 "libreoffice/dictionaries.git/"))
            (commit
              (string-append "libreoffice-" version))))
       (file-name (git-file-name "libreoffice-dictionaries" version))
      (sha256
        (base32 "0vvxnjpm1322ahf9q8bqs1yhkn7krglw8c6yazcf7a3jljykd9k9"))))
    (build-system gnu-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (delete 'configure)
         (delete 'build)
         (replace 'install              ;no install target
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (hunspell (string-append out "/share/hunspell/"))
                    (myspell (string-append out "/share/myspell")))
               (for-each
                (lambda (ext)
                  (install-file (string-append ,dict-name "/" ,dict-name ext)
                                hunspell))
                '(".aff" ".dic"))
               (symlink hunspell myspell)
               #t))))
       #:tests? #f))                    ; no tests
    (synopsis
     (string-append "Hunspell dictionary for " full-name " (" dict-name ")"))
    (description "This package provides a dictionary for the Hunspell
spell-checking library.")
    (license license)
    (home-page home-page)))


Do you think it would be worth to add it to (gnu packages libreoffice) to define dictionaries?

Cheers,

Giacomo


[0]: https://cgit.freedesktop.org/libreoffice/dictionaries


reply via email to

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