-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild-geant4.sh
executable file
·587 lines (498 loc) · 17.1 KB
/
build-geant4.sh
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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
#!/bin/bash
# This bash script is part of the MEGAlib & COSItools setup procedure.
# As such it is dual licenced under Apache 2.0 for COSItools and LGPL 3.0 for MEGAlib
#
# Development lead: Andreas Zoglauer
#
# Description:
# This script downloads, compiles, and installs Geant4
# Path to where this file is located
SETUPPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
# Operating system type
OSTYPE=$(uname -s | awk '{print tolower($0)}')
# Start with the configure options, since we want to compare them to what was done previously
CONFIGUREOPTIONS=""
# On Linux use the default gcc compiler, but not on mac
if [[ $(uname -a) != *arwin* ]]; then
type g++ >/dev/null 2>&1
if [ $? -eq 0 ]; then
# echo "g++ compiler found - using it as default!";
CONFIGUREOPTIONS="-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++"
fi
fi
CONFIGUREOPTIONS="${CONFIGUREOPTIONS} -DCMAKE_INSTALL_PREFIX=.. -DGEANT4_USE_GDML=ON -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_OPENGL_X11=OFF -DGEANT4_INSTALL_DATA_TIMEOUT=14400 -DGEANT4_USE_SYSTEM_EXPAT=OFF -DCMAKE_CXX_STANDARD=17"
# Reduce the warning messages:
WARNINGS="-Wno-shadow -Wno-implicit-fallthrough -Wno-overloaded-virtual -Wno-deprecated-copy -Wno-unused-result -Wno-format-overflow="
COMPILEROPTIONS=`gcc --version | head -n 1`
# The Geant4 website from which to download the tarball
WEBSITE="https://geant4-data.web.cern.ch/releases"
# Check if some of the frequently used software is installed:
type cmake >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "ERROR: cmake must be installed"
exit 1
else
VER=`cmake --version | grep ^cmake`
VER=${VER#cmake version };
OLDIFS=${IFS}; IFS='.'; Tokens=( ${VER} ); IFS=${OLDIFS};
VERSION=$(( 10000*${Tokens[0]} + 100*${Tokens[1]} + ${Tokens[2]} ));
if (( ${VERSION} < 30300 )); then
echo "ERROR: the version of cmake needs to be at least 3.3 and not ${VER}"
exit 1
fi
fi
type curl >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "ERROR: curl must be installed"
exit 1
fi
type openssl >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "ERROR: openssl must be installed"
exit 1
fi
confhelp() {
echo ""
echo "Building GEANT4"
echo " "
echo "Usage: ./build-geant4.sh [options]";
echo " "
echo " "
echo "Options:"
echo "--tarball=[file name of Geant4 tarball]"
echo " Use this tarball instead of downloading it from the Geant4 website"
echo " "
echo "--geant4version=[e.g. 10.02 (but not 10.02.p03)]"
echo " Specifiy the Geant4 version (ignores the requested version), if empty read he default version stated oin the setup scripts"
echo " "
echo "--sourcescript=[file name of new environment script]"
echo " The source script which sets all environment variables for Geant4."
echo " "
echo "--debug=[off/no, on/yes - default: off]"
echo " Compile with degugging options."
echo " "
echo "--keepenvironmentasis=[false/off/no, true/on/yes - default: false]"
echo " By default all relevant environment paths (such as LD_LIBRRAY_PATH, CPATH) are reset to empty to avoid most libray conflicts."
echo " This flag toggles this behaviour and lets you decide to keep your environment or not."
echo " "
echo "--maxthreads=[integer >=1 - default: off]"
echo " The maximum number of threads to be used for compilation. Default is the number of cores in your system."
echo " "
echo "--patch=[yes or no - default no]"
echo " Apply Geant4 patches, if there are any."
echo " "
echo "--cleanup=[off/no, on/yes - default: off]"
echo " Remove intermediate build files"
echo " "
echo "--help or -h"
echo " Show this help."
echo " "
echo " "
}
# Store command line
CMD=""
while [[ $# -gt 0 ]] ; do
CMD="${CMD} $1"
shift
done
# Check for help
for C in ${CMD}; do
if [[ ${C} == *-h* ]]; then
echo ""
confhelp
exit 0
fi
done
TARBALL=""
ENVFILE=""
MAXTHREADS=1024
WANTEDVERSION=""
PATCH="off"
DEBUG="off"
DEBUGSTRING=""
DEBUGOPTIONS=""
PATCH="off"
CLEANUP="off"
KEEPENVASIS="false"
# Overwrite default options with user options:
for C in ${CMD}; do
if [[ ${C} == *-t*=* ]]; then
TARBALL=`echo ${C} | awk -F"=" '{ print $2 }'`
elif [[ ${C} == *-s*=* ]] || [[ ${C} == *-e*=* ]]; then
ENVFILE=`echo ${C} | awk -F"=" '{ print $2 }'`
echo "Using this environment file: ${ENVFILE}"
elif [[ ${C} == *-m*=* ]]; then
MAXTHREADS=`echo ${C} | awk -F"=" '{ print $2 }'`
elif [[ ${C} == *-d*=* ]]; then
DEBUG=`echo ${C} | awk -F"=" '{ print $2 }'`
elif [[ ${C} == *-p*=* ]]; then
PATCH=`echo ${C} | awk -F"=" '{ print $2 }'`
elif [[ ${C} == *-cl*=* ]]; then
CLEANUP=`echo ${C} | awk -F"=" '{ print $2 }'`
elif [[ ${C} == *-g*=* ]]; then
WANTEDVERSION=`echo ${C} | awk -F"=" '{ print $2 }'`
elif [[ ${C} == *-k* ]]; then
KEEPENVASIS=`echo ${C} | awk -F"=" '{ print $2 }'`
elif [[ ${C} == *-h* ]]; then
echo ""
confhelp
exit 0
else
echo ""
echo "ERROR: Unknown command line option: ${C}"
echo " See \"$0 --help\" for a list of options"
exit 1
fi
done
echo ""
echo ""
echo ""
echo "Setting up Geant4..."
echo ""
echo "Verifying chosen configuration options:"
echo ""
if [ "${TARBALL}" != "" ]; then
if [[ ! -f "${TARBALL}" ]]; then
echo "ERROR: The chosen tarball cannot be found: ${TARBALL}"
exit 1
else
echo " * Using this tarball: ${TARBALL}"
fi
fi
if [ "${ENVFILE}" != "" ]; then
if [[ ! -f "${ENVFILE}" ]]; then
echo "ERROR: The chosen environment file cannot be found: ${ENVFILE}"
exit 1
else
echo " * Using this environment file: ${ENVFILE}"
fi
fi
if [ ! -z "${MAXTHREADS##[0-9]*}" ] 2>/dev/null; then
echo "ERROR: The maximum number of threads must be number and not ${MAXTHREADS}!"
exit 1
fi
if [ "${MAXTHREADS}" -le "0" ]; then
echo "ERROR: The maximum number of threads must be at least 1 and not ${MAXTHREADS}!"
exit 1
else
echo " * Using this maximum number of threads: ${MAXTHREADS}"
fi
DEBUG=`echo ${DEBUG} | tr '[:upper:]' '[:lower:]'`
if ( [[ ${DEBUG} == of* ]] || [[ ${DEBUG} == no ]] ); then
DEBUG="off"
DEBUGSTRING=""
DEBUGOPTIONS=""
echo " * Using no debugging code"
elif ( [[ ${DEBUG} == on ]] || [[ ${DEBUG} == y* ]] || [[ ${DEBUG} == nor* ]] ); then
DEBUG="normal"
DEBUGSTRING="_debug"
DEBUGOPTIONS="-DCMAKE_BUILD_TYPE=Debug"
echo " * Using debugging code"
else
echo "ERROR: Unknown debugging code selection: ${DEBUG}"
confhelp
exit 0
fi
PATCH=`echo ${PATCH} | tr '[:upper:]' '[:lower:]'`
if ( [[ ${PATCH} == of* ]] || [[ ${PATCH} == n* ]] ); then
PATCH="off"
echo " * Don't apply internal ROOT and Geant4 patches"
elif ( [[ ${PATCH} == on ]] || [[ ${PATCH} == y* ]] ); then
PATCH="on"
echo " * Apply internal ROOT and Geant4 patches"
else
echo " "
echo "ERROR: Unknown option for updates: ${PATCH}"
confhelp
exit 1
fi
CLEANUP=`echo ${CLEANUP} | tr '[:upper:]' '[:lower:]'`
if ( [[ ${CLEANUP} == of* ]] || [[ ${CLEANUP} == n* ]] ); then
CLEANUP="off"
echo " * Don't clean up intermediate build files"
elif ( [[ ${CLEANUP} == on ]] || [[ ${CLEANUP} == y* ]] ); then
CLEANUP="on"
echo " * Clean up intermediate build files"
else
echo " "
echo "ERROR: Unknown option for clean up: ${CLEANUP}"
confhelp
exit 1
fi
KEEPENVASIS=`echo ${KEEPENVASIS} | tr '[:upper:]' '[:lower:]'`
if [[ ${KEEPENVASIS} == f* ]] || [[ ${KEEPENVASIS} == of* ]] || [[ ${KEEPENVASIS} == n* ]]; then
KEEPENVASIS="false"
echo " * Clearing the environment paths LD_LIBRARY_PATH, CPATH"
# We cannot clean PATH, otherwise no programs can be found anymore
export LD_LIBRARY_PATH=""
export CPATH=""
elif [[ ${KEEPENVASIS} == t* ]] || [[ ${KEEPENVASIS} == on ]] || [[ ${KEEPENVASIS} == y* ]]; then
KEEPENVASIS="true"
echo " * Keeping the existing environment paths as is."
else
echo " "
echo "ERROR: Unknown option for keeping the environment or not: ${KEEPENVASIS}"
confhelp
exit 1
fi
echo " "
echo " "
echo "Getting Geant4..."
VER=""
if [ "${TARBALL}" != "" ]; then
# Use given tarball
echo "The given Geant4 tarball is ${TARBALL}"
# Check if it has the correct version:
VER=`echo ${TARBALL} | awk -Fgeant4- '{ print $2 }' | awk -F.t '{ print $1 }'`;
SHORTVER=`echo ${TARBALL} | awk -Fgeant4- '{ print $2 }' | awk -F.t '{ print $1 }' | awk -F.p '{ print $1 }'`;
echo "Version of Geant4 is: ${VER}"
if [[ ${WANTEDVERSION} != "" ]]; then
if [[ ${SHORTVER} != ${WANTEDVERSION} ]]; then
echo "ERROR: You stated you want version ${WANTEDVERSION} but the tar ball has version ${SHORTVER}!"
exit 1
fi
else
${SETUPPATH}/check-geant4version.sh --good-version=${VER}
if [ "$?" != "0" ]; then
echo "ERROR: The Geant4 tarball you supplied does not contain an acceptable Geant4 version!"
exit 1
fi
fi
else
# Download it
if [[ ${WANTEDVERSION} == "" ]]; then
# Get desired version:
WANTEDVERSION=`${SETUPPATH}/check-geant4version.sh --get-max`
if [ "$?" != "0" ]; then
echo "ERROR: Unable to determine required Geant4 version!"
exit 1
fi
fi
echo "Looking for Geant4 version ${WANTEDVERSION} with latest patch on the Geant4 website --- sometimes this takes a few minutes..."
# Now check Geant4 repository for the given version:
TARBALL=""
for s in `seq 0 10`; do
TESTTARBALL="geant4-v${WANTEDVERSION}.${s}.tar.gz"
echo "Trying to find ${TESTTARBALL}..."
EXISTS=`curl -s --head ${WEBSITE}/${TESTTARBALL} | grep gzip`
if [ "${EXISTS}" == "" ]; then
break
fi
TARBALL=${TESTTARBALL}
done
if [ "${TARBALL}" == "" ]; then
echo "ERROR: Unable to find suitable Geant4 tar ball at the Geant4 website"
exit 1
fi
echo "Using Geant4 tar ball ${TARBALL}"
# Check if it already exists locally
REQUIREDOWNLOAD="true"
if [ -f ${TARBALL} ]; then
# ... and has the same size
LOCALSIZE=`wc -c < ${TARBALL} | tr -d ' '`
SAMESIZE=`curl -s --head ${WEBSITE}/${TARBALL}`
if [ "$?" != "0" ]; then
echo "ERROR: Unable to determine remote tarball size"
exit 1
fi
SAMESIZE=`echo ${SAMESIZE} | grep ${LOCALSIZE}`
if [ "${SAMESIZE}" != "" ]; then
REQUIREDOWNLOAD="false"
echo "File is already present and has same size, thus no download required!"
fi
fi
if [ "${REQUIREDOWNLOAD}" == "true" ]; then
echo "Starting the download."
echo "If the download fails, you can continue it via the following command and then call this script again - it will use the download file."
echo " "
echo "curl -O -C - ${WEBSITE}/${TARBALL}"
echo " "
curl -O ${WEBSITE}/${TARBALL}
if [ "$?" != "0" ]; then
echo "ERROR: Unable to download the tarball from the Geant4 website!"
exit 1
fi
fi
VER=`echo ${TARBALL} | awk -Fgeant4. '{ print $2 }' | awk -F.t '{ print $1 }'`;
if [ "$?" != "0" ]; then
echo "ERROR: Something went wrong during determining the Geant4 version"
exit 1
fi
echo "Version of Geant4 is: ${VER}"
fi
GEANT4CORE=geant4_${VER}
GEANT4DIR=geant4_${VER}${DEBUGSTRING}
GEANT4SOURCEDIR=geant4_${VER}-source # Attention: the cleanup checks this name pattern before removing it
GEANT4BUILDDIR=geant4_${VER}-build # Attention: the cleanup checks this name pattern before removing it
# Hardcoding default patch conditions
# Needs to be done after the Geant4 version is known and before we check the exiting installation
if [[ ${GEANT4CORE} == "geant4_v10.02.p03" ]]; then
PATCH="on"
echo "This version of Geant4 version requires a mandatory patch"
fi
echo "Checking for old installation..."
if [ -d ${GEANT4DIR} ]; then
cd ${GEANT4DIR}
if [ -f COMPILE_SUCCESSFUL ]; then
SAMEOPTIONS=`cat COMPILE_SUCCESSFUL | grep -F -x -- "${CONFIGUREOPTIONS}"`
if [ "${SAMEOPTIONS}" == "" ]; then
echo "The old installation used different compilation options..."
fi
SAMECOMPILER=`cat COMPILE_SUCCESSFUL | grep -F -x -- "${COMPILEROPTIONS}"`
if [ "${SAMECOMPILER}" == "" ]; then
echo "The old installation used a different compiler..."
fi
SAMEPATCH=""
PATCHPRESENT="no"
if [ -f "${SETUPPATH}/patches/${GEANT4CORE}.patch" ]; then
PATCHPRESENT="yes"
PATCHPRESENTMD5=`openssl md5 "${SETUPPATH}/patches/${GEANT4CORE}.patch" | awk -F" " '{ print $2 }'`
fi
PATCHSTATUS=`cat COMPILE_SUCCESSFUL | grep -- "^Patch"`
if [[ ${PATCHSTATUS} == Patch\ applied* ]]; then
PATCHMD5=`echo ${PATCHSTATUS} | awk -F" " '{ print $3 }'`
fi
if [[ ${PATCH} == on ]]; then
if [[ ${PATCHPRESENT} == yes ]] && [[ ${PATCHSTATUS} == Patch\ applied* ]] && [[ ${PATCHPRESENTMD5} == ${PATCHMD5} ]]; then
SAMEPATCH="YES";
elif [[ ${PATCHPRESENT} == no ]] && [[ ${PATCHSTATUS} == Patch\ not\ applied* ]]; then
SAMEPATCH="YES";
else
echo "The old installation didn't use the same patch..."
SAMEPATCH=""
fi
elif [[ ${PATCH} == off ]]; then
if [[ ${PATCHSTATUS} == Patch\ not\ applied* ]] || [[ -z ${PATCHSTATUS} ]]; then # last one means empty
SAMEPATCH="YES";
else
echo "The old installation used a patch, but now we don't want any..."
SAMEPATCH=""
fi
fi
if ( [ "${SAMEOPTIONS}" != "" ] && [ "${SAMECOMPILER}" != "" ] && [ "${SAMEPATCH}" != "" ] ); then
echo "You already have a usable Geant4 version installed!"
if [ "${ENVFILE}" != "" ]; then
echo "Storing the Geant4 directory in the source script..."
echo "GEANT4DIR=`pwd`" >> ${ENVFILE}
fi
exit 0
fi
fi
echo "Old installation is either incompatible or incomplete. Removing ${GEANT4DIR}..."
cd ..
if echo "${GEANT4DIR}" | grep -E '[ "]' >/dev/null; then
echo "ERROR: Feeding my paranoia of having a \"rm -r\" in a script:"
echo " There should not be any spaces in the Geant4 version..."
exit 1
fi
rm -rf "${GEANT4DIR}"
fi
echo "Unpacking..."
mkdir ${GEANT4DIR}
cd ${GEANT4DIR}
if ( [[ ${TARBALL} == *.tgz ]] || [[ ${TARBALL} == *.tar.gz ]] ); then
tar xfz ../${TARBALL} > /dev/null
elif [[ $1 == *.tar ]] ; then
tar xf ../${TARBALL} > /dev/null
else
echo "ERROR: File has unknown suffix: $1 (known: tgz, tar.gz, tar)"
exit 1
fi
if [ "$?" != "0" ]; then
echo "ERROR: Something went wrong unpacking the Geant4 tarball!"
exit 1
fi
mv geant4-${VER} ${GEANT4SOURCEDIR}
mkdir ${GEANT4BUILDDIR}
PATCHAPPLIED="Patch not applied"
if [[ ${PATCH} == on ]]; then
echo "Patching... "
if [[ -f "${SETUPPATH}/patches/${GEANT4CORE}.patch" ]]; then
patch -p1 < ${SETUPPATH}/patches/${GEANT4CORE}.patch
PATCHMD5=`openssl md5 "${SETUPPATH}/patches/${GEANT4CORE}.patch" | awk -F" " '{ print $2 }'`
PATCHAPPLIED="Patch applied ${PATCHMD5}"
echo "Applied patch: ${SETUPPATH}/patches/${GEANT4CORE}.patch"
else
echo "No required patch found for this version of Geant4"
fi
fi
echo "Configuring ..."
cd ${GEANT4BUILDDIR}
echo "Configure command: cmake ${CONFIGUREOPTIONS} ${DEBUGOPTIONS} ../${GEANT4SOURCEDIR}"
cmake ${CONFIGUREOPTIONS} -DCMAKE_CXX_FLAGS="${NOWARNINGS}" ${DEBUGOPTIONS} ../${GEANT4SOURCEDIR}
if [ "$?" != "0" ]; then
echo "ERROR: Something went wrong configuring (cmake'ing) Geant4!"
exit 1
fi
CORES=1;
if [[ ${OSTYPE} == *arwin* ]]; then
CORES=`sysctl -n hw.logicalcpu_max`
elif [[ ${OSTYPE} == linux* ]]; then
CORES=`grep processor /proc/cpuinfo | wc -l`
fi
if [ "$?" != "0" ]; then
CORES=1
fi
if [ "${CORES}" -gt "${MAXTHREADS}" ]; then
CORES=${MAXTHREADS}
fi
echo "Using this number of cores: ${CORES}"
echo "Compiling..."
make -j${CORES}
if [ "$?" != "0" ]; then
echo "ERROR: Something went wrong while compiling Geant4!"
exit 1
fi
echo "Installing..."
make install
if [ "$?" != "0" ]; then
echo "ERROR: Something went wrong while installing Geant4!"
exit 1
fi
# Done. Switch to main GEANT4 directory
cd ..
if [[ ${CLEANUP} == on ]]; then
echo "Cleaning up ..."
# Just a sanity check before our remove...
if [[ ${GEANT4BUILDDIR} == geant4_v*-build ]]; then
rm -rf ${GEANT4BUILDDIR}
if [ "$?" != "0" ]; then
echo "ERROR: Unable to remove buuld directory!"
exit 1
fi
else
echo "INFO: Not cleaning up the build directory, because it is not named as expected: ${GEANT4BUILDDIR}"
fi
if [[ ${GEANT4SOURCEDIR} == geant4_v*-source ]]; then
rm -rf ${GEANT4SOURCEDIR}
if [ "$?" != "0" ]; then
echo "ERROR: Unable to remove source directory!"
exit 1
fi
else
echo "INFO: Not cleaning up the source directory, because it is not named as expected: ${GEANT4SOURCEDIR}"
fi
fi
echo "Store our success story..."
rm -f COMPILE_SUCCESSFUL
echo "Geant4 compilation & installation successful" >> COMPILE_SUCCESSFUL
echo " " >> COMPILE_SUCCESSFUL
echo "* Configure options:" >> COMPILE_SUCCESSFUL
echo "${CONFIGUREOPTIONS}" >> COMPILE_SUCCESSFUL
echo " " >> COMPILE_SUCCESSFUL
echo "* Compile options:" >> COMPILE_SUCCESSFUL
echo "${COMPILEROPTIONS}" >> COMPILE_SUCCESSFUL
echo " " >> COMPILE_SUCCESSFUL
echo "* Patch application status:" >> COMPILE_SUCCESSFUL
echo "${PATCHAPPLIED}" >> COMPILE_SUCCESSFUL
echo " " >> COMPILE_SUCCESSFUL
echo "Setting permissions..."
cd ..
chown -R ${USER}:${GROUP} ${GEANT4DIR}
chmod -R go+rX ${GEANT4DIR}
if [ "${ENVFILE}" != "" ]; then
echo "Storing the Geant4 directory in the source script..."
echo "GEANT4DIR=`pwd`/${GEANT4DIR}" >> ${ENVFILE}
fi
echo "SUCCESS!"
exit 0