diff options
author | Aron Griffis <agriffis@gentoo.org> | 2003-03-23 20:36:26 +0000 |
---|---|---|
committer | Aron Griffis <agriffis@gentoo.org> | 2003-03-23 20:36:26 +0000 |
commit | 1a19a0216f42413ff208dda96a75217ffb7c0501 (patch) | |
tree | 6982b770930cb310ed06d8fabf55d85f3a136b43 /eclass/vim.eclass | |
parent | Incredibly stupid naming error (diff) | |
download | gentoo-2-1a19a0216f42413ff208dda96a75217ffb7c0501.tar.gz gentoo-2-1a19a0216f42413ff208dda96a75217ffb7c0501.tar.bz2 gentoo-2-1a19a0216f42413ff208dda96a75217ffb7c0501.zip |
update vim eclass to patchlevel 411
Diffstat (limited to 'eclass/vim.eclass')
-rw-r--r-- | eclass/vim.eclass | 226 |
1 files changed, 131 insertions, 95 deletions
diff --git a/eclass/vim.eclass b/eclass/vim.eclass index c4b933cf6f1a..77d58a6d4a2f 100644 --- a/eclass/vim.eclass +++ b/eclass/vim.eclass @@ -1,18 +1,41 @@ # 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.15 2003/03/16 04:21:05 seemant Exp $ -# -# Author Ryan Phillips <rphillips@gentoo.org> -# Modified by: Seemant Kulleen <seemant@gentoo.org> -# Ripped from the vim ebuilds. src_compile and install -# should be integrated in at some point +# $Header: /var/cvsroot/gentoo-x86/eclass/vim.eclass,v 1.16 2003/03/23 20:36:25 agriffis Exp $ + +# Authors: +# Ryan Phillips <rphillips@gentoo.org> +# Seemant Kulleen <seemant@gentoo.org> +# Aron Griffis <agriffis@gentoo.org> ECLASS=vim EXPORT_FUNCTIONS src_unpack inherit eutils -# Calculate the version based on the name of the ebuild +#========================================================================== +# Please note: +# +# The SRC_URI is determined in the following code via bash +# conditionals. Normally this is not allowed, because SRC_URI (also +# DEPEND/RDEPEND) are cached on Angel, and this cache is used by users +# that get portage via rsync. If bash conditionals can change the +# output of SRC_URI/DEPEND/RDEPEND based on some variable (such as +# USE), then the cache becomes invalid. +# +# So the reason the following code is valid is that the bash +# conditionals aren't testing something *variable*. I.e. the only +# thing being tested is the version, which won't change from machine +# to machine, so the cache remains valid. +# +# (21 Mar 2003 agriffis) +#========================================================================== + +# Calculate the version based on the name of the ebuild, for example +# (these examples are old but still applicable for the naming scheme) +# vim-6.0, when 6.0 is finally released +# vim-6.0_pre9, where 9 = (i), for vim-6.0i +# vim-6.0_pre47, where 47 = 26(a) + 21(u), for vim-6.0au +# vim-6.0_pre72, where 72 = 52(b) + 20(t), for vim-6.0bt vim_version="${PV%_pre*}" vim_pre="${PV##*_pre}" @@ -29,6 +52,7 @@ if [ "${vim_version}" = "${vim_pre}" ]; then SRC_URI="ftp://ftp.vim.org/pub/vim/unix/${MY_P}.tar.bz2 ftp://ftp.us.vim.org/pub/vim/unix/${MY_P}.tar.bz2" # ftp://ftp.vim.org/pub/vim/extra/${MY_P}-extra.tar.gz" + elif [ "${vim_pre}" -lt 27 ]; then # Handle (prerelease) versions with one trailing letter vim_letters=`echo ${vim_pre} | awk '{printf "%c", $0+96}'` @@ -46,91 +70,104 @@ elif [ "${vim_pre}" -lt 703 ]; then SRC_URI="ftp://ftp.vim.org/pub/vim/unreleased/unix/${MY_P}.tar.bz2 ftp://ftp.us.vim.org/pub/vim/unreleased/unix/${MY_P}.tar.bz2" # ftp://ftp.vim.org/pub/vim/extra/${MY_P}-extra.tar.gz" + else die "Eek! I don't know how to interpret the version!" fi -[ ! -z "${VIMPATCH}" ] && \ - SRC_URI="${SRC_URI} - mirror://gentoo/vim-${PV}-patches-001-${VIMPATCH}.tar.bz2" +# Add Vim NLS sources +SRC_URI="${SRC_URI} + nls? ( ftp://ftp.vim.org/pub/vim/extra/vim-${vim_version}-lang.tar.gz )" -SRC_URI="${SRC_URI} - mirror://vim-${PV}-gentoo-patches.tar.bz2" +# VIMPATCH is set in the actual vim/gvim ebuild. These are the +# incremental patches released by Bram. +[ -n "${VIMPATCH}" ] && \ +SRC_URI="${SRC_URI} mirror://gentoo/vim-${PV}-patches-001-${VIMPATCH}.tar.bz2" -LANG="vim-${vim_version}-lang.tar.gz" -if [ ! -z "${LANG}" ]; then - SRC_URI="${SRC_URI} nls? ( ftp://ftp.vim.org/pub/vim/extra/${LANG} )" +# Various patches from RH, etc. +# Started versioning this tarball when VIMPATCH hit 411 +if [ "${VIMPATCH:-0}" -ge 411 ]; then + SRC_URI="${SRC_URI} + mirror://gentoo/vim-${PV}-${VIMPATCH}-gentoo-patches.tar.bz2" +else + SRC_URI="${SRC_URI} mirror://gentoo/vim-${PV}-gentoo-patches.tar.bz2" fi +#=== End of SRC_URI setting =============================================== + HOMEPAGE="http://www.vim.org/" SLOT="0" LICENSE="vim" -epatch_prep() { - - ebegin "Removing superfluous patches..." - awk '/\(extra\).* Win32:|\(extra\) MS-DOS:|VMS:|\(extra\) BC5:|\(extra\) Mac:/ {print $2}' ${WORKDIR}/README | \ - xargs -i rm -f ${WORKDIR}/vimpatches/{}.gz +apply_vim_patches() { + einfo "Applying various patches (bugfixes/updates)..." - for i in ${EXCLUDE_PATCH} - do - rm -f ${WORKDIR}/vimpatches/${PV}.${i}.gz + local content depends files p d f + + # Remove patches specifically excluded in the ebuild; + # note this approach is deprecated since now the patch scanner + # below does all the work. + for p in ${EXCLUDE_PATCH}; do + rm -f ${WORKDIR}/vimpatches/${PV}.$p.gz done - eend $? + # Scan the patches, applying them only to files that either + # already exist or that will be created by the patch + for p in ${WORKDIR}/vimpatches/${vim_version}.*.gz; do + gzip -dc ${p} | awk ' + $1=="---" && $NF~/^200.$/ { + # Second line of a new patch; try to open the file to see + # if it exists. + if ((getline tryme < $2) == -1) { + # Check if it will be created + prevline = prevline "\n" $0 + getline + prevline = prevline "\n" $0 + getline + if ($0 != "*** 0 ****") { + # Non-existent and not created, stop printing + printing = 0 + next + } + } + # Print the previous lines and continue + print prevline + printing = 1 + } + printing { print } + { prevline = $0 }' > ${p%.gz} + + # Apply the patch now that it's filtered + [ -s ${p%.gz} ] && epatch ${p%.gz} + + # Conserve disk space + rm -f ${p%.gz} + done } - vim_src_unpack() { unpack ${A} - # Fixup a script to use awk instead of nawk - cd ${S}/runtime/tools - mv mve.awk mve.awk.old - ( read l; echo "#!/usr/bin/awk -f"; cat ) <mve.awk.old >mve.awk # Apply any patches available for this version cd ${S} - epatch_prep + apply_vim_patches - EPATCH_SUFFIX="gz" EPATCH_FORCE="yes" \ - epatch ${WORKDIR}/vimpatches/ + # Fixup a script to use awk instead of nawk + cd ${S}/runtime/tools + mv mve.awk mve.awk.old + ( read l; echo "#!/usr/bin/awk -f"; cat ) <mve.awk.old >mve.awk # Another set of patch's borrowed from src rpm to fix syntax error's etc. cd ${S} EPATCH_SUFFIX="gz" \ EPATCH_FORCE="yes" \ epatch ${WORKDIR}/gentoo/patches-all/ - - # Apply patches to the specific package (gvim, vim, vim-core) -# if [ "${PN}" = "gvim" ] -# then -# cd ${S} -# EPATCH_SUFFIX=-"gz" \ -# EPATCH_FORCE="yes" \ -# epatch ${WORKDIR}/gentoo/patches-gvim/ -# fi -# -# if [ "${PN}" = "vim-core" ] -# then -# cd ${S} -# EPATCH_SUFFIX="gz" \ -# EPATCH_FORCE="yes" \ -# epatch ${WORKDIR}/gentoo/patches-vim-core/ -# fi -# -# if [ "${PN}" = "vim" ] -# then -# cd ${S} -# EPATCH_SUFFIX="gz" \ -# EPATCH_FORCE="yes" \ -# epatch ${WORKDIR}/gentoo/patches-vim/ -# fi } src_compile() { local myconf - if [ "${PN}" = "vim-core" ] + if [ ${PN} = vim-core ] then myconf="--with-features=tiny \ --enable-gui=no \ @@ -147,28 +184,23 @@ src_compile() { myconf="--with-features=huge \ --enable-multibyte \ --enable-cscope" - use nls || myconf="${myconf} --disable-nls" - use perl && myconf="${myconf} --enable-perlinterp" - use python && myconf="${myconf} --enable-pythoninterp" - use ruby && myconf="${myconf} --enable-rubyinterp" - - # tclinterp is BROKEN. See note above DEPEND= - # use tcltk && myconf="$myconf --enable-tclinterp" - - # Added back gpm for temporary will remove if necessary, I think that I - # have - # fixed most of gpm so it should be fine. - use gpm || myconf="${myconf} --disable-gpm" - - # the console vim will change the caption of a terminal in X. - # the configure script should autodetect X being installed, so - # we'll specifically turn it off if X is not in the USE vars. - # -rphillips - if [ "${PN}" = "vim" ] - then - use X \ - && myconf="${myconf} --with-x" \ - || myconf="${myconf} --without-x" + myconf="${myconf} `use_enable nls`" + 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 + #myconf="${myconf} `use_enable tcl tclinterp`" + + # The console vim will change the caption of a terminal in X. + # Disable this functionality unless USE=X. Don't use + # "use_with" here because then we're telling Vim to use X even + # though it might not be installed. + if [ ${PN} = vim ]; then + use X || myconf="${myconf} --without-x" fi fi @@ -235,16 +267,21 @@ src_install() { DATADIR=/usr/share \ || die "install failed" - dodoc README* - cd $D/usr/share/doc/$PF - ln -s ../../vim/*/doc $P + dodoc README* + cd $D/usr/share/doc/$PF + ln -s ../../vim/*/doc $P + + keepdir /usr/share/vim/vim${vim_version/.}/keymap - keepdir /usr/share/vim/vim${vim_version/.}/keymap + # fix problems with vim not finding its data files. + echo "VIMRUNTIME=/usr/share/vim/vim${vim_version/.}" > 40vim + insinto /etc/env.d + doins 40vim - # fix problems with vim not finding its data files. - echo "VIMRUNTIME=/usr/share/vim/vim${vim_version/.}" > 40vim - insinto /etc/env.d - doins 40vim + # default vimrc is installed by vim-core since it applies to + # both vim and gvim + insinto /etc/vim/ + doins ${FILESDIR}/vimrc elif [ "${PN}" = "gvim" ] then dobin src/gvim @@ -258,18 +295,13 @@ src_install() { ln -s vim ${D}/usr/bin/ex ln -s vim ${D}/usr/bin/view ln -s vim ${D}/usr/bin/rview - - # Default vimrc - insinto /etc/vim/ - doins ${FILESDIR}/vimrc fi } pkg_postinst() { einfo - if [ "${PN}" = "gvim" ] - then + if [ ${PN} = gvim ]; then einfo "To enable UTF-8 viewing, set guifont and guifontwide: " einfo ":set guifont=-misc-fixed-medium-r-normal-*-18-120-100-100-c-90-iso10646-1" einfo ":set guifontwide=-misc-fixed-medium-r-normal-*-18-120-100-100-c-180-iso10646-1" @@ -279,8 +311,12 @@ pkg_postinst() { einfo einfo "Then, set read encoding to UTF-8:" einfo ":set encoding=utf-8" - else + elif [ ${PN} = vim ]; then einfo "gvim has now a seperate ebuild, 'emerge gvim' will install gvim" fi einfo + + # Make convenience symlinks, hopefully without stepping on toes + [ -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 } |