--- misc/scripts/shell/build.sh 2003/03/10 19:44:27 1.2 +++ misc/scripts/shell/build.sh 2003/03/12 09:51:02 1.3 @@ -4,123 +4,147 @@ # builds new-style dists from cvs source, and puts them # in a single location for download (eg. snapshots) # -# $Id: build.sh,v 1.2 2003/03/10 19:44:27 tdb Exp $ +# $Id: build.sh,v 1.3 2003/03/12 09:51:02 tdb Exp $ -# todo: ./configure on server pulls from net - make local? - +# base directory for staging STAGING=/u1/i-scream/staging +# log everything :-) LOG=$STAGING/build.log exec > $LOG 2>&1 set -x +# various directories CMSSOURCE=$STAGING/cms/source BUILDS=$STAGING/builds +DISTFILES=$STAGING/distfiles CVSROOT=/u1/i-scream/cvsmirror WEBSNAPSHOTS=/u1/i-scream/httpd/htdocs/snapshots +LIBURL=http://www.i-scream.org.uk/downloads/lib +# standard process for an i-scream style build +iscreambuild() { + SOURCEDIR=$1 + DESTDIR=$2 + BIN=$3 + cd $SOURCEDIR + if [ "X$TAG" != "X" ]; then + cvs -d $CVSROOT update -dPr $TAG + cvs2cl --stdout --no-wrap -r -t -w -S -g "-d $CVSROOT" -g "-q" -l "-r::$TAG" > build/ChangeLog + fi + LIBRARIES= + eval `grep "LIBRARIES=" configure` + for LIB in $LIBRARIES; do + fetchlib $LIB + cp $DISTFILES/$LIB build/lib + done + ./configure + if [ "X$BIN" = "Xyes" ]; then + gnumake dist-bin dest=$DESTDIR CVSROOT=$CVSROOT + gnumake clean + fi + gnumake dist dest=$DESTDIR CVSROOT=$CVSROOT +} + +# standard process for a gnu autoconf/automake/libtool style build +gnubuild() { + SOURCEDIR=$1 + DESTDIR=$2 + LIBTOOL=$3 + cd $SOURCEDIR + if [ "X$TAG" != "X" ]; then + cvs -d $CVSROOT update -dPr $TAG + cvs2cl --stdout --no-wrap -r -t -w -S -g "-d $CVSROOT" -g "-q" -l "-r::$TAG" > ChangeLog + fi + aclocal + autoheader + autoconf + if [ "X$LIBTOOL" = "Xyes" ]; then + libtoolize -c + fi + automake -a -c + ./configure + gnumake dist + TARBALL=`ls *.tar.gz` + mkdir -p $DESTDIR + cp $TARBALL $DESTDIR + gpg -abs --default-key=0x135D6B0A $DESTDIR/$TARBALL +} + +# grab a required library off the web to maintain a local copy +fetchlib() { + LIB=$1 + if [ ! -f $DISTFILES/$LIB ]; then + wget -P $DISTFILES $LIBURL/$LIB + fi + if [ ! -f $DISTFILES/$LIB ]; then + echo Required library $LIB does not exist at $LIBURL + exit 1 + fi +} + +# Full set of programs to be built +PROGS="server util corbaservices conient dbreporter rrdgraphing php winhost libstatgrab ihost" + +# Read command line args +if [ "X$1" != "X" ]; then + PROGS=$1 +fi +if [ "X$2" != "X" ]; then + TAG=$2 +fi + echo "+ Build started on `date`" +# remove any old files so we have a fresh start echo "+ Cleaning up" - rm -Rf cms rm -Rf $BUILDS/* +# pull the latest source from our local cvs echo "+ Updating CVS" - cvs -d $CVSROOT checkout cms/source cd $CMSSOURCE -echo "+ Building Server" +# Build all listed programs +for PROG in $PROGS; do + case $PROG in + server) + iscreambuild $CMSSOURCE/server $BUILDS/server yes + ;; + util) + iscreambuild $CMSSOURCE/util $BUILDS/util yes + ;; + corbaservices) + iscreambuild $CMSSOURCE/corbaservices $BUILDS/corbaservices yes + ;; + conient) + iscreambuild $CMSSOURCE/conient $BUILDS/conient yes + ;; + dbreporter) + iscreambuild $CMSSOURCE/reports/DBReporter $BUILDS/dbreporter yes + ;; + rrdgraphing) + iscreambuild $CMSSOURCE/reports/rrdgraphing $BUILDS/rrdgraphing no + ;; + php) + iscreambuild $CMSSOURCE/reports/php $BUILDS/php no + ;; + winhost) + iscreambuild $CMSSOURCE/host/winhost $BUILDS/winhost no + ;; + libstatgrab) + gnubuild $CMSSOURCE/libstatgrab $BUILDS/libstatgrab yes + ;; + ihost) + gnubuild $CMSSOURCE/host/ihost $BUILDS/ihost no + ;; + esac +done -cd $CMSSOURCE/server -./configure -gnumake dist-bin dest=$BUILDS/server -gnumake clean -gnumake dist dest=$BUILDS/server - -echo "+ Building Util Package" - -cd $CMSSOURCE/util -./configure -gnumake dist-bin dest=$BUILDS/util -gnumake clean -gnumake dist dest=$BUILDS/util - -echo "+ Building Corba Services Package" - -cd $CMSSOURCE/corbaservices -./configure -gnumake dist-bin dest=$BUILDS/corbaservices -gnumake clean -gnumake dist dest=$BUILDS/corbaservices - -echo "+ Building Conient Package" - -cd $CMSSOURCE/conient -./configure -gnumake dist-bin dest=$BUILDS/conient -gnumake clean -gnumake dist dest=$BUILDS/conient - -echo "+ Building DBReporter Package" - -cd $CMSSOURCE/reports/DBReporter -./configure -gnumake dist-bin dest=$BUILDS/dbreporter -gnumake clean -gnumake dist dest=$BUILDS/dbreporter - -echo "+ Building RRD Graphing Package" - -cd $CMSSOURCE/reports/rrdgraphing -./configure -gnumake dist dest=$BUILDS/rrdgraphing - -echo "+ Building PHP Pages Package" - -cd $CMSSOURCE/reports/php -./configure -gnumake dist dest=$BUILDS/php - -echo "+ Building Winhost Package" - -cd $CMSSOURCE/host/winhost -./configure -gnumake dist dest=$BUILDS/winhost - -echo "+ Making libstatgrab" - -cd $CMSSOURCE/libstatgrab -aclocal -autoheader -autoconf -libtoolize -c -automake -a -c -./configure -gnumake dist -LIBSTATGRAB=`ls libstatgrab-*.tar.gz` -mkdir -p $BUILDS/libstatgrab -cp $LIBSTATGRAB $BUILDS/libstatgrab -gpg -abs --default-key=0x135D6B0A $BUILDS/libstatgrab/$LIBSTATGRAB - -echo "+ Making ihost" - -cd $CMSSOURCE/host/ihost -aclocal -autoheader -autoconf -automake -a -c -./configure -gnumake dist -IHOST=`ls ihost-*.tar.gz` -mkdir -p $BUILDS/ihost -cp $IHOST $BUILDS/ihost -gpg -abs --default-key=0x135D6B0A $BUILDS/ihost/$IHOST - +# sync builds to the web tree echo "+ Copying to snapshots web tree" - -cp -R $BUILDS/* $WEBSNAPSHOTS +echo rsync -rlpogtxHv $BUILDS/. $WEBSNAPSHOTS echo "+ Done"