Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
split up config and function definitions; if ~/simgrid-svn/buildtools/scripts/simgrid...
[simgrid.git] / buildtools / scripts / simgrid_build.functions
1 # This file defines a bunch of useful functions to automatize the build of SimGrid.
2
3
4
5 # get_version: define the version number of the svn into a version variable
6 get_version() {
7   if [ x$version = x ] ; then
8     cd ${SIMGRID_SVN_ROOT}
9     svn up
10     version="simgrid-3.3.4-svn-r"`svnversion`
11     export version
12   fi
13 }
14
15 # wait_archive: wait until the archive gets defined into the right position
16 wait_archive() {
17   while [ ! -e ${SIMGRID_BASEDIR}/${version}.tar.gz ] ; do
18     echo ${SIMGRID_BASEDIR}/${version}.tar.gz not found. Wait five seconds.
19     sleep 5
20   done
21 }
22
23 # make_dist: rebuild an archive from the svn
24 make_dist() {
25   get_version
26   if [ ! -e ${SIMGRID_BASEDIR}/${version}.tar.gz ] ; then
27     cd ${SIMGRID_BASEDIR}
28     echo "rebuild the missing files for compilation"
29     if [ ! -e configure ] ; then
30       ./bootstrap
31     fi
32     if [ ! -e Makefile ] ; then
33        # Disable compilation optim to make it built faster
34        ./configure --enable-maintainer-mode --disable-compile-optimizations
35     fi
36     echo "Make the archive"
37     make all dist
38
39     echo "Copy the archive in position"
40     mkdir -p ${SIMGRID_BASEDIR}
41     mv ${version}.tar.gz ${SIMGRID_BASEDIR}
42   else
43     echo "${SIMGRID_BASEDIR}/${version}.tar.gz already exists. Don't rebuild"
44   fi
45 }
46
47 # clean_node: remove everything about this node
48 clean_node() {
49   OS=`uname`
50   node=`uname -n`
51   # OS specific working directory 
52   BUILDDIR=${SIMGRID_BASEDIR}/$OS/$node/$version
53   export BUILDDIR
54   
55   # Clean any leftover from previous install
56   if [ -e $BUILDDIR ] ; then
57     echo "remove old directory $BUILDDIR"
58     rm -rf $BUILDDIR
59   fi
60   mkdir -p $BUILDDIR
61 }
62
63 # open_archive: wait for archive to be built, cleanup previous
64 open_archive() {
65   get_version
66   clean_node
67   wait_archive
68   cd $BUILDDIR/..
69   tar xfz ${SIMGRID_BASEDIR}/${version}.tar.gz
70   cd $BUILDDIR
71 }
72