Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fbda2fb0ad023f090b7111f252c70fe452655b07
[simgrid.git] / buildtools / Cmake / cmake_simgrid.conf
1 # This is the configuration file for every scripts around.
2 # Don't mess with it, unless you know what you are doing
3
4 # Where to find the svn checkout
5 SIMGRID_SVN_ROOT=~/simgrid-svn
6
7 # Root of build directories and so on
8 SIMGRID_BASEDIR=~/simgrid
9
10
11
12 ############ Do not change anything below, unless your first name is Martin or Pierre ##############
13
14 # get_version: define the version number of the svn into a version variable
15 get_version() {
16   if [ x$version = x ] ; then
17     cd ${SIMGRID_SVN_ROOT}
18     svn up
19     version="simgrid-3.3.4-svn-r"`svnversion`
20     export version
21   fi
22 }
23
24 # wait_archive: wait until the archive gets defined into the right position
25 wait_archive() {
26   while [ ! -e ${SIMGRID_BASEDIR}/${version}.tar.gz ] ; do
27     echo ${SIMGRID_BASEDIR}/${version}.tar.gz not found. Wait one second.
28     sleep 1
29   done
30 }
31
32 # make_dist: rebuild an archive from the svn
33 make_dist() {
34   get_version
35   if [ ! -e ${SIMGRID_BASEDIR}/${version}.tar.gz ] ; do
36     echo "rebuild the missing files for compilation"
37     ./bootstrap && ./configure --enable-maintainer-mode --disable-compile-optimizations
38     echo "Make the archive"
39     make all dist
40
41     echo "Copy the archive in position"
42     mkdir -p ${SIMGRID_BASEDIR}
43     mv ${version}.tar.gz ${SIMGRID_BASEDIR}
44   else
45     echo "${SIMGRID_BASEDIR}/${version}.tar.gz already exists. Don't rebuild"
46   fi
47 }
48
49 # clean_node: remove everything about this node
50 clean_node() {
51   OS=`uname`
52   node=`uname -n`
53   # OS specific working directory 
54   BUILDDIR=${SIMGRID_BASEDIR}/$OS/$node/$version
55   export BUILDDIR
56   
57   # Clean any leftover from previous install
58   if [ -e $BUILDDIR ] ; then
59     echo "remove old directory $BUILDDIR"
60     rm -rf $BUILDDIR
61   fi
62   mkdir -p $BUILDDIR
63 }
64
65 # open_archive: wait for archive to be built, cleanup previous
66 open_archive() {
67   clean_node
68   wait_archive
69   cd $BUILDDIR/..
70   tar xfz ${SIMGRID_BASEDIR}/${version}.tar.gz
71 }
72
73
74 # build_from_autotools: build the archive using the autotools
75 # expects: the archive opened in the right position
76 build_from_autotools() {
77   open_archive
78   cd $BUILDDIR
79   ./configure $@
80   make
81 }