vim-spell.eclass 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. # Copyright 1999-2011 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. #
  4. # Original Author: Ciaran McCreesh <ciaranm@gentoo.org>
  5. # Maintainers: Vim Herd <vim@gentoo.org>
  6. # Purpose: Simplify installing spell files for vim7
  7. #
  8. # How to make a vim spell file package using prebuilt spell lists
  9. # from upstream (${CODE} is the language's two letter code):
  10. #
  11. # * Get the ${CODE}.*.spl, ${CODE}.*.sug (if your language has them) and
  12. # README_${CODE}.txt files. Currently they're at
  13. # ftp://ftp.vim.org/pub/vim/unstable/runtime/spell/ (except for English,
  14. # which should be taken from CVS instead).
  15. #
  16. # * Stick them in vim-spell-${CODE}-$(date --iso | tr -d - ).tar.bz2 . Make sure
  17. # that they're in the appropriately named subdirectory to avoid having to mess
  18. # with S=.
  19. #
  20. # * Upload the tarball to the Gentoo mirrors.
  21. #
  22. # * (for now) Add your spell file to package.mask next to the other vim7
  23. # things. The vim herd will handle unmasking your spell packages when vim7
  24. # comes out of package.mask.
  25. #
  26. # * Create the app-vim/vim-spell-${CODE} package. You should base your ebuild
  27. # upon app-vim/vim-spell-en. You will need to change VIM_SPELL_LANGUAGE,
  28. # KEYWORDS and LICENSE. Check the license carefully! The README will tell
  29. # you what it is.
  30. #
  31. # * Don't forget metadata.xml. You should list vim as the herd, and yourself
  32. # as the maintainer (there is no need to join the vim herd just for spell
  33. # files):
  34. #
  35. # <?xml version="1.0" encoding="UTF-8"?>
  36. # <!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
  37. # <pkgmetadata>
  38. # <herd>vim</herd>
  39. # <maintainer>
  40. # <email>your-name@gentoo.org</email>
  41. # </maintainer>
  42. # <longdescription lang="en">
  43. # Vim spell files for French (fr). Supported character sets are
  44. # UTF-8 and latin1.
  45. # </longdescription>
  46. # </pkgmetadata>
  47. #
  48. # * Send an email to vim@gentoo.org to let us know.
  49. #
  50. # Don't forget to update your package as necessary.
  51. #
  52. # If there isn't an upstream-provided pregenerated spell file for your language
  53. # yet, read :help spell.txt from inside vim7 for instructions on how to create
  54. # spell files. It's best to let upstream know if you've generated spell files
  55. # for another language rather than keeping them Gentoo-specific.
  56. inherit eutils
  57. EXPORT_FUNCTIONS src_install pkg_postinst
  58. IUSE=""
  59. DEPEND="|| ( >=app-editors/vim-7_alpha
  60. >=app-editors/gvim-7_alpha )"
  61. RDEPEND="${DEPEND}"
  62. SRC_URI="mirror://gentoo/${P}.tar.bz2"
  63. SLOT="0"
  64. if [[ -z "${VIM_SPELL_CODE}" ]] ; then
  65. VIM_SPELL_CODE="${PN/vim-spell-/}"
  66. fi
  67. DESCRIPTION="vim spell files: ${VIM_SPELL_LANGUAGE} (${VIM_SPELL_CODE})"
  68. if [[ -z "${HOMEPAGE}" ]] ; then
  69. HOMEPAGE="http://www.vim.org/"
  70. fi
  71. vim-spell_src_install() {
  72. target="/usr/share/vim/vimfiles/spell/"
  73. dodir "${target}"
  74. insinto "${target}"
  75. had_spell_file=
  76. for f in *.spl ; do
  77. if [[ -f "${f}" ]]; then
  78. doins "${f}"
  79. had_spell_file="yes"
  80. fi
  81. done
  82. for f in *.sug ; do
  83. if [[ -f "${f}" ]]; then
  84. doins "${f}"
  85. fi
  86. done
  87. for f in README* ; do
  88. dodoc "${f}"
  89. done
  90. [[ -z "${had_spell_file}" ]] && die "Didn't install any spell files?"
  91. }
  92. vim-spell_pkg_postinst() {
  93. has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}"
  94. target="/usr/share/vim/vimfiles/spell/"
  95. echo
  96. elog "To enable ${VIM_SPELL_LANGUAGE} spell checking, use"
  97. elog " :setlocal spell spelllang=${VIM_SPELL_CODE}"
  98. echo
  99. elog "The following (Vim internal, not file) encodings are supported for"
  100. elog "this language:"
  101. for f in "${EROOT}/${target}/${VIM_SPELL_CODE}".*.spl ; do
  102. enc="${f##*/${VIM_SPELL_CODE}.}"
  103. enc="${enc%.spl}"
  104. [[ -z "${enc}" ]] && continue
  105. elog " ${enc}"
  106. done
  107. echo
  108. elog "For further documentation, use:"
  109. elog " :help spell"
  110. echo
  111. }