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

Diff of /eclass/vim-doc.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.1 Revision 1.1.1.1
1# Copyright 1999-2003 Gentoo Technologies, Inc. 1# Copyright 1999-2004 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-doc.eclass,v 1.1 2003/07/30 18:47:06 agriffis Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/vim-doc.eclass,v 1.1.1.1 2005/11/30 09:59:24 chriswhite Exp $
4# 4#
5# This eclass is used by vim.eclass and vim-plugin.eclass to update 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 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 7# /usr/share/vim/vimfiles/doc for documentation; it only uses the
8# versioned directory, for example /usr/share/vim/vim62/doc 8# versioned directory, for example /usr/share/vim/vim62/doc
9# 9#
10# We depend on vim being installed, which is satisfied by either the 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 11# DEPEND in vim-plugin or by whatever version of vim is being
12# installed by the eclass. 12# installed by the eclass.
13 13
14ECLASS=vim-doc
15INHERITED="$INHERITED $ECLASS"
16 14
17update_vim_helptags() { 15update_vim_helptags() {
18 local vimfiles vim d s 16 local vimfiles vim d s
19 17
20 # This is where vim plugins are installed 18 # This is where vim plugins are installed
21 vimfiles=/usr/share/vim/vimfiles 19 vimfiles=/usr/share/vim/vimfiles
22 20
23 # Find a suitable vim binary 21 if [[ $PN != vim-core ]]; then
22 # Find a suitable vim binary for updating tags :helptags
23 if use ppc-macos ; then
24 vim=$(which gvim 2>/dev/null )
25 else
24 local vim=`which vim 2>/dev/null` 26 vim=$(which vim 2>/dev/null)
25 [[ -z "$vim" ]] && vim=`which gvim 2>/dev/null` 27 [[ -z "$vim" ]] && vim=$(which gvim 2>/dev/null)
26 [[ -z "$vim" ]] && vim=`which kvim 2>/dev/null` 28 [[ -z "$vim" ]] && vim=$(which kvim 2>/dev/null)
29 fi
27 if [[ -z "$vim" ]]; then 30 if [[ -z "$vim" ]]; then
28 ewarn "No suitable vim binary to rebuild documentation tags" 31 ewarn "No suitable vim binary to rebuild documentation tags"
32 fi
29 fi 33 fi
30 34
31 # Install the documentation symlinks into the versioned vim 35 # Install the documentation symlinks into the versioned vim
32 # directory and run :helptags 36 # directory and run :helptags
33 for d in /usr/share/vim/vim[0-9]*; do 37 for d in /usr/share/vim/vim[0-9]*; do
34 [[ -d "$d/doc" ]] || continue # catch a failed glob 38 [[ -d "$d/doc" ]] || continue # catch a failed glob
35 39
36 # Remove links, and possibly remove stale dirs 40 # Remove links, and possibly remove stale dirs
37 find $d/doc -name \*.txt -type l | while read s; do 41 find $d/doc -name \*.txt -type l | while read s; do
38 [[ `readlink "$s"` = ${vimfiles}/* ]] && rm -f "$s" 42 [[ $(readlink "$s") = $vimfiles/* ]] && rm -f "$s"
39 done 43 done
40 if [[ -f "$d/doc/tags" && 44 if [[ -f "$d/doc/tags" && $(find "$d" | wc -l | tr -d ' ') = 3 ]]; then
41 $(find "$d" | wc -l | awk '{print $1}') = 3 ]]; then
42 # /usr/share/vim/vim61 45 # /usr/share/vim/vim61
43 # /usr/share/vim/vim61/doc 46 # /usr/share/vim/vim61/doc
44 # /usr/share/vim/vim61/doc/tags 47 # /usr/share/vim/vim61/doc/tags
45 einfo "Removing $d" 48 einfo "Removing $d"
46 rm -r "$d" 49 rm -r "$d"
47 continue 50 continue
48 fi 51 fi
49 52
50 # Re-create / install new links 53 # Re-create / install new links
51 if [[ -d ${vimfiles}/doc ]]; then 54 if [[ -d $vimfiles/doc ]]; then
52 ln -s ${vimfiles}/doc/*.txt $d/doc 2>/dev/null 55 ln -s $vimfiles/doc/*.txt $d/doc 2>/dev/null
53 fi 56 fi
54 57
55 # Update tags; need a vim binary for this 58 # Update tags; need a vim binary for this
56 if [[ -n "$vim" ]]; then 59 if [[ -n "$vim" ]]; then
57 einfo "Updating documentation tags in $d" 60 einfo "Updating documentation tags in $d"

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.1.1

  ViewVC Help
Powered by ViewVC 1.1.20