gnu: emacs-svg-icon: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / hunspell.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (gnu packages hunspell)
20 #:use-module (guix build-system trivial)
21 #:use-module (guix download)
22 #:use-module (guix git-download)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (guix packages)
25 #:use-module (ice-9 match)
26 #:use-module (gnu packages libreoffice))
27
28 (define* (hunspell-dictionary dict-name full-name #:key synopsis home-page license)
29 (package
30 (name (string-append
31 "hunspell-dict-"
32 ;; Downcase and replace underscore in package names
33 ;; to follow Guix naming conventions.
34 (string-map (match-lambda
35 (#\_ #\-)
36 (chr chr))
37 (string-downcase dict-name))))
38 (version (package-version libreoffice))
39 (source
40 (origin
41 (method git-fetch)
42 (uri (git-reference
43 (url (string-append "https://anongit.freedesktop.org/git/"
44 "libreoffice/dictionaries.git/"))
45 (commit
46 (string-append "libreoffice-" version))))
47 (file-name (git-file-name "libreoffice-dictionaries" version))
48 (sha256
49 (base32 "0vvxnjpm1322ahf9q8bqs1yhkn7krglw8c6yazcf7a3jljykd9k9"))))
50 (build-system trivial-build-system)
51 (native-inputs
52 `(("source" ,source)))
53 (arguments
54 `(#:modules ((guix build utils))
55 #:builder (begin
56 (use-modules (guix build utils))
57 (let* ((dictionary
58 (string-append (assoc-ref %build-inputs "source")
59 "/" ,dict-name
60 "/" ,dict-name))
61 (hunspell (string-append %output "/share/hunspell/"))
62 (myspell (string-append %output "/share/myspell")))
63 (for-each
64 (lambda (ext)
65 (install-file (string-append dictionary ext)
66 hunspell))
67 '(".aff" ".dic"))
68 (symlink hunspell myspell)
69 #t))))
70 (synopsis synopsis)
71 (description "This package provides a dictionary for the Hunspell
72 spell-checking library.")
73 (license license)
74 (home-page home-page)))
75
76 (define-public hunspell-dict-it-it
77 (let ((synopsis identity))
78 (hunspell-dictionary "it_IT" "Italian"
79 #:synopsis (synopsis "Hunspell dictionary for Italian")
80 #:home-page "https://www.libreitalia.org/"
81 #:license license:gpl3)))