makedist (1275B)
1 #!/usr/bin/perl 2 3 use strict; 4 5 sub run ($) { 6 my $cmd = shift; 7 print ("RUN> $cmd\n"); 8 system ($cmd) == 0 9 or die ("Command [$cmd] failed\n"); 10 } 11 12 my $ver = $ARGV[0] 13 or die ("Version argument required.\n", 14 "You can only run this from 'make dist'!\n"); 15 16 print ("Making crossroads distribution.. version is $ver\n"); 17 18 my $distdir = "/tmp/crossroads-$ver"; 19 if (-d $distdir) { 20 print ("Removing old dist dir $distdir\n"); 21 run ("rm -rf $distdir"); 22 } 23 print ("Preparing for distro (make documentation, make clean)\n"); 24 run ("make documentation"); 25 run ("make clean"); 26 mkdir ($distdir) 27 or die ("Cannot makedir $distdir: $!\n"); 28 29 print ("Copying all...\n"); 30 run ("cp -r * $distdir"); 31 print ("Removing CVS entries in dist dir\n"); 32 run ("find $distdir -type d -name CVS -exec rm -rf {} \\; || true"); 33 print ("Removing SVN entries in dist dir\n"); 34 run ("find $distdir -type d -name .svn -exec rm -rf {} \\; || true"); 35 36 print ("Making archive...\n"); 37 chdir ("/tmp") 38 or die ("Hm.. /tmp is gone\n"); 39 run ("tar czf crossroads-$ver.tar.gz crossroads-$ver"); 40 41 print ("----------------------------------------------------------\n", 42 " Distro archive is now in /tmp/crossroads-$ver.tar.gz\n", 43 "----------------------------------------------------------\n"); 44