31
36
if [ -e "${MAUS_ROOT_DIR}/third_party/source/${filename}" ]
33
echo "INFO: Found source archive in 'source' directory"
35
echo "INFO: Source archive doesn't exist. Downloading..."
37
wget --directory-prefix=${MAUS_ROOT_DIR}/third_party/source ${url}
38
echo "INFO: Found source archive in 'source' directory"
40
echo "INFO: Source archive doesn't exist. Downloading..."
41
wget --directory-prefix=${MAUS_ROOT_DIR}/third_party/source ${url}
41
44
if [ -e "${MAUS_ROOT_DIR}/third_party/source/${filename}" ]
43
echo "INFO: Source archive exists."
46
echo "INFO: Source archive exists."
45
48
echo "INFO: Checking MD5 checksum (otherwise the file didn't"
46
echo "INFO: download properly):"
49
echo "INFO: download properly):"
48
51
cd ${MAUS_ROOT_DIR}/third_party/source
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; }
54
echo "INFO: Unpacking:"
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; }
56
echo "INFO: Unpacking:"
56
58
rm -Rf ${MAUS_ROOT_DIR}/third_party/build/${directory}
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; \\'
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
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; \\'
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
75
cd ${MAUS_ROOT_DIR}/third_party/build/${directory}
74
76
sed -e "s@$var5@$var6@g" configure >& configure2
75
mv configure2 configure
77
mv configure2 configure
79
81
echo "INFO: Building:"
83
source ${MAUS_ROOT_DIR}/third_party/build/root/bin/thisroot.sh
86
./configure --disable-visual --with-root=${MAUS_ROOT_DIR}/third_party/build/root/
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}
85
source ${MAUS_ROOT_DIR}/third_party/build/root/bin/thisroot.sh
88
./configure --disable-visual --with-root=${MAUS_ROOT_DIR}/third_party/build/root/
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}
96
make -j$MAUS_NUM_THREADS
98
make -j$MAUS_NUM_THREADS
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
##################################################
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"
104
# ./bin/g4bldata --install
104
echo "INFO: third_party directory, which the rest of MAUS will"
106
# ./bin/g4bldata --install
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
110
echo "FATAL: http://micewww.pp.rl.ac.uk:8080/projects/maus/issues/" >&2
112
echo "FATAL: Giving up, sorry..." >&2
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
112
echo "FATAL: http://micewww.pp.rl.ac.uk:8080/projects/maus/issues/" >&2
114
echo "FATAL: Giving up, sorry..." >&2
116
else ##################################################
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
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
125
echo "FATAL: MAUS_ROOT_DIR=XXX ${0}" >&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
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
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
127
echo "FATAL: MAUS_ROOT_DIR=XXX ${0}" >&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
133
135
# This is the maximum length of text (ignoring whitespace), 50 chars