#!/bin/sh # # usage: vimbuild [tag] # # fetch indicated release tag of vim, compile, and test it. # Requires the Concurrent Versions System (cvs) or Subversion (svn) client, # and a suitable make tool. # # environment: # # $TMPDIR will be used as a staging area if defined, else /tmp is used. # # exit status: non zero on failure, zero on success. # PATH="/bin:/usr/bin:$PATH" WORKDIR=${TMPDIR:-/tmp} VTAG=${1:-vim} CONFIGURE_ARGS="--enable-perlinterp --enable-pythoninterp --enable-tclinterp --enable-rubyinterp --enable-cscope --enable-fontset --enable-gui=gtk2 --disable-gtktest" mkdir -p $WORKDIR || exit 1 cd $WORKDIR # fetch latest vim if [ -x "`which cvs`" ]; then echo using cvs cvs -z3 -d:pserver:anonymous@vim.cvs.sf.net:/cvsroot/vim checkout $VTAG elif [ -x "`which svn`" ]; then echo using svn svn checkout https://vim.svn.sourceforge.net/svnroot/vim/branches/${VTAG} else echo 'error, could not find a cvs or svn binary in $PATH!' exit 1 fi cd $VTAG ./configure $CONFIGURE_ARGS # # set the make command # uname | grep -i linux > /dev/null if [ $? -eq 0 ]; then NCPU=$(expr `cat /proc/cpuinfo | grep processor | wc -l` \* 4) MAKE="make -j${NCPU}" else # assume GNU make is gmake, like on *BSD if [ ! -x "`which gmake`" ]; then echo "Warning, GNU make not found!" echo "This will probably make a GTK gui build fail..." MAKE=make else uname | grep -i bsd > /dev/null if [ $? ]; then # check number of cpu via BSD sysctl NCPU=$(expr `sysctl hw.ncpu | awk '{ print $2 }'` \* 4) MAKE="gmake -j${NCPU}" else MAKE=gmake fi fi fi # now build and test it $MAKE if [ -x ./src/vim ]; then ./src/vim --version > /dev/null if [ $? -eq 0 ]; then echo "I think the Vi IMproved build was a success" else echo "I think the Vi IMproved build was a failure" echo "Do you wish to test it manually?" read REP echo $REP | grep -i y && exec ./src/vim # NO RETURN on yes fi fi cat << EOF run: `echo $MAKE | awk '{ print $1 }'` install as root to finish installing vim EOF exit 0
I wonder, if I'll ever bother to use it lol
Hey, it actually worked lol.
Uploaded it to my server, tweaked the configure args and bingo -- freshly updated via
$ vimbuild vim7
...
$ su - root
# cd /tmp/vim7 && make install
Just for the heck of it, I've made the script adapt $CONFIGURE_ARGS based on what it finds installed, hehe.
No comments:
Post a Comment