hunspell.scm 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2020, 2021 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. (define-module (gnu packages hunspell)
  19. #:use-module (guix build-system trivial)
  20. #:use-module (guix download)
  21. #:use-module (guix git-download)
  22. #:use-module ((guix licenses) #:prefix license:)
  23. #:use-module (guix packages)
  24. #:use-module (ice-9 match)
  25. #:use-module (gnu packages libreoffice))
  26. (define* (hunspell-dictionary dict-name full-name #:key synopsis home-page license)
  27. (package
  28. (name (string-append
  29. "hunspell-dict-"
  30. ;; Downcase and replace underscore in package names
  31. ;; to follow Guix naming conventions.
  32. (string-map (match-lambda
  33. (#\_ #\-)
  34. (chr chr))
  35. (string-downcase dict-name))))
  36. (version (package-version libreoffice))
  37. (source
  38. (origin
  39. (method git-fetch)
  40. (uri (git-reference
  41. (url (string-append "https://anongit.freedesktop.org/git/"
  42. "libreoffice/dictionaries.git/"))
  43. (commit
  44. (string-append "libreoffice-" version))))
  45. (file-name (git-file-name "libreoffice-dictionaries" version))
  46. (sha256
  47. (base32 "0h1sz8haqwpis4af1vy7jvivl4rr9g53l4l680qa7yn0691gkiv3"))))
  48. (build-system trivial-build-system)
  49. (native-inputs
  50. `(("source" ,source)))
  51. (arguments
  52. `(#:modules ((guix build utils))
  53. #:builder (begin
  54. (use-modules (guix build utils))
  55. (let* ((dictionary
  56. (string-append (assoc-ref %build-inputs "source")
  57. "/" ,dict-name
  58. "/" ,dict-name))
  59. (hunspell (string-append %output "/share/hunspell/"))
  60. (myspell (string-append %output "/share/myspell")))
  61. (for-each
  62. (lambda (ext)
  63. (install-file (string-append dictionary ext)
  64. hunspell))
  65. '(".aff" ".dic"))
  66. (symlink hunspell myspell)
  67. #t))))
  68. (synopsis synopsis)
  69. (description "This package provides a dictionary for the Hunspell
  70. spell-checking library.")
  71. (license license)
  72. (home-page home-page)))
  73. (define-public hunspell-dict-it-it
  74. (let ((synopsis identity))
  75. (hunspell-dictionary "it_IT" "Italian"
  76. #:synopsis (synopsis "Hunspell dictionary for Italian")
  77. #:home-page "https://www.libreitalia.org/"
  78. #:license license:gpl3)))