Actions

Difference between revisions of "Vim/makevim"

From RonWareWiki

< Vim
Line 46: Line 46:
 
die 1 "I don't know what the OS ${rawos} is.  Please update script"
 
die 1 "I don't know what the OS ${rawos} is.  Please update script"
 
fi
 
fi
 +
 +
# check for required programs:
 +
 +
for p in diff ncftpls ncftpget patch gawk sed sort grep tail
 +
do
 +
x=`which $p`
 +
if [ ! -x "$x" ]
 +
then
 +
die 100 "You need to have $p installed and in your PATH"
 +
fi
 +
done
  
 
nowhere="/dev/null"
 
nowhere="/dev/null"
Line 92: Line 103:
 
for p in $toget
 
for p in $toget
 
do
 
do
echo $p
 
 
ncftpget -u anonymous -p ron@ronware.org \
 
ncftpget -u anonymous -p ron@ronware.org \
 
-C ftp://ftp.vim.org/pub/vim/${unstable}patches/$vernum/$p diff/$p \
 
-C ftp://ftp.vim.org/pub/vim/${unstable}patches/$vernum/$p diff/$p \
Line 148: Line 158:
 
# default is to update vim, and then build if that was ok
 
# default is to update vim, and then build if that was ok
 
patches && build && install
 
patches && build && install
 +
 
</code>
 
</code>

Revision as of 19:21, 25 April 2009

The script I use to build vim:

  1. !/bin/sh
  1. setup:

die() { echo $2 exit $1 }


findvim() { vimdir="" for v in ~/proj/vim /c/vim7 ~/src/vim ~/proj/vim7 do if [ -d $v ] then if [ -d $v/src ] then vimdir=$v break fi fi done

if [ "$vimdir" == "" ] then die 1 "Cannot determine the VIM directory. Please update script" fi

}

findvim


rawos=`uname` os="?" if [ "$rawos" == "Darwin" ]; then os="Mac" ; fi if [ "$rawos" == "Linux" ]; then os="Lin" ; fi

if [ "$os" == "?" ] then die 1 "I don't know what the OS ${rawos} is. Please update script" fi

  1. check for required programs:

for p in diff ncftpls ncftpget patch gawk sed sort grep tail do x=`which $p` if [ ! -x "$x" ] then die 100 "You need to have $p installed and in your PATH" fi done

nowhere="/dev/null"

clean() { echo "Cleaning previous VIM build" cd $vimdir make distclean 2>&1 > $nowhere cd - }

patches() { cd $vimdir if [ ! -d "diff" ]; then mkdir diff ; fi rm -f diff/* # get vim's "short" version number: vernumraw=`grep "define.*VIM_VERSION_SHORT" src/version.h` vernum=`echo $vernumraw | sed -e 's/[^.0-9]//g'` unstable=`echo $vernumraw | sed -e 's/^[^"]\+//g'` unstable=`echo $unstable | sed -e 's/"//'` unstable=`echo $unstable | sed -e 's/".*//'` unstable=`echo $unstable | sed -e 's/[0-9.]//g'`

  1. echo "VIM version $vernum"

patchnum=`gawk 'BEGIN{RS=";"} /included_patches\[]/{print $0;quit}' src/version.c \ | sed -e 's/[^0-9]//g' | sort -n| tail -n 1` patchnum=$(($patchnum + 1))

  1. echo $patchnum
  2. echo $unstable

cmd="ncftpls -u anonymous -p ron@ronware.org ftp://ftp.vim.org/pub/vim/${unstable}patches/$vernum/"

  1. echo $cmd

echo "/$patchnum/,/END/" > diff/awk toget=`$cmd | grep $vernum | gawk -f diff/awk`

if [ "$toget" == "" ] then echo "No new patches" return 1 else echo "Getting patches..." for p in $toget do ncftpget -u anonymous -p ron@ronware.org \ -C ftp://ftp.vim.org/pub/vim/${unstable}patches/$vernum/$p diff/$p \ || die 10 "Unable to get patch file" patch -s -F 3 -p0 -idiff/$p || die 11 "Unable to apply patch $p" done fi cd - return 0 }

config() { cf="-O3 -s -fomit-frame-pointer -freg-struct-return -fmerge-all-constants" echo "Configuring VIM" cd $vimdir ./configure --with-features=big --with-compiledby="ron@ronware.org" CFLAGS="$cf"\ 2>&1 > config.log \ || die 2 "Failed to configure. See config.log" cd - } build() { echo "Building VIM" cd $vimdir/src make EXTRA_LIBS="-lsqlite3" \ 2>&1 > ../make.log \ || die 3 "Make failed. See make.log" cd - } install() { cd $vimdir/src sudo make install cd - }

if [ "$1" == "-f" ] then clean patches config build install exit 0 fi

if [ "$1" == "clean" ] then clean exit 0 fi


  1. default is to update vim, and then build if that was ok

patches && build && install