Update for latest versions of Python and SCons.
[scons.git] / bin / timebuild
1 #!/bin/sh
2 #
3 # Profile running SCons to build itself from the current package.
4 #
5 # This runs "aegis -build" to build a current scons-src-*.tar.gz
6 # package, unpacks it in the supplied directory name, and then
7 # starts a profiled run of an SCons build, followed by another.
8 # This results in two profiles:
9 #
10 #       NAME/NAME-0.prof
11 #               profile of a build-everything run
12 #
13 #       NAME/NAME-1.prof
14 #               profile of an all-up-to-date run
15 #
16 # This also copies the build scons-src-*.tar.gz file to the NAME
17 # subdirectory, and tars up everything under src/ as NAME/src.tar.gz,
18 # so that repeated runs with different in-progress changes can serve
19 # as their own crude version control, so you don't lose that exact
20 # combination of features which performed best.
21
22 if test X$1 = X; then
23     echo "Must supply name!" >&2
24     exit 1
25 fi
26
27 VERSION=0.90
28
29 DIR=$1
30
31 SRC="scons-src-$VERSION"
32 SRC_TAR_GZ="${SRC}.tar.gz"
33 B_D_SRC_TAR_GZ="build/dist/${SRC_TAR_GZ}"
34
35 echo "Building ${B_D_SRC_TAR_GZ}: " `date`
36 aegis -build ${B_D_SRC_TAR_GZ}
37
38 echo "mkdir ${DIR}: " `date`
39 mkdir ${DIR}
40
41 echo "cp ${B_D_SRC_TAR_GZ} ${DIR}: " `date`
42 cp ${B_D_SRC_TAR_GZ} ${DIR}
43
44 echo "tar cf ${DIR}/src.tar.gz: " `date`
45 tar cf ${DIR}/src.tar.gz src
46
47 cd ${DIR}
48
49 echo "tar zxf ${SRC_TAR_GZ}: " `date`
50 tar zxf ${SRC_TAR_GZ}
51
52 cd ${SRC}
53
54 SCRIPT="src/script/scons.py"
55 ARGS="version=$VERSION"
56
57 export SCONS_LIB_DIR=`pwd`/src/engine
58
59 echo "Build run starting: " `date`
60 python $SCRIPT --profile=../$DIR-0.prof $ARGS > ../$DIR-0.log 2>&1
61
62 echo "Up-to-date run starting: " `date`
63 python $SCRIPT --profile=../$DIR-1.prof $ARGS > ../$DIR-1.log 2>&1
64
65 echo "Finished $DIR at: " `date`