#!/apps/bin/perl # release must be passed as an argument $release = $ARGV[0]; if($#ARGV<0){&Usage();} # Check if we are checking out an existing tag or just grabbing the latest if($release eq "latest"){ $making_latest = 1; print "\"latest\" specified, no tag will be used for checkout.\n"; $release = `date +"build_%F"`; chomp($release); $svndir = "trunk"; }else{ $making_latest = 0; $svndir = "tags/$release"; } $halld_home = $ENV{"PWD"}."/$release"; $ENV{"HALLD_HOME"} = $halld_home; print "\nMaking release \"$release\" ($halld_home)\n\n"; # If we're compiling multiple platforms or making DEBUG versions # then we don't want to re-checkout the code or delete the # existing binaries. Use the HALLD_MAKE_RELEASE_REUSE environment # variable to control this if( $ENV{"HALLD_MAKE_RELEASE_REUSE"} ne "YES"){ # Move old "$release" out of the way (if it exists) and make new one if(-e $release){ print "\nMoving old \"$release\" directory to junk\n"; print `mkdir -p junk`; print `rm -rf junk/$release`; print `mv -f $release junk`; } mkdir $release; chdir $release; # Checkout release to new directory print "\nChecking out source code ....\n\n"; #system("cvs -d /group/halld/Repositories/cvsroot co $tags release"); system("svn co https://halldsvn.jlab.org/repos/$svndir/src"); system("svn co https://halldsvn.jlab.org/repos/$svndir/scripts"); # Touch the hddm_s.* files to so they are not remade system("touch src/libraries/HDDM/hddm_s.*"); # Make external libraries # chdir $halld_home; # $cmd = "mkdir -p lib/".$ENV{"OSNAME"}; # print "$cmd\n".`$cmd`; # $cmd = "mkdir -p bin/".$ENV{"OSNAME"}; # print "$cmd\n".`$cmd`; # system("make -C src/external install"); # Regenerate hddm files from schema # print "\nBuilding HDDM tools ...\n\n"; # chdir "$halld_home/src/libraries/include"; # system("make install"); # chdir "$halld_home/src/programs/Analysis/hddm"; # system("make install"); # print "\n...generating hddm C/C++ source ...\n"; # system("rm -f event.xml"); # system("schema-hddm event.xsd > event.xml"); # system("hddm-c event.xml"); # #system("cp hddm_s.h ../../../libraries/include"); # #system("cp hddm_s.c ../../../libraries/HDDM"); # chdir "$halld_home/src/programs/Simulation/hdds"; # system("make install"); } # Build Everything print "\nBuilding Everything ...\n\n"; chdir "$halld_home/src"; system("make install"); # Create setenv script chdir "$halld_home"; system("csh -f -c 'source /group/halld/Software/scripts/mk_setenv.csh'"); # Some other things that don't need to be redone if( $ENV{"HALLD_MAKE_RELEASE_REUSE"} ne "YES"){ # Submit hdgeant test to farm # system("jsub /group/halld/Software/scripts/NightlyTest2/nightly2.job"); # Rebuild documentation chdir "$halld_home/src/doc"; system("make clean ; make"); system("$halld_home/scripts/make_SVNreport ; mv SVNstats html"); if($making_latest != 0){ system("make install"); } } # Print usage statement and exit sub Usage() { print "\nUsage:\n\t\tmake_release \n\n"; print "Note that giving the release name \"latest\" will cause\n"; print "The most current version of the code to be checked out\n"; print "(without any tag).\n\n"; exit(0); }