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

Contents of /eclass/vim-doc.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (show annotations) (download)
Thu Feb 3 21:12:41 2005 UTC (9 years, 2 months ago) by agriffis
Branch: MAIN
Changes since 1.5: +15 -8 lines
Don't try to make helptags with MacOS vim

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.5 2004/06/25 00:39:48 vapier 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 ECLASS=vim-doc
15 INHERITED="$INHERITED $ECLASS"
16
17 update_vim_helptags() {
18 local vimfiles vim d s
19
20 # This is where vim plugins are installed
21 vimfiles=/usr/share/vim/vimfiles
22
23 if [[ $PN != vim-core ]]; then
24 # Find a suitable vim binary for updating tags; try the graphical vims
25 # before stock vim because the system vim on macos doesn't support
26 # :helptags
27 vim=$(which gvim 2>/dev/null)
28 [[ -z "$vim" ]] && vim=$(which kvim 2>/dev/null)
29 [[ -z "$vim" ]] && vim=$(which vim 2>/dev/null)
30 if [[ -z "$vim" ]]; then
31 ewarn "No suitable vim binary to rebuild documentation tags"
32 fi
33 if use ppc-macos && [[ "$vim" == vim ]]; then
34 ewarn "Sorry, the MacOS system-installed vim can't rebuild documentation tags"
35 fi
36 fi
37
38 # Install the documentation symlinks into the versioned vim
39 # directory and run :helptags
40 for d in /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 }

  ViewVC Help
Powered by ViewVC 1.1.20