/[gentoo-x86]/eclass/vim-doc.eclass
Gentoo

Contents of /eclass/vim-doc.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.15 - (show annotations) (download)
Mon May 14 20:04:07 2007 UTC (7 years, 4 months ago) by pioto
Branch: MAIN
Changes since 1.14: +2 -2 lines
Fix the fix a bit.

1 # Copyright 1999-2004 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/vim-doc.eclass,v 1.14 2007/05/14 19:52:06 pioto Exp $
4 #
5 # This eclass is used by vim.eclass and vim-plugin.eclass to update
6 # the documentation tags. This is necessary since vim doesn't look in
7 # /usr/share/vim/vimfiles/doc for documentation; it only uses the
8 # versioned directory, for example /usr/share/vim/vim62/doc
9 #
10 # We depend on vim being installed, which is satisfied by either the
11 # DEPEND in vim-plugin or by whatever version of vim is being
12 # installed by the eclass.
13
14
15 update_vim_helptags() {
16 local vimfiles vim d s
17
18 # This is where vim plugins are installed
19 vimfiles="${ROOT}"/usr/share/vim/vimfiles
20
21 if [[ $PN != vim-core ]]; then
22 # Find a suitable vim binary for updating tags :helptags
23 vim=$(type -P vim 2>/dev/null)
24 [[ -z "$vim" ]] && vim=$(type -P gvim 2>/dev/null)
25 [[ -z "$vim" ]] && vim=$(type -P kvim 2>/dev/null)
26 if [[ -z "$vim" ]]; then
27 ewarn "No suitable vim binary to rebuild documentation tags"
28 fi
29 fi
30
31 # Make vim not try to connect to X. See :help gui-x11-start
32 # in vim for how this evil trickery works.
33 if [[ -n "${vim}" ]] ; then
34 ln -s "${vim}" "${T}/tagvim"
35 vim="${T}/tagvim"
36 fi
37
38 # Install the documentation symlinks into the versioned vim
39 # directory and run :helptags
40 for d in "${ROOT}"/usr/share/vim/vim[0-9]*; do
41 [[ -d "$d/doc" ]] || continue # catch a failed glob
42
43 # Remove links, and possibly remove stale dirs
44 find $d/doc -name \*.txt -type l | while read s; do
45 [[ $(readlink "$s") = $vimfiles/* ]] && rm -f "$s"
46 done
47 if [[ -f "$d/doc/tags" && $(find "$d" | wc -l | tr -d ' ') = 3 ]]; then
48 # /usr/share/vim/vim61
49 # /usr/share/vim/vim61/doc
50 # /usr/share/vim/vim61/doc/tags
51 einfo "Removing $d"
52 rm -r "$d"
53 continue
54 fi
55
56 # Re-create / install new links
57 if [[ -d $vimfiles/doc ]]; then
58 ln -s $vimfiles/doc/*.txt $d/doc 2>/dev/null
59 fi
60
61 # Update tags; need a vim binary for this
62 if [[ -n "$vim" ]]; then
63 einfo "Updating documentation tags in $d"
64 DISPLAY= $vim -u NONE -U NONE -T xterm -X -n -f \
65 '+set nobackup nomore' \
66 "+helptags $d/doc" \
67 '+qa!' </dev/null &>/dev/null
68 fi
69 done
70
71 [[ -n "${vim}" && -f "${vim}" ]] && rm "${vim}"
72 }

  ViewVC Help
Powered by ViewVC 1.1.20