| 1 | # Copyright 1999-2005 Gentoo Foundation |
1 | # Copyright 1999-2011 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/vim-spell.eclass,v 1.2 2005/09/28 19:13:13 ciaranm Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/vim-spell.eclass,v 1.9 2011/12/27 17:55:12 fauli Exp $ |
| 4 | |
4 | |
| 5 | # |
5 | # |
| 6 | # Original Author: Ciaran McCreesh <ciaranm@gentoo.org> |
6 | # Original Author: Ciaran McCreesh <ciaranm@gentoo.org> |
| 7 | # Maintainers: Vim Herd <vim@gentoo.org> |
7 | # Maintainers: Vim Herd <vim@gentoo.org> |
| 8 | # Purpose: Simplify installing spell files for vim7 |
8 | # Purpose: Simplify installing spell files for vim7 |
| 9 | # |
9 | # |
| 10 | |
10 | |
| 11 | # How to make a vim spell file package using prebuilt spell lists |
11 | # How to make a vim spell file package using prebuilt spell lists |
| 12 | # from upstream (${CODE} is the language's two letter code): |
12 | # from upstream (${CODE} is the language's two letter code): |
| 13 | # |
13 | # |
| 14 | # * Get the ${CODE}.*.spl and README_${CODE}.txt files. Currently they're |
14 | # * Get the ${CODE}.*.spl, ${CODE}.*.sug (if your language has them) and |
|
|
15 | # README_${CODE}.txt files. Currently they're at |
| 15 | # at ftp://ftp.vim.org/pub/vim/unstable/runtime/spell/ . |
16 | # ftp://ftp.vim.org/pub/vim/unstable/runtime/spell/ (except for English, |
|
|
17 | # which should be taken from CVS instead). |
| 16 | # |
18 | # |
| 17 | # * Stick them in vim-spell-${CODE}-$(date --iso | tr -d - ).tar.bz2 . Make sure |
19 | # * Stick them in vim-spell-${CODE}-$(date --iso | tr -d - ).tar.bz2 . Make sure |
| 18 | # that they're in the appropriately named subdirectory to avoid having to mess |
20 | # that they're in the appropriately named subdirectory to avoid having to mess |
| 19 | # with S=. |
21 | # with S=. |
| 20 | # |
22 | # |
| … | |
… | |
| 53 | # If there isn't an upstream-provided pregenerated spell file for your language |
55 | # If there isn't an upstream-provided pregenerated spell file for your language |
| 54 | # yet, read :help spell.txt from inside vim7 for instructions on how to create |
56 | # yet, read :help spell.txt from inside vim7 for instructions on how to create |
| 55 | # spell files. It's best to let upstream know if you've generated spell files |
57 | # spell files. It's best to let upstream know if you've generated spell files |
| 56 | # for another language rather than keeping them Gentoo-specific. |
58 | # for another language rather than keeping them Gentoo-specific. |
| 57 | |
59 | |
|
|
60 | inherit eutils |
|
|
61 | |
| 58 | EXPORT_FUNCTIONS src_install |
62 | EXPORT_FUNCTIONS src_install pkg_postinst |
| 59 | |
63 | |
| 60 | IUSE="" |
64 | IUSE="" |
| 61 | DEPEND="|| ( >=app-editors/vim-7_alpha |
65 | DEPEND="|| ( >=app-editors/vim-7_alpha |
| 62 | >=app-editors/gvim-7_alpha )" |
66 | >=app-editors/gvim-7_alpha )" |
| 63 | RDEPEND="${DEPEND}" |
67 | RDEPEND="${DEPEND}" |
| … | |
… | |
| 66 | |
70 | |
| 67 | if [[ -z "${VIM_SPELL_CODE}" ]] ; then |
71 | if [[ -z "${VIM_SPELL_CODE}" ]] ; then |
| 68 | VIM_SPELL_CODE="${PN/vim-spell-/}" |
72 | VIM_SPELL_CODE="${PN/vim-spell-/}" |
| 69 | fi |
73 | fi |
| 70 | |
74 | |
| 71 | if [[ -z "${DESCRIPTION}" ]] ; then |
|
|
| 72 | DESCRIPTION="vim spell files: ${VIM_SPELL_LANGUAGE} (${VIM_SPELL_CODE})" |
75 | DESCRIPTION="vim spell files: ${VIM_SPELL_LANGUAGE} (${VIM_SPELL_CODE})" |
| 73 | fi |
|
|
| 74 | |
76 | |
| 75 | if [[ -z "${HOMEPAGE}" ]] ; then |
77 | if [[ -z "${HOMEPAGE}" ]] ; then |
| 76 | HOMEPAGE="http://www.vim.org/" |
78 | HOMEPAGE="http://www.vim.org/" |
| 77 | fi |
79 | fi |
| 78 | |
80 | |
| … | |
… | |
| 81 | dodir "${target}" |
83 | dodir "${target}" |
| 82 | insinto "${target}" |
84 | insinto "${target}" |
| 83 | |
85 | |
| 84 | had_spell_file= |
86 | had_spell_file= |
| 85 | for f in *.spl ; do |
87 | for f in *.spl ; do |
|
|
88 | if [[ -f "${f}" ]]; then |
| 86 | doins "${f}" |
89 | doins "${f}" |
| 87 | had_spell_file="yes" |
90 | had_spell_file="yes" |
|
|
91 | fi |
|
|
92 | done |
|
|
93 | |
|
|
94 | for f in *.sug ; do |
|
|
95 | if [[ -f "${f}" ]]; then |
|
|
96 | doins "${f}" |
|
|
97 | fi |
| 88 | done |
98 | done |
| 89 | |
99 | |
| 90 | for f in README* ; do |
100 | for f in README* ; do |
| 91 | dodoc "${f}" |
101 | dodoc "${f}" |
| 92 | done |
102 | done |
| 93 | |
103 | |
| 94 | [[ -z "${had_spell_file}" ]] && die "Didn't install any spell files?" |
104 | [[ -z "${had_spell_file}" ]] && die "Didn't install any spell files?" |
| 95 | } |
105 | } |
| 96 | |
106 | |
|
|
107 | vim-spell_pkg_postinst() { |
|
|
108 | has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}" |
|
|
109 | target="/usr/share/vim/vimfiles/spell/" |
|
|
110 | echo |
|
|
111 | elog "To enable ${VIM_SPELL_LANGUAGE} spell checking, use" |
|
|
112 | elog " :setlocal spell spelllang=${VIM_SPELL_CODE}" |
|
|
113 | echo |
|
|
114 | elog "The following (Vim internal, not file) encodings are supported for" |
|
|
115 | elog "this language:" |
|
|
116 | for f in "${EROOT}/${target}/${VIM_SPELL_CODE}".*.spl ; do |
|
|
117 | enc="${f##*/${VIM_SPELL_CODE}.}" |
|
|
118 | enc="${enc%.spl}" |
|
|
119 | [[ -z "${enc}" ]] && continue |
|
|
120 | elog " ${enc}" |
|
|
121 | done |
|
|
122 | echo |
|
|
123 | elog "For further documentation, use:" |
|
|
124 | elog " :help spell" |
|
|
125 | echo |
|
|
126 | epause |
|
|
127 | } |