-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfigure
executable file
·256 lines (219 loc) · 9.43 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
#!/bin/bash
# Configure script
# Setup env.sh environment for MAUS installation
maus_root_dir=`pwd -P`
maus_third_party=""
while getopts ":r:t:u:" opt; do
case $opt in
r)
if [ -d "$OPTARG" ]; then
maus_root_dir=`cd $OPTARG; pwd -P`;
if [ "${maus_third_party}" == "" ]; then
maus_third_party="${maus_root_dir}"
fi
else
echo "FATAL: \$MAUS_ROOT_DIR $OPTARG not a directory"
exit 1
fi
;;
t)
if [ -d "$OPTARG" ]; then
maus_third_party=`cd $OPTARG; pwd -P`;
else
echo "FATAL: \$MAUS_THIRD_PARTY $OPTARG not a directory"
exit 1
fi
;;
u)
if [ $OPTARG = "StepI" ] || [ $OPTARG = "StepIV" ]; then
maus_unpacker_version=$OPTARG;
else
echo "FATAL: Bad MAUS_UNPACKER_VERSION supplied"
echo "FATAL: Please use either StepI or StepIV or leave unset"
exit 1
fi
;;
\?)
echo "FATAL: Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "FATAL: Option -$OPTARG requires an argument."
exit 1
;;
esac
done
if [ "${maus_third_party}" == "" ]; then
maus_third_party="${maus_root_dir}"
fi
if [ "${maus_unpacker_version}" == "" ]; then
maus_unpacker_version="StepIV"
fi
arch=`uname -s`
DYLIB_VAR=LD_LIBRARY_PATH # DYLIB_VAR is LD_LIBRARY_PATH for Linux. Substituted into env.sh.
if [ "$arch" = "Darwin" ]; then
DYLIB_VAR=DYLD_LIBRARY_PATH # else for Mac OSX it's DYLD_LIBRARY_PATH
echo "WARNING: You are using Mac OSX. However, the version that MICE uses";
echo "WARNING: of Recpack does not work on Mac OSX. Please consult the";
echo "WARNING: following link to install a Mac OSX version of Recpack:";
echo "WARNING:";
echo "WARNING: http://micewww.pp.rl.ac.uk/projects/maus/wiki/InstallMacOSX";
echo "WARNING:";
echo "WARNING: and realize that you may not publish results with unoffical";
echo "WARNING: versions of Recpack.";
echo "WARNING: ";
fi
##################################################
echo "INFO: This is the './configure' script. You should only"
echo "INFO: run this once. The purpose of me is to:"
echo "INFO:"
echo "INFO: 1. Check that you have a compiler"
echo "INFO: 2. Check that you have Python"
echo "INFO: 3. Check your version of Python is supported"
echo "INFO: 4. Create a file called 'env.sh'"
echo "INFO:"
echo "INFO: \$MAUS_ROOT_DIR set to $maus_root_dir"
echo "INFO: \$MAUS_THIRD_PARTY set to $maus_third_party"
echo "INFO:"
# Check for g++ ##################################################
(type -P gcc &>/dev/null && type -P g++ &>/dev/null) || {
echo "FATAL: gcc/g++ is required to compile code." >&2;
exit 1; }
if echo ${maus_root_dir} | grep -E '[ "]' >/dev/null;
then
echo "FATAL: No whitespace allowed in directory names.">&2;
echo "FATAL:">&2;
echo "FATAL: See:" >&2;
echo "FATAL:" >&2;
echo "FATAL: http://micewww.pp.rl.ac.uk:8080/issues/306" >&2;
exit 1;
fi
# Temporarily setup the environment (this gets repeated in the env.sh output)
# maus_central says where the precompiled third party libraries are (if any)
# PATH says where the binaries are
# DYLIB_VAR says where your shared libraries are
if [ "${maus_third_party}" ]; then
echo "INFO: Attempting to use third party libraries from " ${maus_third_party}
echo
if [ -z "${PATH}" ]; then # see if the variable exists yet
PATH="${maus_third_party}/third_party/install/bin" # if not, initialize it
else
PATH="${maus_third_party}/third_party/install/bin:$PATH" # else add to it
fi
if [ -z "${!DYLIB_VAR}" ]; then # see if the variable exists yet
eval ${DYLIB_VAR}="${maus_third_party}/third_party/install/lib" # if not, initialize it
else
eval ${DYLIB_VAR}="${maus_third_party}/third_party/install/lib:${!DYLIB_VAR}" # else add to to it
fi
fi
### Create environment files
cat > env.sh <<EOF
#/bin/sh
############################## DO NOT EDIT #####################################
# This file was automatically generated by the script
# ${maus_root_dir}/configure
################################################################################
if [ -z "\$MAUS_ROOT_DIR" ]; then
export MAUS_ROOT_DIR="${maus_root_dir}"
export MAUS_TMP_DIR="${maus_root_dir}/tmp"
export MAUS_THIRD_PARTY="${maus_third_party}"
echo "INFO: Using third party libraries from ${maus_third_party}"
# hack to get scons working (doesnt do well with --prefix_dir on build)
export SCONS_LIB_DIR="\${MAUS_THIRD_PARTY}/third_party/install/lib/python2.7/site-packages/scons-2.2.0-py2.7.egg/scons-2.2.0/"
maus_bin_dirs="\${MAUS_THIRD_PARTY}/third_party/install/bin"
if [ "$arch" == "Darwin" ]; then
maus_bin_dirs="\${MAUS_THIRD_PARTY}/third_party/install/Python.framework/Versions/2.7/bin:\${maus_bin_dirs}"
fi
if [ -z "\${PATH}" ]; then # see if the variable exists yet
export PATH="\${maus_bin_dirs}" # initialize it
else
export PATH="\${maus_bin_dirs}:\${PATH}" # else add it
fi
maus_lib_dirs="\${MAUS_THIRD_PARTY}/third_party/install/lib"
if [ "$arch" == "Darwin" ]; then
maus_lib_dirs="\${MAUS_THIRD_PARTY}/third_party/install/Python.framework/Versions/2.7/lib:\${maus_lib_dirs}"
fi
if [ -z "\${$DYLIB_VAR}" ]; then # see if the variable exists yet
export $DYLIB_VAR="\${maus_lib_dirs}" # intiailize it
else
export $DYLIB_VAR="\${maus_lib_dirs}:\${$DYLIB_VAR}" # else add it
fi
if [ -z "\${PYTHONPATH}" ]; then # see if the variable exists yet
export PYTHONPATH="\$MAUS_ROOT_DIR/build:\$MAUS_ROOT_DIR/build/tests" #initialize it
else
export PYTHONPATH="\$MAUS_ROOT_DIR/build:\$MAUS_ROOT_DIR/build/tests:\$PYTHONPATH" # else add it
fi
export $DYLIB_VAR="\$MAUS_THIRD_PARTY/build:\$$DYLIB_VAR"
export $DYLIB_VAR="\$MAUS_ROOT_DIR/build:\$$DYLIB_VAR"
export $DYLIB_VAR="\$MAUS_THIRD_PARTY/third_party/install/lib/python2.7/site-packages/numpy/core/lib:\$$DYLIB_VAR"
# Setup ROOT
export PYTHONPATH="\$MAUS_THIRD_PARTY/third_party/build/root/lib:\$PYTHONPATH"
export $DYLIB_VAR="\$MAUS_THIRD_PARTY/third_party/build/root/lib:\$$DYLIB_VAR"
if [ -f \$MAUS_THIRD_PARTY/third_party/build/root/bin/thisroot.sh ]; then
source \$MAUS_THIRD_PARTY/third_party/build/root/bin/thisroot.sh
fi
# maus common
export PYTHONPATH="\$MAUS_ROOT_DIR/src/:\$MAUS_ROOT_DIR/src/common_py:\$PYTHONPATH"
export $DYLIB_VAR="\$MAUS_ROOT_DIR/src/common_py:\$$DYLIB_VAR"
# python scripts for running doxygen
export PYTHONPATH="\$MAUS_ROOT_DIR/doc/doc_tools:\$PYTHONPATH"
# Celery
export CELERY_CONFIG_MODULE="mauscelery.celeryconfig"
# Unpacking version can be StepI or StepIV
export MAUS_UNPACKER_VERSION=${maus_unpacker_version}
export G4DEBUG=1
export G4VERS=geant4.9.6.p02
export G4SYSTEM=$arch-g++
export G4LIB="\${MAUS_THIRD_PARTY}/third_party/install/lib64"
export G4INCLUDE="\${MAUS_THIRD_PARTY}/third_party/install/include/Geant4"
export G4VIS_BUILD_DAWNFILE_DRIVER=1
export G4VIS_USE_DAWNFILE=1
export G4VIS_USE=0
export G4OPTIMISE=2
export OGLHOME=/usr/X11R6
export G4DATA="\${MAUS_THIRD_PARTY}/third_party/install/share/Geant4-9.6.2/data"
export G4LEDATA="\${G4DATA}/G4EMLOW6.32/"
export G4ABLADATA="\${G4DATA}/G4NEUTRONXS1.2/"
export G4NEUTRONDATA="\${G4DATA}/G4NDL4.2/"
export G4LEVELGAMMADATA="\${G4DATA}/PhotonEvaporation2.3/"
export G4RADIOACTIVEDATA="\${G4DATA}/RadioactiveDecay3.6/"
export G4SAIDXSDATA="\${G4DATA}/G4SAIDDATA1.1/"
# GEANT4 installs to lib64 on 64bit systems
export LD_LIBRARY_PATH="\${MAUS_THIRD_PARTY}/third_party/install/lib64:\${LD_LIBRARY_PATH}"
export MICEFILES="\${MAUS_ROOT_DIR}/src/legacy/FILES"
# Event Viewer
export EV_DETGEOM_FILE="\${MAUS_ROOT_DIR}/src/utilities/event-viewer/MICEGeometryMinimal.heprep"
if [ -z "\${maus_no_optimize}" ]; then # see if the variable exists
export maus_no_optimize=0 # force gcc not to optimise
fi
if [ -z "\${maus_lcov}" ]; then # see if the variable exists
export maus_lcov=0 # enable cpp coverage - requires lcov
fi
if [ -z "\${maus_pycov}" ]; then # see if the variable exists
export maus_lcov=0 # enable python coverage
fi
if [ -z "\${maus_debug}" ]; then # see if the variable exists
export maus_debug=0 # enable debugging
fi
if [ -z "\${maus_gprof}" ]; then # see if the variable exists
export maus_gprof=0 # enable cpp profiling of cpp unit tests
# requires gprof
fi
if [ -z "\${maus_assert_active}" ]; then # see if the variable exists
export maus_assert_active=0 # enable assert() command - disabled by default
# as better to use exceptions
fi
source "\${MAUS_THIRD_PARTY}/third_party/install/lib/maus-apps/env.sh"
echo "SUCCESS: MAUS setup"
else
echo "WARNING: MAUS already setup"
fi
EOF
echo "SUCCESS: Whenever you want to use MAUS, you must 'source'"
echo "SUCCESS: the environmental variables file. For Bourne-"
echo "SUCCESS: compatible shells like 'bash', run:"
echo "SUCCESS:"
echo "SUCCESS: source env.sh"
echo "SUCCESS:"
echo "SUCCESS: which can be added to your respective shell's"
echo "SUCCESS: startup scripts. Example: ~/.bashrc for 'bash'."