1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
4 # @ECLASS: vim-spell.eclass
6 # Vim Maintainers <vim@gentoo.org>
8 # Ciaran McCreesh <ciaranm@gentoo.org>
9 # @BLURB: Eclass for managing Vim spell files.
11 # How to make a vim spell file package using prebuilt spell lists
12 # from upstream (${CODE} is the language's two letter code):
14 # * Get the ${CODE}.*.spl, ${CODE}.*.sug (if your language has them) and
15 # README_${CODE}.txt files. Currently they're at
16 # ftp://ftp.vim.org/pub/vim/unstable/runtime/spell/ (except for English,
17 # which should be taken from CVS instead).
19 # * Stick them in vim-spell-${CODE}-$(date --iso | tr -d - ).tar.bz2 . Make sure
20 # that they're in the appropriately named subdirectory to avoid having to mess
23 # * Upload the tarball to the Gentoo mirrors.
25 # * Add your spell file to package.mask next to the other vim things. Vim
26 # Project members will handle unmasking your spell packages when vim comes out
29 # * Create the app-vim/vim-spell-${CODE} package. You should base your ebuild
30 # upon app-vim/vim-spell-en. You will need to change VIM_SPELL_LANGUAGE,
31 # KEYWORDS and LICENSE. Check the license carefully! The README will tell
34 # * Don't forget metadata.xml. You should list the Vim project and yourself
35 # as maintainers. There is no need to join the Vim project just for spell
36 # files. Here's an example of a metadata.xml file:
38 # <?xml version="1.0" encoding="UTF-8"?>
39 # <!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
41 # <maintainer type="person">
42 # <email>your@email.tld</email>
43 # <name>Your Name</name>
45 # <maintainer type="project">
46 # <email>vim@gentoo.org</email>
47 # <name>Vim Maintainers</name>
50 # <longdescription lang="en">
51 # Vim spell files for French (fr). Supported character sets are
56 # * Send an email to vim@gentoo.org to let us know.
58 # Don't forget to update your package as necessary.
60 # If there isn't an upstream-provided pregenerated spell file for your language
61 # yet, read :help spell.txt from inside vim for instructions on how to create
62 # spell files. It's best to let upstream know if you've generated spell files
63 # for another language rather than keeping them Gentoo-specific.
67 EXPORT_FUNCTIONS src_install pkg_postinst
69 SRC_URI="mirror://gentoo/${P}.tar.bz2"
72 # @ECLASS-VARIABLE: VIM_SPELL_LANGUAGE
74 # This variable defines the language for the spell package being
76 # The default value is "English".
77 : ${VIM_SPELL_LANGUAGE:="English"}
79 # @ECLASS-VARIABLE: VIM_SPELL_LOCALE
82 # This variable defines the locale for the current ebuild.
83 # The default value is ${PN} stripped of the "vim-spell-" string.
84 : ${VIM_SPELL_LOCALE:="${PN/vim-spell-/}"}
86 # @ECLASS-VARIABLE: VIM_SPELL_DIRECTORY
89 # This variable defines the path to Vim spell files.
90 : ${VIM_SPELL_DIRECTORY:="${EPREFIX}/usr/share/vim/vimfiles/spell/"}
92 # @ECLASS-VARIABLE: DESCRIPTION
94 # This variable defines the DESCRIPTION for Vim spell ebuilds.
95 : ${DESCRIPTION:="vim spell files: ${VIM_SPELL_LANGUAGE} (${VIM_SPELL_LOCALE})"}
97 # @ECLASS-VARIABLE: HOMEPAGE
99 # This variable defines the HOMEPAGE for Vim spell ebuilds.
100 : ${HOMEPAGE:="https://www.vim.org"}
102 # @FUNCTION: vim-spell_src_install
104 # This function installs Vim spell files.
105 vim-spell_src_install() {
106 dodir "${VIM_SPELL_DIRECTORY}"
107 insinto "${VIM_SPELL_DIRECTORY}"
109 local had_spell_file=
112 if [[ -f "${f}" ]]; then
119 if [[ -f "${f}" ]]; then
128 [[ -z "${had_spell_file}" ]] && die "Didn't install any spell files?"
131 # @FUNCTION: vim-spell_pkg_postinst
133 # This function displays installed Vim spell files.
134 vim-spell_pkg_postinst() {
135 has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}"
137 elog "To enable ${VIM_SPELL_LANGUAGE} spell checking, use"
138 elog " :setlocal spell spelllang=${VIM_SPELL_LOCALE}"
140 elog "The following (Vim internal, not file) encodings are supported for"
141 elog "this language:"
143 for f in "${EROOT}${VIM_SPELL_DIRECTORY}/${VIM_SPELL_LOCALE}".*.spl; do
144 enc="${f##*/${VIM_SPELL_LOCALE}.}"
146 [[ -z "${enc}" ]] && continue
150 elog "For further documentation, use:"