summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorAron Griffis <agriffis@gentoo.org>2003-07-30 18:47:06 +0000
committerAron Griffis <agriffis@gentoo.org>2003-07-30 18:47:06 +0000
commit7c02dc07fa2fdf2712124b135174792ab2d24fcb (patch)
tree77686987a289b8149af304cf140369613d3e2590 /eclass
parentBug 22671 - vapier found the fix - should work again (diff)
downloadgentoo-2-7c02dc07fa2fdf2712124b135174792ab2d24fcb.tar.gz
gentoo-2-7c02dc07fa2fdf2712124b135174792ab2d24fcb.tar.bz2
gentoo-2-7c02dc07fa2fdf2712124b135174792ab2d24fcb.zip
add vim-doc and vim-plugin eclasses in prep for app-vim category
Diffstat (limited to 'eclass')
-rw-r--r--eclass/vim-doc.eclass64
-rw-r--r--eclass/vim-plugin.eclass33
-rw-r--r--eclass/vim.eclass14
3 files changed, 108 insertions, 3 deletions
diff --git a/eclass/vim-doc.eclass b/eclass/vim-doc.eclass
new file mode 100644
index 000000000000..74662ecc1cd0
--- /dev/null
+++ b/eclass/vim-doc.eclass
@@ -0,0 +1,64 @@
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/eclass/vim-doc.eclass,v 1.1 2003/07/30 18:47:06 agriffis Exp $
+#
+# This eclass is used by vim.eclass and vim-plugin.eclass to update
+# the documentation tags. This is necessary since vim doesn't look in
+# /usr/share/vim/vimfiles/doc for documentation; it only uses the
+# versioned directory, for example /usr/share/vim/vim62/doc
+#
+# We depend on vim being installed, which is satisfied by either the
+# DEPEND in vim-plugin or by whatever version of vim is being
+# installed by the eclass.
+
+ECLASS=vim-doc
+INHERITED="$INHERITED $ECLASS"
+
+update_vim_helptags() {
+ local vimfiles vim d s
+
+ # This is where vim plugins are installed
+ vimfiles=/usr/share/vim/vimfiles
+
+ # Find a suitable vim binary
+ local vim=`which vim 2>/dev/null`
+ [[ -z "$vim" ]] && vim=`which gvim 2>/dev/null`
+ [[ -z "$vim" ]] && vim=`which kvim 2>/dev/null`
+ if [[ -z "$vim" ]]; then
+ ewarn "No suitable vim binary to rebuild documentation tags"
+ fi
+
+ # Install the documentation symlinks into the versioned vim
+ # directory and run :helptags
+ for d in /usr/share/vim/vim[0-9]*; do
+ [[ -d "$d/doc" ]] || continue # catch a failed glob
+
+ # Remove links, and possibly remove stale dirs
+ find $d/doc -name \*.txt -type l | while read s; do
+ [[ `readlink "$s"` = ${vimfiles}/* ]] && rm -f "$s"
+ done
+ if [[ -f "$d/doc/tags" &&
+ $(find "$d" | wc -l | awk '{print $1}') = 3 ]]; then
+ # /usr/share/vim/vim61
+ # /usr/share/vim/vim61/doc
+ # /usr/share/vim/vim61/doc/tags
+ einfo "Removing $d"
+ rm -r "$d"
+ continue
+ fi
+
+ # Re-create / install new links
+ if [[ -d ${vimfiles}/doc ]]; then
+ ln -s ${vimfiles}/doc/*.txt $d/doc 2>/dev/null
+ fi
+
+ # Update tags; need a vim binary for this
+ if [[ -n "$vim" ]]; then
+ einfo "Updating documentation tags in $d"
+ DISPLAY= $vim -u NONE -U NONE -T xterm -X -n -f \
+ '+set nobackup nomore' \
+ "+helptags $d/doc" \
+ '+qa!' </dev/null &>/dev/null
+ fi
+ done
+}
diff --git a/eclass/vim-plugin.eclass b/eclass/vim-plugin.eclass
new file mode 100644
index 000000000000..8951ed41f7aa
--- /dev/null
+++ b/eclass/vim-plugin.eclass
@@ -0,0 +1,33 @@
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/eclass/vim-plugin.eclass,v 1.1 2003/07/30 18:47:06 agriffis Exp $
+#
+# This eclass simplifies installation of app-vim plugins into
+# /usr/share/vim/vimfiles. This is a version-independent directory
+# which is read automatically by vim. The only exception is
+# documentation, for which we make a special case via vim-doc.eclass
+
+inherit vim-doc
+ECLASS=vim-plugin
+INHERITED="$INHERITED $ECLASS"
+
+IUSE=""
+DEPEND="|| ( >=app-editors/vim-6.2 >=app-editors/gvim-6.2 )"
+RDEPEND="${DEPEND}"
+SRC_URI="mirror://gentoo/${P}.tar.bz2"
+SLOT="0"
+
+src_install() {
+ cd ${WORKDIR}
+ chmod -R a+rX ${S}
+ dodir /usr/share/vim
+ mv ${S} ${D}/usr/share/vim/vimfiles
+}
+
+pkg_postinst() {
+ update_vim_helptags
+}
+
+pkg_postrm() {
+ update_vim_helptags
+}
diff --git a/eclass/vim.eclass b/eclass/vim.eclass
index 638b659e269e..c60745b1a071 100644
--- a/eclass/vim.eclass
+++ b/eclass/vim.eclass
@@ -1,17 +1,17 @@
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/vim.eclass,v 1.34 2003/07/30 03:03:27 agriffis Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/vim.eclass,v 1.35 2003/07/30 18:47:06 agriffis Exp $
# Authors:
# Ryan Phillips <rphillips@gentoo.org>
# Seemant Kulleen <seemant@gentoo.org>
# Aron Griffis <agriffis@gentoo.org>
+inherit eutils vim-doc
ECLASS=vim
+INHERITED="$INHERITED $ECLASS"
EXPORT_FUNCTIONS src_unpack
-inherit eutils
-
IUSE="$IUSE ncurses nls"
if [ ${PN} != vim-core ]; then
IUSE="$IUSE cscope gpm perl python ruby"
@@ -263,6 +263,9 @@ src_install() {
}
pkg_postinst() {
+ # Update documentation tags (from vim-doc.eclass)
+ update_vim_helptags
+
einfo
if [ ${PN} = gvim ]; then
einfo "To enable UTF-8 viewing, set guifont and guifontwide: "
@@ -293,3 +296,8 @@ pkg_postinst() {
[ -f /usr/bin/gvim ] && ln -s gvim /usr/bin/vim 2>/dev/null
[ -f /usr/bin/vim ] && ln -s vim /usr/bin/vi 2>/dev/null
}
+
+pkg_postrm() {
+ # Update documentation tags (from vim-doc.eclass)
+ update_vim_helptags
+}