From c8e16ac6adb4e4ef1ef017c4a10f56357b056045 Mon Sep 17 00:00:00 2001 From: Matt Tennant Date: Fri, 23 Sep 2011 16:33:53 -0700 Subject: [PATCH] Upgrade the vim and vim-core packages Upgraded app-editors/vim to version 7.3.189 on amd64, arm, x86 Upgraded app-editors/vim-core to version 7.3.189 on amd64, arm, x86 BUG=chromium-os:20788 TEST=Run vim in chroot, edit python file, looks ok to me. Change-Id: Ifc3234a261e407d316002fc6945b314c7697341c Reviewed-on: http://gerrit.chromium.org/gerrit/8245 Reviewed-by: Mike Frysinger Commit-Ready: Matt Tennant Reviewed-by: Matt Tennant Tested-by: Matt Tennant --- .../app-editors/vim-core/files/vimrc-r4 | 200 +++++ .../app-editors/vim-core/files/xxd-completion | 25 + .../vim-core/vim-core-7.3.189.ebuild | 20 + .../files/vim-7.1.285-darwin-x11link.patch | 11 + .../vim/files/vim-7.3-interix-link.patch | 12 + .../app-editors/vim/files/vim-completion | 36 + .../app-editors/vim/files/vimrc | 93 ++ .../app-editors/vim/vim-7.3.189.ebuild | 26 + .../portage-stable/eclass/vim.eclass | 799 ++++++++++++++++++ 9 files changed, 1222 insertions(+) create mode 100644 sdk_container/src/third_party/portage-stable/app-editors/vim-core/files/vimrc-r4 create mode 100644 sdk_container/src/third_party/portage-stable/app-editors/vim-core/files/xxd-completion create mode 100644 sdk_container/src/third_party/portage-stable/app-editors/vim-core/vim-core-7.3.189.ebuild create mode 100644 sdk_container/src/third_party/portage-stable/app-editors/vim/files/vim-7.1.285-darwin-x11link.patch create mode 100644 sdk_container/src/third_party/portage-stable/app-editors/vim/files/vim-7.3-interix-link.patch create mode 100644 sdk_container/src/third_party/portage-stable/app-editors/vim/files/vim-completion create mode 100644 sdk_container/src/third_party/portage-stable/app-editors/vim/files/vimrc create mode 100644 sdk_container/src/third_party/portage-stable/app-editors/vim/vim-7.3.189.ebuild create mode 100644 sdk_container/src/third_party/portage-stable/eclass/vim.eclass diff --git a/sdk_container/src/third_party/portage-stable/app-editors/vim-core/files/vimrc-r4 b/sdk_container/src/third_party/portage-stable/app-editors/vim-core/files/vimrc-r4 new file mode 100644 index 0000000000..f54e5a39f9 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/app-editors/vim-core/files/vimrc-r4 @@ -0,0 +1,200 @@ +scriptencoding utf-8 +" ^^ Please leave the above line at the start of the file. + +" Default configuration file for Vim +" $Header: /var/cvsroot/gentoo-x86/app-editors/vim-core/files/vimrc-r4,v 1.3 2010/04/15 19:30:32 darkside Exp $ + +" Written by Aron Griffis +" Modified by Ryan Phillips +" Modified some more by Ciaran McCreesh +" Added Redhat's vimrc info by Seemant Kulleen + +" You can override any of these settings on a global basis via the +" "/etc/vim/vimrc.local" file, and on a per-user basis via "~/.vimrc". You may +" need to create these. + +" {{{ General settings +" The following are some sensible defaults for Vim for most users. +" We attempt to change as little as possible from Vim's defaults, +" deviating only where it makes sense +set nocompatible " Use Vim defaults (much better!) +set bs=2 " Allow backspacing over everything in insert mode +set ai " Always set auto-indenting on +set history=50 " keep 50 lines of command history +set ruler " Show the cursor position all the time + +set viminfo='20,\"500 " Keep a .viminfo file. + +" Don't use Ex mode, use Q for formatting +map Q gq + +" When doing tab completion, give the following files lower priority. You may +" wish to set 'wildignore' to completely ignore files, and 'wildmenu' to enable +" enhanced tab completion. These can be done in the user vimrc file. +set suffixes+=.info,.aux,.log,.dvi,.bbl,.out,.o,.lo + +" When displaying line numbers, don't use an annoyingly wide number column. This +" doesn't enable line numbers -- :set number will do that. The value given is a +" minimum width to use for the number column, not a fixed size. +if v:version >= 700 + set numberwidth=3 +endif +" }}} + +" {{{ Modeline settings +" We don't allow modelines by default. See bug #14088 and bug #73715. +" If you're not concerned about these, you can enable them on a per-user +" basis by adding "set modeline" to your ~/.vimrc file. +set nomodeline +" }}} + +" {{{ Locale settings +" Try to come up with some nice sane GUI fonts. Also try to set a sensible +" value for fileencodings based upon locale. These can all be overridden in +" the user vimrc file. +if v:lang =~? "^ko" + set fileencodings=euc-kr + set guifontset=-*-*-medium-r-normal--16-*-*-*-*-*-*-* +elseif v:lang =~? "^ja_JP" + set fileencodings=euc-jp + set guifontset=-misc-fixed-medium-r-normal--14-*-*-*-*-*-*-* +elseif v:lang =~? "^zh_TW" + set fileencodings=big5 + set guifontset=-sony-fixed-medium-r-normal--16-150-75-75-c-80-iso8859-1,-taipei-fixed-medium-r-normal--16-150-75-75-c-160-big5-0 +elseif v:lang =~? "^zh_CN" + set fileencodings=gb2312 + set guifontset=*-r-* +endif + +" If we have a BOM, always honour that rather than trying to guess. +if &fileencodings !~? "ucs-bom" + set fileencodings^=ucs-bom +endif + +" Always check for UTF-8 when trying to determine encodings. +if &fileencodings !~? "utf-8" + " If we have to add this, the default encoding is not Unicode. + " We use this fact later to revert to the default encoding in plaintext/empty + " files. + let g:added_fenc_utf8 = 1 + set fileencodings+=utf-8 +endif + +" Make sure we have a sane fallback for encoding detection +if &fileencodings !~? "default" + set fileencodings+=default +endif +" }}} + +" {{{ Syntax highlighting settings +" Switch syntax highlighting on, when the terminal has colors +" Also switch on highlighting the last used search pattern. +if &t_Co > 2 || has("gui_running") + syntax on + set hlsearch +endif +" }}} + +" {{{ Terminal fixes +if &term ==? "xterm" + set t_Sb=^[4%dm + set t_Sf=^[3%dm + set ttymouse=xterm2 +endif + +if &term ==? "gnome" && has("eval") + " Set useful keys that vim doesn't discover via termcap but are in the + " builtin xterm termcap. See bug #122562. We use exec to avoid having to + " include raw escapes in the file. + exec "set =\eO5D" + exec "set =\eO5C" +endif +" }}} + +" {{{ Filetype plugin settings +" Enable plugin-provided filetype settings, but only if the ftplugin +" directory exists (which it won't on livecds, for example). +if isdirectory(expand("$VIMRUNTIME/ftplugin")) + filetype plugin on + + " Uncomment the next line (or copy to your ~/.vimrc) for plugin-provided + " indent settings. Some people don't like these, so we won't turn them on by + " default. + " filetype indent on +endif +" }}} + +" {{{ Fix &shell, see bug #101665. +if "" == &shell + if executable("@GENTOO_PORTAGE_EPREFIX@/bin/bash") + set shell=@GENTOO_PORTAGE_EPREFIX@/bin/bash + elseif executable("@GENTOO_PORTAGE_EPREFIX@/bin/sh") + set shell=@GENTOO_PORTAGE_EPREFIX@/bin/sh + endif +endif +"}}} + +" {{{ Our default /bin/sh is bash, not ksh, so syntax highlighting for .sh +" files should default to bash. See :help sh-syntax and bug #101819. +if has("eval") + let is_bash=1 +endif +" }}} + +" {{{ Autocommands +if has("autocmd") + +augroup gentoo + au! + + " Gentoo-specific settings for ebuilds. These are the federally-mandated + " required tab settings. See the following for more information: + " http://www.gentoo.org/proj/en/devrel/handbook/handbook.xml + " Note that the rules below are very minimal and don't cover everything. + " Better to emerge app-vim/gentoo-syntax, which provides full syntax, + " filetype and indent settings for all things Gentoo. + au BufRead,BufNewFile *.e{build,class} let is_bash=1|setfiletype sh + au BufRead,BufNewFile *.e{build,class} set ts=4 sw=4 noexpandtab + + " In text files, limit the width of text to 78 characters, but be careful + " that we don't override the user's setting. + autocmd BufNewFile,BufRead *.txt + \ if &tw == 0 && ! exists("g:leave_my_textwidth_alone") | + \ setlocal textwidth=78 | + \ endif + + " When editing a file, always jump to the last cursor position + autocmd BufReadPost * + \ if ! exists("g:leave_my_cursor_position_alone") | + \ if line("'\"") > 0 && line ("'\"") <= line("$") | + \ exe "normal g'\"" | + \ endif | + \ endif + + " When editing a crontab file, set backupcopy to yes rather than auto. See + " :help crontab and bug #53437. + autocmd FileType crontab set backupcopy=yes + + " If we previously detected that the default encoding is not UTF-8 + " (g:added_fenc_utf8), assume that a file with only ASCII characters (or no + " characters at all) isn't a Unicode file, but is in the default encoding. + " Except of course if a byte-order mark is in effect. + autocmd BufReadPost * + \ if exists("g:added_fenc_utf8") && &fileencoding == "utf-8" && + \ ! &bomb && search('[\x80-\xFF]','nw') == 0 && &modifiable | + \ set fileencoding= | + \ endif + +augroup END + +endif " has("autocmd") +" }}} + +" {{{ vimrc.local +if filereadable("@GENTOO_PORTAGE_EPREFIX@/etc/vim/vimrc.local") + source @GENTOO_PORTAGE_EPREFIX@/etc/vim/vimrc.local +endif +" }}} + +" vim: set fenc=utf-8 tw=80 sw=2 sts=2 et foldmethod=marker : + diff --git a/sdk_container/src/third_party/portage-stable/app-editors/vim-core/files/xxd-completion b/sdk_container/src/third_party/portage-stable/app-editors/vim-core/files/xxd-completion new file mode 100644 index 0000000000..174a4093f3 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/app-editors/vim-core/files/xxd-completion @@ -0,0 +1,25 @@ +# Author: Ciaran McCreesh +# +# completion for xxd + +_xxd() +{ + local cur prev cmd args + + COMPREPLY=() + cur=${COMP_WORDS[COMP_CWORD]} + prev=${COMP_WORDS[COMP_CWORD-1]} + cmd=${COMP_WORDS[0]} + + if [[ "${cur}" == -* ]] ; then + args='-a -b -c -E -g -h -i -l -ps -r -s -u -v' + COMPREPLY=( $( compgen -W "${args}" -- $cur ) ) + else + _filedir + fi +} + +complete -F _xxd xxd + +# vim: set ft=sh sw=4 et sts=4 : + diff --git a/sdk_container/src/third_party/portage-stable/app-editors/vim-core/vim-core-7.3.189.ebuild b/sdk_container/src/third_party/portage-stable/app-editors/vim-core/vim-core-7.3.189.ebuild new file mode 100644 index 0000000000..af1ae413b2 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/app-editors/vim-core/vim-core-7.3.189.ebuild @@ -0,0 +1,20 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-editors/vim-core/vim-core-7.3.189.ebuild,v 1.8 2011/07/17 22:02:20 halcy0n Exp $ + +EAPI=3 +VIM_VERSION="7.3" +inherit vim + +VIM_CORE_GENTOO_PATCHES="vim-core-${VIM_VERSION}-gentoo-patches.tar.bz2" +VIM_ORG_PATCHES="vim-patches-${PV}.tar.bz2" +VIMRC_FILE_SUFFIX="-r4" + +SRC_URI="ftp://ftp.vim.org/pub/vim/unix/vim-${VIM_VERSION}.tar.bz2 + http://dev.gentoo.org/~lack/vim/${VIM_CORE_GENTOO_PATCHES} + http://dev.gentoo.org/~lack/vim/${VIM_ORG_PATCHES}" + +S="${WORKDIR}/vim${VIM_VERSION/.}" +DESCRIPTION="vim and gvim shared files" +KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="" diff --git a/sdk_container/src/third_party/portage-stable/app-editors/vim/files/vim-7.1.285-darwin-x11link.patch b/sdk_container/src/third_party/portage-stable/app-editors/vim/files/vim-7.1.285-darwin-x11link.patch new file mode 100644 index 0000000000..1cf00d6a8f --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/app-editors/vim/files/vim-7.1.285-darwin-x11link.patch @@ -0,0 +1,11 @@ +--- src/configure.in ++++ src/configure.in +@@ -2701,7 +2701,7 @@ + AC_MSG_CHECKING(whether X_LOCALE needed) + AC_TRY_COMPILE([#include ],, + AC_TRY_LINK_FUNC([_Xsetlocale], [AC_MSG_RESULT(yes) +- AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)), ++ AC_DEFINE(X_LOCALE) ldflags_save="$ldflags_save -lX11"], AC_MSG_RESULT(no)), + AC_MSG_RESULT(no)) + fi + CFLAGS=$cflags_save diff --git a/sdk_container/src/third_party/portage-stable/app-editors/vim/files/vim-7.3-interix-link.patch b/sdk_container/src/third_party/portage-stable/app-editors/vim/files/vim-7.3-interix-link.patch new file mode 100644 index 0000000000..26036652a6 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/app-editors/vim/files/vim-7.3-interix-link.patch @@ -0,0 +1,12 @@ +diff -ru vim73.orig/src/link.sh vim73/src/link.sh +--- vim73.orig/src/link.sh 2010-10-21 16:29:07 +0200 ++++ vim73/src/link.sh 2010-10-21 16:23:15 +0200 +@@ -41,7 +41,7 @@ + if sh link.cmd; then + touch auto/link.sed + cp link.cmd linkit.sh +- for libname in SM ICE nsl dnet dnet_stub inet socket dir elf iconv Xt Xmu Xp Xpm X11 Xdmcp x w perl dl pthread thread readline m crypt attr; do ++ for libname in dummy; do + cont=yes + while test -n "$cont"; do + if grep "l$libname " linkit.sh >/dev/null; then diff --git a/sdk_container/src/third_party/portage-stable/app-editors/vim/files/vim-completion b/sdk_container/src/third_party/portage-stable/app-editors/vim/files/vim-completion new file mode 100644 index 0000000000..157b546494 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/app-editors/vim/files/vim-completion @@ -0,0 +1,36 @@ +# Author: Ciaran McCreesh +# +# completion for vim + +_vim() +{ + local cur prev cmd args + + COMPREPLY=() + cur=${COMP_WORDS[COMP_CWORD]} + prev=${COMP_WORDS[COMP_CWORD-1]} + cmd=${COMP_WORDS[0]} + + if [[ "${prev}" == "--servername" ]] ; then + local servers + servers=$(gvim --serverlist ) + COMPREPLY=( $( compgen -W "${servers}" -- $cur ) ) + + elif [[ "${prev}" == -[uUi] ]] ; then + COMPREPLY=( $( compgen -W "NONE" ) \ + $( compgen -f -X "!*vim*" -- "$cur" ) ) + + elif [[ "${cur}" == -* ]] ; then + args='-t -q -c -S --cmd -A -b -C -d -D -e -E -f --nofork \ + -F -g -h -H -i -L -l -m -M -N -n -nb -o -R -r -s \ + -T -u -U -V -v -w -W -x -X -y -Y -Z --echo-wid \ + --help --literal --noplugin --version' + COMPREPLY=( $( compgen -W "${args}" -- $cur ) ) + else + _filedir + fi +} + +complete -o filenames -F _vim vim ex view evim rvim rview + +# vim: set ft=sh sw=4 et sts=4 : diff --git a/sdk_container/src/third_party/portage-stable/app-editors/vim/files/vimrc b/sdk_container/src/third_party/portage-stable/app-editors/vim/files/vimrc new file mode 100644 index 0000000000..2038d96d9c --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/app-editors/vim/files/vimrc @@ -0,0 +1,93 @@ +" Default configuration file for Vim +" Written by Aron Griffis +" Modified by Ryan Phillips +" Added Redhat's vimrc info by Seemant Kulleen + +" The following are some sensible defaults for Vim for most users. +" We attempt to change as little as possible from Vim's defaults, +" deviating only where it makes sense +set nocompatible " Use Vim defaults (much better!) +set bs=2 " Allow backspacing over everything in insert mode +set ai " Always set auto-indenting on +"set backup " Keep a backup file +set viminfo='20,\"50 " read/write a .viminfo file -- limit to only 50 +set history=50 " keep 50 lines of command history +set ruler " Show the cursor position all the time + + +" Added to default to high security within Gentoo. Fixes bug #14088 +set modelines=0 + +if v:lang =~ "^ko" + set fileencodings=euc-kr + set guifontset=-*-*-medium-r-normal--16-*-*-*-*-*-*-* +elseif v:lang =~ "^ja_JP" + set fileencodings=euc-jp + set guifontset=-misc-fixed-medium-r-normal--14-*-*-*-*-*-*-* +elseif v:lang =~ "^zh_TW" + set fileencodings=big5 + set guifontset=-sony-fixed-medium-r-normal--16-150-75-75-c-80-iso8859-1,-taipei-fixed-medium-r-normal--16-150-75-75-c-160-big5-0 +elseif v:lang =~ "^zh_CN" + set fileencodings=gb2312 + set guifontset=*-r-* +endif +if v:lang =~ "utf8$" || v:lang =~ "UTF-8$" + set fileencodings=utf-8,latin1 +endif + +" Only do this part when compiled with support for autocommands +if has("autocmd") + " In text files, always limit the width of text to 78 characters + autocmd BufRead *.txt set tw=78 + " When editing a file, always jump to the last cursor position + autocmd BufReadPost * + \ if line("'\"") > 0 && line ("'\"") <= line("$") | + \ exe "normal g'\"" | + \ endif +endif + +" Don't use Ex mode, use Q for formatting +map Q gq + +" Switch syntax highlighting on, when the terminal has colors +" Also switch on highlighting the last used search pattern. +if &t_Co > 2 || has("gui_running") + syntax on + set hlsearch +endif + +if &term=="xterm" + set t_RV= " don't check terminal version + set t_Co=8 + set t_Sb=^[4%dm + set t_Sf=^[3%dm +endif + +if has("autocmd") + +" Gentoo-specific settings for ebuilds. These are the federally-mandated +" required tab settings. See the following for more information: +" http://www.gentoo.org/doc/en/xml/gentoo-howto.xml +augroup gentoo + au! + au BufRead,BufNewFile *.ebuild set tabstop=4 shiftwidth=4 noexpandtab +augroup END + +endif " has("autocmd") + +" some extra commands for HTML editing +nmap ,mh wbgueyei<ea>pa>bba +nmap ,h1 _i

