~christopher-hunt08/maus/maus_scifi_recon_devel

« back to all changes in this revision

Viewing changes to third_party/bash/81G4beamline.bash

  • Committer: Christopher Hunt
  • Date: 2015-12-14 08:48:38 UTC
  • mfrom: (697.47.179 cctag_corr)
  • Revision ID: christopher.hunt08@imperial.ac.uk-20151214084838-wjl32e152yx3ks1j
MAUS Merg Remerged

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
filename=${directory}.tgz
5
5
url=http://www.muonsinternal.com/muons3/g4beamline/${filename}
6
6
 
 
7
echo
 
8
echo 'INFO: Installing third party library G4BeamLine 2.12'
 
9
echo '----------------------------------------------------'
 
10
echo
 
11
 
7
12
while [[ $# > 1 ]]
8
13
do
9
14
key="$1"
30
35
 
31
36
    if [ -e "${MAUS_ROOT_DIR}/third_party/source/${filename}" ]
32
37
    then
33
 
        echo "INFO: Found source archive in 'source' directory"
34
 
    else  
35
 
        echo "INFO: Source archive doesn't exist.  Downloading..."
36
 
 
37
 
        wget --directory-prefix=${MAUS_ROOT_DIR}/third_party/source ${url}
38
 
 
 
38
        echo "INFO: Found source archive in 'source' directory"
 
39
    else
 
40
        echo "INFO: Source archive doesn't exist.  Downloading..."
 
41
        wget --directory-prefix=${MAUS_ROOT_DIR}/third_party/source ${url}
39
42
    fi
40
43
 
41
44
    if [ -e "${MAUS_ROOT_DIR}/third_party/source/${filename}" ]
42
45
    then
43
 
        echo "INFO: Source archive exists."
44
 
        echo
 
46
        echo "INFO: Source archive exists."
 
47
        echo
45
48
        echo "INFO: Checking MD5 checksum (otherwise the file didn't"
46
 
        echo "INFO: download properly):"
47
 
        echo
 
49
        echo "INFO: download properly):"
 
50
        echo
48
51
        cd ${MAUS_ROOT_DIR}/third_party/source
49
 
        ls ${filename}.md5
50
52
 
51
 
        md5sum -c ${filename}.md5 || { echo "FATAL: Failed to download:" >&2; echo "FATAL: ${filename}." >&2; echo "FATAL: MD5 checksum failed.">&2; echo "FATAL: Try rerunning this command to redownload, or check" >&2; echo "FATAL: internet connection"  >&2; rm -f ${filename}; exit 1; }
52
 
        sleep 1
53
 
        echo
54
 
        echo "INFO: Unpacking:"
55
 
        echo
 
53
        md5sum -c ${filename}.md5 || { echo "FATAL: Failed to download:" >&2; echo "FATAL: ${filename}." >&2; echo "FATAL: MD5 checksum failed.">&2; echo "FATAL: Try rerunning this command to redownload, or check" >&2; echo "FATAL: internet connection"  >&2; rm -f ${filename}; exit 1; }
 
54
        sleep 1
 
55
        echo
 
56
        echo "INFO: Unpacking:"
 
57
        echo
56
58
        rm -Rf ${MAUS_ROOT_DIR}/third_party/build/${directory}
57
59
        sleep 1
58
60
        tar xvfz ${MAUS_ROOT_DIR}/third_party/source/${filename} -C ${MAUS_ROOT_DIR}/third_party/build > /dev/null
59
61
        ls ${MAUS_ROOT_DIR}/third_party/build/${directory}/source
60
62
        cd ${MAUS_ROOT_DIR}/third_party/build/${directory}/source/bin
61
 
        var1="LIBS=\"\$LIBS -lSoXt -lCoin -L/usr/lib -L/usr/X11R6/lib -lGLU -lGL -lXm -lXpm -lXmu -lXt -lXext -lX11 -lXi -lSM -lICE\""
62
 
        var2="LIBS=\"\$LIBS -L${MAUS_ROOT_DIR}/third_party/build/root/lib -lSoXt -lCoin -L/usr/lib -L/usr/X11R6/lib -lGLU -lGL -lXm -lXpm -lXmu -lXt -lXext -lX11 -lXi -lSM -lICE\""
63
 
        var3="LIBS=\"\$LIBS -lexpat -ldl\""
64
 
        var4="LIBS=\"\$LIBS -L/\$G4BL_DIR/../../install/lib -lexpat -ldl\""
65
 
        var5='cd \.\./\.\.; rm -f lib/libCLHEP-\[A-Z]\*\.a bin/\[A-Z]\*-config; \\'
66
 
        var6='cd \.\./\.\.; rm -f lib/libCLHEP-\[A-Z]\*\.a; \\' 
67
 
        
68
 
        sed -e "s@$var1@$var2@g" g4bl-config >& g4bl-config2
69
 
        sed -e "s@$var3@$var4@g" g4bl-config2 >& g4bl-config3
70
 
        mv g4bl-config3 g4bl-config
71
 
        chmod a+x g4bl-config
72
 
 
73
 
        cd ${MAUS_ROOT_DIR}/third_party/build/${directory}
 
63
        var1="LIBS=\"\$LIBS -lSoXt -lCoin -L/usr/lib -L/usr/X11R6/lib -lGLU -lGL -lXm -lXpm -lXmu -lXt -lXext -lX11 -lXi -lSM -lICE\""
 
64
        var2="LIBS=\"\$LIBS -L${MAUS_ROOT_DIR}/third_party/build/root/lib -lSoXt -lCoin -L/usr/lib -L/usr/X11R6/lib -lGLU -lGL -lXm -lXpm -lXmu -lXt -lXext -lX11 -lXi -lSM -lICE\""
 
65
        var3="LIBS=\"\$LIBS -lexpat -ldl\""
 
66
        var4="LIBS=\"\$LIBS -L/\$G4BL_DIR/../../install/lib -lexpat -ldl\""
 
67
        var5='cd \.\./\.\.; rm -f lib/libCLHEP-\[A-Z]\*\.a bin/\[A-Z]\*-config; \\'
 
68
        var6='cd \.\./\.\.; rm -f lib/libCLHEP-\[A-Z]\*\.a; \\'
 
69
 
 
70
        sed -e "s@$var1@$var2@g" g4bl-config >& g4bl-config2
 
71
        sed -e "s@$var3@$var4@g" g4bl-config2 >& g4bl-config3
 
72
        mv g4bl-config3 g4bl-config
 
73
        chmod a+x g4bl-config
 
74
 
 
75
        cd ${MAUS_ROOT_DIR}/third_party/build/${directory}
74
76
        sed -e "s@$var5@$var6@g" configure >& configure2
75
 
        mv configure2 configure
76
 
        chmod a+x configure
77
 
                
78
 
        echo
 
77
        mv configure2 configure
 
78
        chmod a+x configure
 
79
 
 
80
        echo
79
81
        echo "INFO: Building:"
80
 
        echo
 
82
        echo
81
83
        sleep 1
82
84
 
83
 
        source ${MAUS_ROOT_DIR}/third_party/build/root/bin/thisroot.sh
84
 
        echo $LD_LIBRARY_PATH
85
 
 
86
 
        ./configure --disable-visual --with-root=${MAUS_ROOT_DIR}/third_party/build/root/
87
 
 
88
 
        cd ${MAUS_ROOT_DIR}/third_party/build/${directory}/source/bin
89
 
        mv g4bl-config ${MAUS_ROOT_DIR}/third_party/build/${directory}/bin/g4bl-config
90
 
        cd ${MAUS_ROOT_DIR}/third_party/build/${directory}
91
 
 
92
 
        echo
 
85
        source ${MAUS_ROOT_DIR}/third_party/build/root/bin/thisroot.sh
 
86
        echo $LD_LIBRARY_PATH
 
87
 
 
88
        ./configure --disable-visual --with-root=${MAUS_ROOT_DIR}/third_party/build/root/
 
89
 
 
90
        cd ${MAUS_ROOT_DIR}/third_party/build/${directory}/source/bin
 
91
        mv g4bl-config ${MAUS_ROOT_DIR}/third_party/build/${directory}/bin/g4bl-config
 
92
        cd ${MAUS_ROOT_DIR}/third_party/build/${directory}
 
93
 
 
94
        echo
93
95
        echo "INFO: Make:"
94
 
        echo
 
96
        echo
95
97
        sleep 1
96
 
        make -j$MAUS_NUM_THREADS
 
98
        make -j$MAUS_NUM_THREADS
97
99
 
98
100
        cat ${MAUS_ROOT_DIR}/src//map/MapPyBeamlineSimulation/G4bl/maps/x* > ${MAUS_ROOT_DIR}/src//map/MapPyBeamlineSimulation/G4bl/maps/TypeIBend_6InchGap_tapered.map
99
 
                    ################################################## 
100
 
        echo
 
101
 
 
102
        echo
101
103
        echo "INFO: The package should be locally build now in your"
102
 
        echo "INFO: third_party directory, which the rest of MAUS will"
103
 
        echo "INFO: find."
104
 
#         ./bin/g4bldata --install
 
104
        echo "INFO: third_party directory, which the rest of MAUS will"
 
105
        echo "INFO: find."
 
106
#       ./bin/g4bldata --install
105
107
 
106
108
    else
107
 
        echo "FATAL: Source archive still doesn't exist.  Please file a bug report with your operating system,">&2
108
 
        echo "FATAL: distribution, and any other useful information at:" >&2
109
 
        echo "FATAL: " >&2
110
 
        echo "FATAL: http://micewww.pp.rl.ac.uk:8080/projects/maus/issues/" >&2
111
 
        echo "FATAL:" >&2
112
 
        echo "FATAL: Giving up, sorry..." >&2
113
 
        exit 1
 
109
        echo "FATAL: Source archive still doesn't exist.  Please file a bug report with your operating system,">&2
 
110
        echo "FATAL: distribution, and any other useful information at:" >&2
 
111
        echo "FATAL: " >&2
 
112
        echo "FATAL: http://micewww.pp.rl.ac.uk:8080/projects/maus/issues/" >&2
 
113
        echo "FATAL:" >&2
 
114
        echo "FATAL: Giving up, sorry..." >&2
 
115
        exit 1
114
116
    fi
115
 
  
116
 
else         ################################################## 
117
 
echo
118
 
echo "FATAL: MAUS_ROOT_DIR is not set, which is required to" >&2  
119
 
echo "FATAL: know where to install this package.  You have two" >&2 
120
 
echo "FATAL: options:" >&2
121
 
echo "FATAL:" >&2
122
 
echo "FATAL: 1. Set the MAUS_ROOT_DIR from the command line by" >&2 
123
 
echo "FATAL: (if XXX is the directory where MAUS is installed):" >&2
124
 
echo "FATAL:" >&2 
125
 
echo "FATAL:        MAUS_ROOT_DIR=XXX ${0}" >&2
126
 
echo "FATAL:" >&2
127
 
echo "FATAL: 2. Run the './configure' script in the MAUS ROOT" >&2 
128
 
echo "FATAL: directory, run 'source env.sh' then rerun this" >&2  
129
 
echo "FATAL: command ">&2
130
 
exit 1
 
117
 
 
118
else
 
119
    echo
 
120
    echo "FATAL: MAUS_ROOT_DIR is not set, which is required to" >&2
 
121
    echo "FATAL: know where to install this package.  You have two" >&2
 
122
    echo "FATAL: options:" >&2
 
123
    echo "FATAL:" >&2
 
124
    echo "FATAL: 1. Set the MAUS_ROOT_DIR from the command line by" >&2
 
125
    echo "FATAL: (if XXX is the directory where MAUS is installed):" >&2
 
126
    echo "FATAL:" >&2
 
127
    echo "FATAL:        MAUS_ROOT_DIR=XXX ${0}" >&2
 
128
    echo "FATAL:" >&2
 
129
    echo "FATAL: 2. Run the './configure' script in the MAUS ROOT" >&2
 
130
    echo "FATAL: directory, run 'source env.sh' then rerun this" >&2
 
131
    echo "FATAL: command ">&2
 
132
    exit 1
131
133
fi
132
134
 
133
135
# This is the maximum length of text (ignoring whitespace), 50 chars