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

Contents of /eclass/vim-doc.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.16 - (hide annotations) (download)
Fri Apr 23 19:01:37 2010 UTC (4 years, 4 months ago) by darkside
Branch: MAIN
Changes since 1.15: +4 -3 lines
Add EROOT (EAPI3) support to vim-doc & vim-spell eclasses

1 vapier 1.5 # Copyright 1999-2004 Gentoo Foundation
2 agriffis 1.1 # Distributed under the terms of the GNU General Public License v2
3 darkside 1.16 # $Header: /var/cvsroot/gentoo-x86/eclass/vim-doc.eclass,v 1.15 2007/05/14 20:04:07 pioto Exp $
4 agriffis 1.1 #
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 darkside 1.16 has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}"
17 agriffis 1.1 local vimfiles vim d s
18    
19     # This is where vim plugins are installed
20 darkside 1.16 vimfiles="${EROOT}"/usr/share/vim/vimfiles
21 agriffis 1.1
22 agriffis 1.6 if [[ $PN != vim-core ]]; then
23 ciaranm 1.7 # Find a suitable vim binary for updating tags :helptags
24 pioto 1.13 vim=$(type -P vim 2>/dev/null)
25     [[ -z "$vim" ]] && vim=$(type -P gvim 2>/dev/null)
26     [[ -z "$vim" ]] && vim=$(type -P kvim 2>/dev/null)
27 agriffis 1.6 if [[ -z "$vim" ]]; then
28     ewarn "No suitable vim binary to rebuild documentation tags"
29     fi
30 agriffis 1.1 fi
31    
32 ciaranm 1.10 # Make vim not try to connect to X. See :help gui-x11-start
33     # in vim for how this evil trickery works.
34 pioto 1.14 if [[ -n "${vim}" ]] ; then
35 ciaranm 1.10 ln -s "${vim}" "${T}/tagvim"
36     vim="${T}/tagvim"
37     fi
38    
39 agriffis 1.1 # Install the documentation symlinks into the versioned vim
40     # directory and run :helptags
41 darkside 1.16 for d in "${EROOT%/}"/usr/share/vim/vim[0-9]*; do
42 agriffis 1.1 [[ -d "$d/doc" ]] || continue # catch a failed glob
43    
44     # Remove links, and possibly remove stale dirs
45     find $d/doc -name \*.txt -type l | while read s; do
46 agriffis 1.6 [[ $(readlink "$s") = $vimfiles/* ]] && rm -f "$s"
47 agriffis 1.1 done
48 agriffis 1.4 if [[ -f "$d/doc/tags" && $(find "$d" | wc -l | tr -d ' ') = 3 ]]; then
49 agriffis 1.1 # /usr/share/vim/vim61
50     # /usr/share/vim/vim61/doc
51     # /usr/share/vim/vim61/doc/tags
52     einfo "Removing $d"
53     rm -r "$d"
54     continue
55     fi
56    
57     # Re-create / install new links
58 agriffis 1.2 if [[ -d $vimfiles/doc ]]; then
59     ln -s $vimfiles/doc/*.txt $d/doc 2>/dev/null
60 agriffis 1.1 fi
61    
62     # Update tags; need a vim binary for this
63     if [[ -n "$vim" ]]; then
64     einfo "Updating documentation tags in $d"
65     DISPLAY= $vim -u NONE -U NONE -T xterm -X -n -f \
66     '+set nobackup nomore' \
67     "+helptags $d/doc" \
68     '+qa!' </dev/null &>/dev/null
69     fi
70     done
71 pioto 1.14
72 pioto 1.15 [[ -n "${vim}" && -f "${vim}" ]] && rm "${vim}"
73 agriffis 1.1 }

  ViewVC Help
Powered by ViewVC 1.1.20