A

+nmap ,h2 _i

A

+nmap ,h3 _i

A

+nmap ,h4 _i

A

+nmap ,h5 _i
A
+nmap ,h6 _i
A
+nmap ,hb wbieabb +nmap ,he wbieabb +nmap ,hi wbieabb +nmap ,hu wbieabb +nmap ,hs wbieabb +nmap ,ht wbieabb +nmap ,hx wbFf + diff --git a/sdk_container/src/third_party/portage-stable/app-editors/vim/vim-7.3.189.ebuild b/sdk_container/src/third_party/portage-stable/app-editors/vim/vim-7.3.189.ebuild new file mode 100644 index 0000000000..09952d7b55 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/app-editors/vim/vim-7.3.189.ebuild @@ -0,0 +1,26 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-editors/vim/vim-7.3.189.ebuild,v 1.8 2011/07/17 22:02:58 halcy0n Exp $ + +EAPI=3 +VIM_VERSION="7.3" +inherit vim + +VIM_ORG_PATCHES="vim-patches-${PV}.tar.bz2" + +SRC_URI="ftp://ftp.vim.org/pub/vim/unix/vim-${VIM_VERSION}.tar.bz2 + http://dev.gentoo.org/~lack/vim/${VIM_ORG_PATCHES}" + +S="${WORKDIR}/vim${VIM_VERSION/.}" +DESCRIPTION="Vim, an improved vi-style text editor" +KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~ia64-hpux ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="" + +src_prepare() { + vim_src_prepare + + if [[ ${CHOST} == *-interix* ]]; then + epatch "${FILESDIR}"/${PN}-7.3-interix-link.patch + fi + epatch "${FILESDIR}"/${PN}-7.1.285-darwin-x11link.patch +} diff --git a/sdk_container/src/third_party/portage-stable/eclass/vim.eclass b/sdk_container/src/third_party/portage-stable/eclass/vim.eclass new file mode 100644 index 0000000000..f4256a2f86 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/vim.eclass @@ -0,0 +1,799 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/vim.eclass,v 1.200 2011/08/20 15:46:21 lack Exp $ + +# Authors: +# Jim Ramsay +# Ryan Phillips +# Seemant Kulleen +# Aron Griffis +# Ciaran McCreesh +# Mike Kelly + +# This eclass handles vim, gvim and vim-core. Support for -cvs ebuilds is +# included in the eclass, since it's rather easy to do, but there are no +# official vim*-cvs ebuilds in the tree. + +# gvim's GUI preference order is as follows: +# aqua CARBON (not tested) +# -aqua gtk gnome GNOME2 +# -aqua gtk -gnome GTK2 +# -aqua -gtk motif MOTIF +# -aqua -gtk -motif neXt NEXTAW +# -aqua -gtk -motif -neXt ATHENA + +# Support -cvs ebuilds, even though they're not in the official tree. +MY_PN=${PN%-cvs} + +if [[ ${MY_PN} != "vim-core" ]] ; then + # vim supports python-2 only + PYTHON_DEPEND="python? 2" + PYTHON_USE_WITH_OPT="python" + PYTHON_USE_WITH="threads" +fi +inherit eutils vim-doc flag-o-matic versionator fdo-mime bash-completion prefix python + +HOMEPAGE="http://www.vim.org/" +SLOT="0" +LICENSE="vim" + +# Check for EAPI functions we need: +case "${EAPI:-0}" in + 0|1) + die "vim.eclass no longer supports EAPI 0 or 1" + ;; + 2|3) + HAS_SRC_PREPARE=1 + HAS_USE_DEP=1 + ;; + *) + die "Unknown EAPI ${EAPI}" + ;; +esac + +if [[ ${PN##*-} == "cvs" ]] ; then + inherit cvs +fi + +IUSE="nls acl" + +TO_EXPORT="pkg_setup src_compile src_install src_test pkg_postinst pkg_postrm" +if [[ $HAS_SRC_PREPARE ]]; then + TO_EXPORT="${TO_EXPORT} src_prepare src_configure" +else + TO_EXPORT="${TO_EXPORT} src_unpack" +fi +EXPORT_FUNCTIONS ${TO_EXPORT} + +DEPEND="${DEPEND} + >=app-admin/eselect-vi-1.1 + >=sys-apps/sed-4 + sys-devel/autoconf + >=sys-libs/ncurses-5.2-r2 + nls? ( virtual/libintl )" +RDEPEND="${RDEPEND} + >=app-admin/eselect-vi-1.1 + >=sys-libs/ncurses-5.2-r2 + nls? ( virtual/libintl )" + +if [[ ${MY_PN} == "vim-core" ]] ; then + IUSE="${IUSE} livecd" + PDEPEND="!livecd? ( app-vim/gentoo-syntax )" +else + IUSE="${IUSE} cscope debug gpm perl python ruby" + + DEPEND="${DEPEND} + cscope? ( dev-util/cscope ) + gpm? ( >=sys-libs/gpm-1.19.3 ) + perl? ( dev-lang/perl ) + acl? ( kernel_linux? ( sys-apps/acl ) ) + ruby? ( =dev-lang/ruby-1.8* )" + RDEPEND="${RDEPEND} + cscope? ( dev-util/cscope ) + gpm? ( >=sys-libs/gpm-1.19.3 ) + perl? ( dev-lang/perl ) + acl? ( kernel_linux? ( sys-apps/acl ) ) + ruby? ( =dev-lang/ruby-1.8* ) + !"/dev/stderr"} + patchnum = $3 + printf "%s:", patchnum >"/dev/stderr" + } + $1=="***" && $(NF)!="****" { + # First line of a patch; suppress printing + firstlines = $0 + next + } + $1=="---" && $(NF)!="----" { + # Second line of a patch; try to open the file to see + # if it exists. + thisfile = $2 + if (!seen[thisfile] && (getline tryme < thisfile) == -1) { + # Check if it will be created + firstlines = firstlines "\n" $0 + getline + firstlines = firstlines "\n" $0 + getline + if ($0 != "*** 0 ****") { + # Non-existent and not created, stop printing + printing = 0 + printf " (%s)", thisfile >"/dev/stderr" + next + } + } + # Close the file to avoid leakage, bug 205037 + close(thisfile) + # Print the previous lines and start printing + print firstlines + printing = 1 + printf " %s", thisfile >"/dev/stderr" + # Remember that we have seen this file + seen[thisfile] = 1 + } + printing { print } + END { if (patchnum) {printf "\n" >"/dev/stderr"} } + ' > ${p} || die + + # For reasons yet unknown, epatch fails to apply this cleanly + ebegin "Applying filtered vim patches" + TMPDIR=${T} patch -f -s -p0 < ${p} + eend 0 +} + +vim_pkg_setup() { + # people with broken alphabets run into trouble. bug 82186. + unset LANG LC_ALL + export LC_COLLATE="C" + + # Gnome sandbox silliness. bug #114475. + mkdir -p "${T}/home" + export HOME="${T}/home" + + if [[ ${MY_PN} != "vim-core" ]] && use python; then + # vim supports python-2 only + python_set_active_version 2 + if [[ $HAS_USE_DEP ]]; then + # python.eclass only defines python_pkg_setup for EAPIs that support + # USE dependencies + python_pkg_setup + elif ! built_with_use =dev-lang/python-2* threads; then + die "You must build dev-lang/python with USE=threads" + fi + fi +} + +vim_src_prepare() { + has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= + if [[ ${PN##*-} == cvs ]] ; then + ECVS_SERVER="vim.cvs.sourceforge.net:/cvsroot/vim" + ECVS_PASS="" + ECVS_MODULE="vim7" + ECVS_TOP_DIR="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/cvs-src/${ECVS_MODULE}" + cvs_src_unpack + else + # Apply any patches available from vim.org for this version + if [[ $VIM_ORG_PATCHES == *.patch.bz2 ]]; then + einfo "Applying monolithic patch ${VIM_ORG_PATCHES}" + epatch "${WORKDIR}/${VIM_ORG_PATCHES%.bz2}" + else + apply_vim_patches + fi + + # Unpack the runtime snapshot if available (only for vim-core) + if [[ -n "$VIM_RUNTIME_SNAP" ]] ; then + cd "${S}" || die + ebegin "Unpacking vim runtime snapshot" + rm -rf runtime + # Changed this from bzip2 |tar to tar -j since the former broke for + # some reason on freebsd. + # --spb, 2004/12/18 + tar xjf "${DISTDIR}"/${VIM_RUNTIME_SNAP} + eend $? + fi + fi + + # Another set of patches borrowed from src rpm to fix syntax errors etc. + cd "${S}" || die "cd ${S} failed" + if [[ -d "${WORKDIR}"/gentoo/patches-all/ ]]; then + EPATCH_SUFFIX="gz" EPATCH_FORCE="yes" \ + epatch "${WORKDIR}"/gentoo/patches-all/ + elif [[ ${MY_PN} == "vim-core" ]] && [[ -d "${WORKDIR}"/gentoo/patches-core/ ]]; then + # Patches for vim-core only (runtime/*) + EPATCH_SUFFIX="patch" EPATCH_FORCE="yes" \ + epatch "${WORKDIR}"/gentoo/patches-core/ + fi + + # Unpack an updated netrw snapshot if necessary. This is nasty. Don't + # ask, you don't want to know. + if [[ -n "${VIM_NETRW_SNAP}" ]] ; then + ebegin "Unpacking updated netrw snapshot" + tar xjf "${DISTDIR}"/${VIM_NETRW_SNAP} -C runtime/ + eend $? + fi + + # Fixup a script to use awk instead of nawk + sed -i '1s|.*|#!'"${EPREFIX}"'/usr/bin/awk -f|' "${S}"/runtime/tools/mve.awk \ + || die "mve.awk sed failed" + + # Patch to build with ruby-1.8.0_pre5 and following + sed -i 's/defout/stdout/g' "${S}"/src/if_ruby.c + + # Read vimrc and gvimrc from /etc/vim + echo '#define SYS_VIMRC_FILE "'${EPREFIX}'/etc/vim/vimrc"' >> "${S}"/src/feature.h + echo '#define SYS_GVIMRC_FILE "'${EPREFIX}'/etc/vim/gvimrc"' >> "${S}"/src/feature.h + + # Use exuberant ctags which installs as /usr/bin/exuberant-ctags. + # Hopefully this pattern won't break for a while at least. + # This fixes bug 29398 (27 Sep 2003 agriffis) + sed -i 's/\> "$c" ; done + + # conditionally make the manpager.sh script + if [[ ${MY_PN} == vim ]] && use vim-pager ; then + cat < "${S}"/runtime/macros/manpager.sh +#!/bin/sh +sed -e 's/\x1B\[[[:digit:]]\+m//g' | col -b | \\ + vim \\ + -c 'let no_plugin_maps = 1' \\ + -c 'set nolist nomod ft=man' \\ + -c 'let g:showmarks_enable=0' \\ + -c 'runtime! macros/less.vim' - +END + fi + + # Try to avoid sandbox problems. Bug #114475. + if [[ -d "${S}"/src/po ]] ; then + sed -i -e \ + '/-S check.vim/s,..VIM.,ln -s $(VIM) testvim \; ./testvim -X,' \ + "${S}"/src/po/Makefile + fi + + if version_is_at_least 7.3.122; then + cp "${S}"/src/config.mk.dist "${S}"/src/auto/config.mk + fi + + # Bug #378107 - Build properly with >=perl-core/ExtUtils-ParseXS-3.20.0 + if version_is_at_least 7.3; then + sed -i "s:\\\$(PERLLIB)/ExtUtils/xsubpp:${EPREFIX}/usr/bin/xsubpp:" \ + "${S}"/src/Makefile || die 'sed for ExtUtils-ParseXS failed' + fi +} + +vim_src_unpack() { + unpack ${A} + vim_src_prepare +} + +vim_src_configure() { + local myconf + + # Fix bug 37354: Disallow -funroll-all-loops on amd64 + # Bug 57859 suggests that we want to do this for all archs + filter-flags -funroll-all-loops + + # Fix bug 76331: -O3 causes problems, use -O2 instead. We'll do this for + # everyone since previous flag filtering bugs have turned out to affect + # multiple archs... + replace-flags -O3 -O2 + + # Fix bug 18245: Prevent "make" from the following chain: + # (1) Notice configure.in is newer than auto/configure + # (2) Rebuild auto/configure + # (3) Notice auto/configure is newer than auto/config.mk + # (4) Run ./configure (with wrong args) to remake auto/config.mk + ebegin "Creating configure script" + sed -i 's/ auto.config.mk:/:/' src/Makefile || die "Makefile sed failed" + rm -f src/auto/configure + # autoconf-2.13 needed for this package -- bug 35319 + # except it seems we actually need 2.5 now -- bug 53777 + WANT_AUTOCONF=2.5 \ + emake -j1 -C src autoconf || die "make autoconf failed" + eend $? + + # This should fix a sandbox violation (see bug 24447). The hvc + # things are for ppc64, see bug 86433. + for file in /dev/pty/s* /dev/console /dev/hvc/* /dev/hvc* ; do + [[ -e ${file} ]] && addwrite $file + done + + if [[ ${MY_PN} == "vim-core" ]] || + ( [[ ${MY_PN} == vim ]] && use minimal ); then + myconf="--with-features=tiny \ + --enable-gui=no \ + --without-x \ + --disable-darwin \ + --disable-perlinterp \ + --disable-pythoninterp \ + --disable-rubyinterp \ + --disable-gpm" + + else + use debug && append-flags "-DDEBUG" + + myconf="--with-features=huge \ + --enable-multibyte" + myconf="${myconf} `use_enable cscope`" + myconf="${myconf} `use_enable gpm`" + myconf="${myconf} `use_enable perl perlinterp`" + myconf="${myconf} `use_enable python pythoninterp`" + myconf="${myconf} `use_enable ruby rubyinterp`" + # tclinterp is broken; when you --enable-tclinterp flag, then + # the following command never returns: + # VIMINIT='let OS=system("uname -s")' vim + # mzscheme support is currently broken. bug #91970 + #myconf="${myconf} `use_enable mzscheme mzschemeinterp`" + if [[ ${MY_PN} == gvim ]] ; then + myconf="${myconf} `use_enable netbeans`" + fi + + # --with-features=huge forces on cscope even if we --disable it. We need + # to sed this out to avoid screwiness. (1 Sep 2004 ciaranm) + if ! use cscope ; then + sed -i -e '/# define FEAT_CSCOPE/d' src/feature.h || \ + die "couldn't disable cscope" + fi + + if [[ ${MY_PN} == vim ]] ; then + # don't test USE=X here ... see bug #19115 + # but need to provide a way to link against X ... see bug #20093 + myconf="${myconf} --enable-gui=no --disable-darwin `use_with X x`" + + elif [[ ${MY_PN} == gvim ]] ; then + myconf="${myconf} --with-vim-name=gvim --with-x" + + echo ; echo + if use aqua ; then + einfo "Building gvim with the Carbon GUI" + myconf="${myconf} --enable-darwin --enable-gui=carbon" + elif use gtk ; then + myconf="${myconf} --enable-gtk2-check" + if use gnome ; then + einfo "Building gvim with the Gnome 2 GUI" + myconf="${myconf} --enable-gui=gnome2" + else + einfo "Building gvim with the gtk+-2 GUI" + myconf="${myconf} --enable-gui=gtk2" + fi + elif use motif ; then + einfo "Building gvim with the MOTIF GUI" + myconf="${myconf} --enable-gui=motif" + elif use neXt ; then + einfo "Building gvim with the neXtaw GUI" + myconf="${myconf} --enable-gui=nextaw" + else + einfo "Building gvim with the Athena GUI" + myconf="${myconf} --enable-gui=athena" + fi + echo ; echo + + else + die "vim.eclass doesn't understand MY_PN=${MY_PN}" + fi + fi + + if [[ ${MY_PN} == vim ]] && use minimal ; then + myconf="${myconf} --disable-nls --disable-multibyte --disable-acl" + else + myconf="${myconf} `use_enable nls` `use_enable acl`" + fi + + # Note: If USE=gpm, then ncurses will still be required. See bug #93970 + # for the reasons behind the USE flag change. + myconf="${myconf} --with-tlib=curses" + + myconf="${myconf} --disable-selinux" + + # Let Portage do the stripping. Some people like that. + export ac_cv_prog_STRIP="$(type -P true ) faking strip" + + # Keep Gentoo Prefix env contained within the EPREFIX + use prefix && myconf="${myconf} --without-local-dir" + + if [[ ${MY_PN} == "*vim" ]] ; then + if [[ ${CHOST} == *-interix* ]]; then + # avoid finding of this function, to avoid having to patch either + # configure or the source, which would be much more hackish. + # after all vim does it right, only interix is badly broken (again) + export ac_cv_func_sigaction=no + fi + fi + + myconf="${myconf} --with-modified-by=Gentoo-${PVR}" + econf ${myconf} || die "vim configure failed" +} + +vim_src_compile() { + has src_configure ${TO_EXPORT} || vim_src_configure + + # The following allows emake to be used + emake -j1 -C src auto/osdef.h objects || die "make failed" + + if [[ ${MY_PN} == "vim-core" ]] ; then + emake tools || die "emake tools failed" + rm -f src/vim + else + if ! emake ; then + eerror "If the above messages seem to be talking about perl" + eerror "and undefined references, please try re-emerging both" + eerror "perl and libperl with the same USE flags. For more" + eerror "information, see:" + eerror " https://bugs.gentoo.org/show_bug.cgi?id=18129" + die "emake failed" + fi + fi +} + +vim_src_install() { + has "${EAPI:-0}" 0 1 2 && use !prefix && EPREFIX= + has "${EAPI:-0}" 0 1 2 && use !prefix && ED="${D}" + local vimfiles=/usr/share/vim/vim${VIM_VERSION/.} + + if [[ ${MY_PN} == "vim-core" ]] ; then + dodir /usr/{bin,share/{man/man1,vim}} + cd src || die "cd src failed" + make \ + installruntime \ + installmanlinks \ + installmacros \ + installtutor \ + installtutorbin \ + installtools \ + install-languages \ + install-icons \ + DESTDIR=${D} \ + BINDIR="${EPREFIX}"/usr/bin \ + MANDIR="${EPREFIX}"/usr/share/man \ + DATADIR="${EPREFIX}"/usr/share \ + || die "install failed" + + keepdir ${vimfiles}/keymap + + # default vimrc is installed by vim-core since it applies to + # both vim and gvim + insinto /etc/vim/ + newins "${FILESDIR}"/vimrc${VIMRC_FILE_SUFFIX} vimrc + eprefixify "${ED}"/etc/vim/vimrc + + if use livecd ; then + # To save space, install only a subset of the files if we're on a + # livecd. bug 65144. + einfo "Removing some files for a smaller livecd install ..." + + eshopts_push -s extglob + + rm -fr "${ED}${vimfiles}"/{compiler,doc,ftplugin,indent} + rm -fr "${ED}${vimfiles}"/{macros,print,tools,tutor} + rm "${ED}"/usr/bin/vimtutor + + local keep_colors="default" + ignore=$(rm -fr "${ED}${vimfiles}"/colors/!(${keep_colors}).vim ) + + local keep_syntax="conf|crontab|fstab|inittab|resolv|sshdconfig" + # tinkering with the next line might make bad things happen ... + keep_syntax="${keep_syntax}|syntax|nosyntax|synload" + ignore=$(rm -fr "${ED}${vimfiles}"/syntax/!(${keep_syntax}).vim ) + + eshopts_pop + fi + + # These files might have slight security issues, so we won't + # install them. See bug #77841. We don't mind if these don't + # exist. + rm "${ED}${vimfiles}"/tools/{vimspell.sh,tcltags} 2>/dev/null + + elif [[ ${MY_PN} == gvim ]] ; then + dobin src/gvim + dosym gvim /usr/bin/gvimdiff + dosym gvim /usr/bin/evim + dosym gvim /usr/bin/eview + dosym gvim /usr/bin/gview + dosym gvim /usr/bin/rgvim + dosym gvim /usr/bin/rgview + dosym vim.1.gz /usr/share/man/man1/gvim.1.gz + dosym vim.1.gz /usr/share/man/man1/gview.1.gz + dosym vimdiff.1.gz /usr/share/man/man1/gvimdiff.1.gz + + insinto /etc/vim + newins "${FILESDIR}"/gvimrc${GVIMRC_FILE_SUFFIX} gvimrc + eprefixify "${ED}"/etc/vim/gvimrc + + insinto /usr/share/applications + newins "${FILESDIR}"/gvim.desktop${GVIM_DESKTOP_SUFFIX} gvim.desktop + insinto /usr/share/pixmaps + doins "${FILESDIR}"/gvim.xpm + + else # app-editor/vim + # Note: Do not install symlinks for 'vi', 'ex', or 'view', as these are + # managed by eselect-vi + dobin src/vim + dosym vim /usr/bin/vimdiff + dosym vim /usr/bin/rvim + dosym vim /usr/bin/rview + if use vim-pager ; then + dosym ${vimfiles}/macros/less.sh /usr/bin/vimpager + dosym ${vimfiles}/macros/manpager.sh /usr/bin/vimmanpager + insinto ${vimfiles}/macros + doins runtime/macros/manpager.sh + fperms a+x ${vimfiles}/macros/manpager.sh + fi + fi + + # bash completion script, bug #79018. + if [[ ${MY_PN} == "vim-core" ]] ; then + dobashcompletion "${FILESDIR}"/xxd-completion xxd + else + dobashcompletion "${FILESDIR}"/${MY_PN}-completion ${MY_PN} + fi + # We shouldn't be installing the ex or view man page symlinks, as they + # are managed by eselect-vi + rm -f "${ED}"/usr/share/man/man1/{ex,view}.1 +} + +# Make convenience symlinks, hopefully without stepping on toes. Some +# of these links are "owned" by the vim ebuild when it is installed, +# but they might be good for gvim as well (see bug 45828) +update_vim_symlinks() { + has "${EAPI:-0}" 0 1 2 && use !prefix && EROOT="${ROOT}" + local f syms + syms="vimdiff rvim rview" + einfo "Calling eselect vi update..." + # Call this with --if-unset to respect user's choice (bug 187449) + eselect vi update --if-unset + + # Make or remove convenience symlink, vim -> gvim + if [[ -f "${EROOT}"/usr/bin/gvim ]]; then + ln -s gvim "${EROOT}"/usr/bin/vim 2>/dev/null + elif [[ -L "${EROOT}"/usr/bin/vim && ! -f "${EROOT}"/usr/bin/vim ]]; then + rm "${EROOT}"/usr/bin/vim + fi + + # Make or remove convenience symlinks to vim + if [[ -f "${EROOT}"/usr/bin/vim ]]; then + for f in ${syms}; do + ln -s vim "${EROOT}"/usr/bin/${f} 2>/dev/null + done + else + for f in ${syms}; do + if [[ -L "${EROOT}"/usr/bin/${f} && ! -f "${EROOT}"/usr/bin/${f} ]]; then + rm -f "${EROOT}"/usr/bin/${f} + fi + done + fi + + # This will still break if you merge then remove the vi package, + # but there's only so much you can do, eh? Unfortunately we don't + # have triggers like are done in rpm-land. +} + +vim_pkg_postinst() { + # Update documentation tags (from vim-doc.eclass) + update_vim_helptags + + # Update fdo mime stuff, bug #78394 + if [[ ${MY_PN} == gvim ]] ; then + fdo-mime_mime_database_update + fi + + if [[ ${MY_PN} == vim ]] ; then + if use X; then + echo + elog "The 'X' USE flag enables vim <-> X communication, like" + elog "updating the xterm titlebar. It does not install a GUI." + fi + echo + elog "To install a GUI version of vim, use the app-editors/gvim" + elog "package." + fi + echo + elog "Vim 7 includes an integrated spell checker. You need to install" + elog "word list files before you can use it. There are ebuilds for" + elog "some of these named app-vim/vim-spell-*. If your language of" + elog "choice is not included, please consult vim-spell.eclass for" + elog "instructions on how to make a package." + echo + ewarn "Note that the English word lists are no longer installed by" + ewarn "default." + + if [[ ${MY_PN} != "vim-core" ]] ; then + echo + elog "To see what's new in this release, use :help version${VIM_VERSION/.*/}.txt" + fi + + # Warn about VIMRUNTIME + if [ -n "$VIMRUNTIME" -a "${VIMRUNTIME##*/vim}" != "${VIM_VERSION/./}" ] ; then + echo + ewarn "WARNING: You have VIMRUNTIME set in your environment from an old" + ewarn "installation. You will need to either unset VIMRUNTIME in each" + ewarn "terminal, or log out completely and back in. This problem won't" + ewarn "happen again since the ebuild no longer sets VIMRUNTIME." + fi + + # Scream loudly if the user is using a -cvs ebuild + if [[ -z "${PN/*-cvs/}" ]] ; then + ewarn + ewarn "You are using a -cvs ebuild. Be warned that this is not" + ewarn "officially supported and may not work." + ebeep 5 + fi + + echo + + # Display bash-completion message + if [[ ${MY_PN} == "vim-core" ]] ; then + export BASHCOMPLETION_NAME="xxd" + fi + bash-completion_pkg_postinst + + # Make convenience symlinks + if [[ ${MY_PN} != "vim-core" ]] ; then + # But only for vim/gvim, bug #252724 + update_vim_symlinks + fi +} + +vim_pkg_postrm() { + # Update documentation tags (from vim-doc.eclass) + update_vim_helptags + + # Make convenience symlinks + if [[ ${MY_PN} != "vim-core" ]] ; then + # But only for vim/gvim, bug #252724 + update_vim_symlinks + fi + + # Update fdo mime stuff, bug #78394 + if [[ ${MY_PN} == gvim ]] ; then + fdo-mime_mime_database_update + fi +} + +vim_src_test() { + + if [[ ${MY_PN} == "vim-core" ]] ; then + einfo "No testing needs to be done for vim-core" + return + fi + + einfo " " + einfo "Starting vim tests. Several error messages will be shown " + einfo "whilst the tests run. This is normal behaviour and does not " + einfo "indicate a fault." + einfo " " + ewarn "If the tests fail, your terminal may be left in a strange " + ewarn "state. Usually, running 'reset' will fix this." + ewarn " " + echo + + # Don't let vim talk to X + unset DISPLAY + + if [[ ${MY_PN} == gvim ]] ; then + # Make gvim not try to connect to X. See :help gui-x11-start + # in vim for how this evil trickery works. + ln -s "${S}"/src/gvim "${S}"/src/testvim + testprog="../testvim" + else + testprog="../vim" + fi + + # We've got to call make test from within testdir, since the Makefiles + # don't pass through our VIMPROG argument + cd "${S}"/src/testdir + + # Test 49 won't work inside a portage environment + einfo "Test 49 isn't sandbox-friendly, so it will be skipped." + sed -i -e 's~test49.out~~g' Makefile + + # We don't want to rebuild vim before running the tests + sed -i -e 's,: \$(VIMPROG),: ,' Makefile + + # Don't try to do the additional GUI test + make VIMPROG=${testprog} nongui \ + || die "At least one test failed" +} +