From: mquinson Date: Tue, 22 Dec 2009 16:43:02 +0000 (+0000) Subject: convert to shell functions X-Git-Tag: SVN~805 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/14d333ab7273e9e7ef3fb037e350aa48082b452b convert to shell functions git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6921 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/buildtools/Cmake/build_from_dist.sh b/buildtools/Cmake/build_from_dist.sh new file mode 100755 index 0000000000..979b3b93c2 --- /dev/null +++ b/buildtools/Cmake/build_from_dist.sh @@ -0,0 +1,8 @@ +#! /bin/bash +# This script waits that the make_dist script finishes building the right archive in ~/simgrid +# and then builds it using the autotools + + +source ~/simgrid-svn/buildtools/Cmake/cmake_simgrid.conf + +build_from_autotools diff --git a/buildtools/Cmake/cmake_simgrid.conf b/buildtools/Cmake/cmake_simgrid.conf index 5a4661f40b..fbda2fb0ad 100644 --- a/buildtools/Cmake/cmake_simgrid.conf +++ b/buildtools/Cmake/cmake_simgrid.conf @@ -5,4 +5,77 @@ SIMGRID_SVN_ROOT=~/simgrid-svn # Root of build directories and so on -SIMGRID_BASEDIR=~/simgrid \ No newline at end of file +SIMGRID_BASEDIR=~/simgrid + + + +############ Do not change anything below, unless your first name is Martin or Pierre ############## + +# get_version: define the version number of the svn into a version variable +get_version() { + if [ x$version = x ] ; then + cd ${SIMGRID_SVN_ROOT} + svn up + version="simgrid-3.3.4-svn-r"`svnversion` + export version + fi +} + +# wait_archive: wait until the archive gets defined into the right position +wait_archive() { + while [ ! -e ${SIMGRID_BASEDIR}/${version}.tar.gz ] ; do + echo ${SIMGRID_BASEDIR}/${version}.tar.gz not found. Wait one second. + sleep 1 + done +} + +# make_dist: rebuild an archive from the svn +make_dist() { + get_version + if [ ! -e ${SIMGRID_BASEDIR}/${version}.tar.gz ] ; do + echo "rebuild the missing files for compilation" + ./bootstrap && ./configure --enable-maintainer-mode --disable-compile-optimizations + echo "Make the archive" + make all dist + + echo "Copy the archive in position" + mkdir -p ${SIMGRID_BASEDIR} + mv ${version}.tar.gz ${SIMGRID_BASEDIR} + else + echo "${SIMGRID_BASEDIR}/${version}.tar.gz already exists. Don't rebuild" + fi +} + +# clean_node: remove everything about this node +clean_node() { + OS=`uname` + node=`uname -n` + # OS specific working directory + BUILDDIR=${SIMGRID_BASEDIR}/$OS/$node/$version + export BUILDDIR + + # Clean any leftover from previous install + if [ -e $BUILDDIR ] ; then + echo "remove old directory $BUILDDIR" + rm -rf $BUILDDIR + fi + mkdir -p $BUILDDIR +} + +# open_archive: wait for archive to be built, cleanup previous +open_archive() { + clean_node + wait_archive + cd $BUILDDIR/.. + tar xfz ${SIMGRID_BASEDIR}/${version}.tar.gz +} + + +# build_from_autotools: build the archive using the autotools +# expects: the archive opened in the right position +build_from_autotools() { + open_archive + cd $BUILDDIR + ./configure $@ + make +} \ No newline at end of file diff --git a/buildtools/Cmake/make_dist.sh b/buildtools/Cmake/make_dist.sh index 8e4495ef08..ef05ba072c 100755 --- a/buildtools/Cmake/make_dist.sh +++ b/buildtools/Cmake/make_dist.sh @@ -7,22 +7,6 @@ source ~/simgrid-svn/buildtools/Cmake/cmake_simgrid.conf # get config echo "get Linux dependencies" sudo aptitude install -y libtool automake1.10 autoconf libgcj10-dev gcc g++ bash flex flexml doxygen bibtex bibtool iconv bibtex2html addr2line valgrind transfig -echo "update the svn" -cd ${SIMGRID_SVN_ROOT} -svn up - -set -x # be verbose - - -echo "rebuild the missing files for compilation" -./bootstrap -./configure --enable-maintainer-mode --disable-compile-optimizations - -echo "Make the archive" -make all dist - -echo "Copy the archive in position" -mkdir -p ${SIMGRID_BASEDIR} -mv simgrid*.tar.gz ${SIMGRID_BASEDIR} +make_dist echo "Done!" diff --git a/buildtools/Cmake/wait_dist.sh b/buildtools/Cmake/wait_dist.sh index 69a5a148b6..771280e49e 100755 --- a/buildtools/Cmake/wait_dist.sh +++ b/buildtools/Cmake/wait_dist.sh @@ -4,10 +4,6 @@ source ~/simgrid-svn/buildtools/Cmake/cmake_simgrid.conf -cd ${SIMGRID_SVN_ROOT} -svn up -version="simgrid-3.3.4-svn-r"`svnversion` +get_version +wait_archive -while [ ! -e ${SIMGRID_BASEDIR}/${version}.tar.gz ] ; do - sleep 1 -done \ No newline at end of file