Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

This script, which I have been using on Windows:

  • downloads vim sources from the svn repository (update: these will have the latest patches)
  • backs up existing vim
  • uses MinGW to compile gvim and vim
  • deploys gvim and vim to the release directory
  • uses rsync to update the vim runtime files

Other aspects of the script:

  • The single command of running the script does all of the above.
  • The script is configurable both in terms of parameters for the above steps and in terms of which of the above steps are done.
  • It is meant for personal use (rather than for use by, say, an IT department).

#!c:/opt/bin/perl use warnings; use strict; use Cwd qw(getcwd chdir realpath); use File::Find; use File::Copy; use File::stat; #--------------------------------------------------------- # Configuration my $svn_top_dir = 'e:/where/projects/vim/vim7'; my $vim_src_dir = "$svn_top_dir/src"; my $release_dir = 'c:\opt\vim\vim71'; my $user_name = 'the_user'; my $user_domain = 'the_domain'; my $mingw_path = 'c:\opt\MinGW\bin'; my $svn = 'c:\opt\svn\svn-win32-1.4.4\bin\svn'; my $rsync = 'c:\opt\cwRsync\bin\rsync'; my $rsync_arg = '-avzcP --delete --exclude="/dos/" ftp.nluug.nl: +:Vim/runtime/ ./runtime/'; my $make_cmd = $mingw_path . '\mingw32-make.exe -f Make_ming.m +ak'; my $cc = 'CC="c:/opt/MinGW/bin/gcc -Ic:/opt/MinGW/includ +e -Lc:/opt/MinGW/lib"'; my $general_options = 'FEATURES=HUGE DEBUG=no OLE=yes'; my $perl_current = 'c:/opt/perl'; my $perl_use = $perl_current; my $perl_options = "PERL=$perl_use PERL_VER=58"; # GUI=yes my $backup_existing = 1; my $update_svn = 1; my $stop_if_no_new_source = 1; my $build_gui = 1; my $release_gui = 1; my $build_console = 1; my $release_console = 1; my $update_runtime = 1; #--------------------------------------------------------- my $rc = ''; my $log = scalar localtime(time) . "\n"; my $start_dir = getcwd(); my $back_dir = ''; if($backup_existing) { my $back; for (1 .. 3) { # tested, but perhaps not all situations my $dir = $release_dir.".$_"; -e $dir or mkdir $dir and ($back_dir = $dir) and last; my $st = stat($dir) or die "can't stat $dir: $!\n"; $back or $back = $st->mtime; ($back < $st->mtime) or $back_dir = $dir and $back = $st->mtime; } chdir $release_dir or die "Can't cd to $release_dir: $!\n";; print "Backing up existing release at $release_dir to $back_dir ... +"; find({wanted => \&back_existing}, '.'); print "done\n"; } $ENV{USERNAME} = $user_name; $ENV{USERDOMAIN} = $user_domain; $ENV{PATH} .= ';' . $mingw_path; # Get the sources (other than runtime) # First time: svn co https://vim.svn.sourceforge.net/svnroot/vim/vim7 # chdir $svn_top_dir or die "Can't cd to $svn_top_dir: $!\n";; if($update_svn) { print "Updating sources ... "; $rc = `$svn update`; if($rc =~ /^At revision \d+\./) { print "nothing to do\n"; $stop_if_no_new_source and exit; } print "done\n"; } chdir $vim_src_dir or die "Can't cd to $vim_src_dir: $!\n";; if($build_gui) { print "Buildig GUI version ... "; $rc = `$make_cmd clean $cc $general_options $perl_options GUI=yes`; + $rc = `$make_cmd clean $cc $general_options $perl_options GUI=no`; $rc = `$make_cmd $cc $general_options $perl_options GUI=yes`; $log .= $rc; print "done\n"; if($release_gui) { print "Releasing GUI to $release_dir ... "; find({wanted => \&release}, '.'); print "done\n"; } } if($build_console) { print "Buildig console version ... "; $rc = `$make_cmd clean $cc $general_options $perl_options GUI=yes`; + $rc = `$make_cmd clean $cc $general_options $perl_options GUI=no`; $rc = `$make_cmd $cc $general_options $perl_options GUI=no`; $log .= $rc; print "done\n"; if($release_console) { print "Releasing console to $release_dir ... "; find({wanted => \&release}, '.'); print "done\n"; } } if($update_runtime) { chdir $release_dir or die "Can't cd to $release_dir: $!\n";; print "Rsync'ing runtime ... "; $rc = `$rsync $rsync_arg`; print "done\n"; print "rsync output:\n$rc,\n"; chdir $start_dir or die "Can't cd to $start_dir: $!\n";; } sub release { my $file = $_; $file =~ /\.(exe|dll)$/ and move($file, "$release_dir/$file"); } sub back_existing { my $file = $_; $file =~ /\.(exe|dll)$/ and copy($file, "$back_dir/$file"); } # nothing is actually done with $log # print "\n\n$log\n\n"; __END__


In reply to Download, build and deploy vim (personal use on Windows) by sg

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-24 10:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found