Project

General

Profile

Bug #913 » install_build_test.bash

Dobbs, Adam, 17 February 2012 19:31

 
1
#!/bin/bash
2

    
3
FILE_STD=install_log_std
4

    
5
if [ -f $FILE_STD ];
6
then
7
    rm $FILE_STD
8
fi
9

    
10
if [ "${MAUS_ROOT_DIR}" ]; then  # see if the variable exists yet                                                                                                                
11
    echo "Your current directory is:"
12
    pwd
13
    echo
14
    echo "Your MAUS_ROOT_DIR is:"
15
    echo ${MAUS_ROOT_DIR}
16
    echo
17
    echo "These should agree"
18
fi
19

    
20
echo
21
echo "   Welcome to the all-in-one MAUS installer script. "
22
echo "You can get the details of the progress "
23
echo "(or ensure it is doing something) by running:"
24
echo
25
echo "  tail -f $FILE_STD"
26
echo
27
echo "and if you run into a problem with the installation, then please please"
28
echo "please post your error here:"
29
echo
30
echo "   http://micewww.pp.rl.ac.uk/projects/maus/issues/new"
31
echo
32
echo "so we can build up a database of errors people have seen and how they"
33
echo "solved them.  Be sure to attach the files:"
34
echo
35
echo "   $FILE_STD"
36
echo
37

    
38
# Assign the location of the third party libraries  
39
# In order of preference the location is set to:
40
# 1. The first command line argument passed to the install script
41
# 2. Any existing environment variable called "maus_third_party" e.g. if set by user's .bashrc file
42
# 3. The current maus working directory, as held by the variable MAUS_ROOT_DIR
43
# If not location is found then the script aborts 
44
if [ "$1" ]; then
45
    MAUS_THIRD_PARTY=$1
46
    echo "Your MAUS_THIRD_PARTY is:"
47
    echo ${MAUS_THIRD_PARTY}
48
    echo
49
elif [ "${maus_third_party}" ]; then
50
    MAUS_THIRD_PARTY=${maus_third_party}
51
    echo "Your MAUS_THIRD_PARTY is:"
52
    echo ${MAUS_THIRD_PARTY}
53
    echo
54
else
55
    echo "No MAUS_THIRD_PARTY set, installing third party libraries locally"
56
    echo
57
fi
58

    
59
echo "Configuring..."
60
if [ "$MAUS_THIRD_PARTY" ]; then
61
	./configure $MAUS_THIRD_PARTY >& $FILE_STD
62
	echo "Sourcing the environment..."
63
	source env.sh 2>>$FILE_STD 1>>$FILE_STD 
64
else
65
	echo "The other loop"
66
	./configure 2>>$FILE_STD 1>>$FILE_STD
67
	echo "Sourcing the environment..."
68
	source env.sh 2>>$FILE_STD 1>>$FILE_STD 
69
	echo "Building third party libraries (takes a while...)"
70
	./third_party/build_all.bash 2>>$FILE_STD 1>>$FILE_STD
71
	echo "Resource the environment (catches the new ROOT version)"
72
	source env.sh 2>>$FILE_STD 1>>$FILE_STD
73
fi
74

    
75
echo "Have Scons cleanup the MAUS build state"
76
scons -c 2>>$FILE_STD 1>>$FILE_STD
77

    
78
echo "Build MAUS"
79
echo $FILE_STD
80
(scons build || (echo "FAIL! See logs.x" && exit 1))  2>>$FILE_STD 1>>$FILE_STD
81

    
82
echo "Run the tests"
83
(./tests/run_tests.bash || (echo "FAIL!  See logs." && exit 1)) 2>>$FILE_STD 1>>$FILE_STD
84

    
(2-2/2)