Talk:Vim

From DreamHost

Jump to: navigation, search

Comments

Old Versions

vim70_install.sh

#!/bin/sh
set -e

# Where do you want all this stuff built?
# ***Don't pick a directory that already exists!***
# We clean up after ourselves at the end!
SRCDIR=${HOME}/source
# And where should it be installed?
INSTALLDIR=${HOME}/share/vim
# Set DISTDIR to somewhere persistent.
DISTDIR=${HOME}/dist
# Set BINDIR to wherever you keep your binaries.
# The default is, ~/bin (/home/username/bin).
BINDIR=${HOME}/bin
# Set whatever nice value you wish here.
# Higher values indicate lower priority,
# Lower values indicate higher priority.
# Range: -20 to 20
NICE=19
# Name of the VIM install package
# (without any extension, ie: .tar.bz2)
VIM="vim-7.0"
# Version of VIM to install
# Note: This is required due to VIM's poor packaging setup.
# ***DO NOT USE PERIODS HERE!!***
VERSION="70"

# What features of VIM do you wish to enable or disable?
# ***Probably best not to change anything here!***
VIMFEATURES="--prefix=${HOME} \
--enable-perlinterp \
--enable-rubyinterp \
--enable-multibyte \
--disable-netbeans \
--with-features=big \
--disable-gui \
--without-x"

# Pre-download clean-up:
# Comment out $DISTDIR if you plan to re-compile more than once
# this session (modify the end of this script as well if you do!).
# Example: rm -rf $SRCDIR
rm -rf $SRCDIR $DISTDIR


# ---- End of User-Editable Bits ----
# Push the install dir's bin directory into the path.
export PATH=${INSTALLDIR}/bin:$PATH
# Setup needed directories
mkdir -p ${SRCDIR}
mkdir -p ${INSTALLDIR}
mkdir -p ${DISTDIR}
mkdir -p ${BINDIR}

# Get all the required packages.
# Uncomment the following two lines if you opted to not
# clean out your DIST directory.
cd ${DISTDIR}
wget -c ftp://ftp.vim.org/pub/vim/unix/${VIM}.tar.bz2

echo ---------- Unpacking downloaded archives. ----------
cd ${SRCDIR}
echo Extracting ${VIM}...
nice -n ${NICE} tar jxf ${DISTDIR}/${VIM}.tar.bz2
echo Done.

# Build it!
cd ${SRCDIR}/vim${VERSION}/src
./configure ${VIMFEATURES}
# make clean
nice -n ${NICE} make
# Move our newly created binary to our binaries directory.
mv ${SRCDIR}/vim${VERSION}/src/vim ${BINDIR}/
# Move the contents of the runtime directory to our install path.
mv ${SRCDIR}/vim${VERSION}/runtime/* ${INSTALLDIR}/


# Session Clean-up!
# Kill some Lemmings...
# I mean, strip debug info out of our binary!
strip --strip-all ${BINDIR}/vim

# Comment out $DISTDIR if you plan to re-compile more than once
# this session.
# Example: rm -rf $SRCDIR
rm -rf $SRCDIR $DISTDIR

echo ---------- INSTALL COMPLETE! ----------

It might also be a good idea to apply all the current patches in the above script before building. Below is an example:

PATCH_LEVEL=192
cd ${SRCDIR}
wget ftp://ftp.vim.org/pub/vim/patches/7.0/7.0.001-100.gz
gunzip 7.0.001-100.gz
for i in $(seq 101 $PATCH_LEVEL); do
   wget ftp://ftp.vim.org/pub/vim/patches/7.0/7.0.${i}
done

cd vim${VERSION}/
for i in $(ls ../7.0.*); do
   patch -fp0 < $i
done

note: if you are going to add the above snippet to your vim install script to add patches, add it before the line

# Build it!
Personal tools