-
Notifications
You must be signed in to change notification settings - Fork 19
/
init_x86_64.sh
94 lines (83 loc) · 2.69 KB
/
init_x86_64.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
#!/bin/bash
# Determine which OS you are using
if [ "$(uname)" = "Linux" ]; then
if [ "$( cat /etc/*-release | grep "CentOS Linux 7" )" ]; then
echo "Detected CentOS Linux 7"
OS=centos7
elif [ "$( cat /etc/*-release | grep "CentOS Linux 8" )" ] || [ "$( cat /etc/*-release | grep "CentOS Stream release 8" )" ]; then
echo "Detected CentOS Linux 8"
OS=centos8
else
echo "Cannot detect OS, falling back to CentOS7"
OS=centos7
fi
elif [ "$(uname)" = "Darwin" ]; then
MACOS_MAJOR=$(sw_vers -productVersion | awk -F '.' '{print $1}')
MACOS_MINOR=$(sw_vers -productVersion | awk -F '.' '{print $2}')
if [ $MACOS_MAJOR = "11" ]; then
OS=mac11
elif [ "${MACOS_MAJOR}.${MACOS_MINOR}" = "10.15" ]; then
OS=mac1015
else
echo "Unsupported version of macOS ${MACOS_MAJOR}.${MACOS_MINOR}"
exit 1
fi
else
echo "Unknown OS"
exit 1
fi
# Determine is you have CVMFS installed
CVMFS_MOUNT=""
if [ "$OS" = mac1015 ] || [ "$OS" = mac11 ] ; then
CVMFS_MOUNT="/Users/Shared"
fi
if [ ! -d "${CVMFS_MOUNT}/cvmfs" ]; then
echo "No CVMFS detected, please install it. Looking at ${CVMFS_MOUNT}/cvmfs"
exit 1
fi
# Determine which LCG version to use
DEFAULT_LCG="LCG_101"
if [ -z ${RES_LCG_VERSION} ]; then
echo "No explicit LCG version set, using ${DEFAULT_LCG}."
RES_LCG_VERSION=${DEFAULT_LCG}
fi
# Determine which compiler to use
if [ -z ${COMPILER_TYPE} ]; then
if [ "$(uname)" = "Darwin" ]; then
COMPILER_TYPE="llvm"
echo "No compiler type set, falling back to AppleClang."
else
echo "No compiler type set, falling back to GCC."
COMPILER_TYPE="gcc"
fi
fi
if [ ${COMPILER_TYPE} = "gcc" ]; then
COMPILER_VERSION="gcc11"
echo "Compiler type set to GCC, version ${COMPILER_VERSION}."
fi
if [ ${COMPILER_TYPE} = "llvm" ]; then
if [ "$(uname)" = "Darwin" ]; then
COMPILER_VERSION="clang120"
else
COMPILER_VERSION="clang12"
fi
echo "Compiler type set to LLVM, version ${COMPILER_VERSION}."
fi
# Choose build type
if [ -z ${BUILD_TYPE} ]; then
BUILD_TYPE=opt
fi
# General variables
SFTREPO=${CVMFS_MOUNT}/cvmfs/sft.cern.ch
export BUILD_FLAVOUR=x86_64-${OS}-${COMPILER_VERSION}-${BUILD_TYPE}
#--------------------------------------------------------------------------------
# Source dependencies
#--------------------------------------------------------------------------------
export LCG_VIEW=${SFTREPO}/lcg/views/${RES_LCG_VERSION}/${BUILD_FLAVOUR}/setup.sh
source ${LCG_VIEW} || echo "yes"
if [ -n "${CI}" ] && [ "$(uname)" = "Darwin" ]; then
source $ROOTSYS/bin/thisroot.sh
cd $G4INSTALL/bin/
source geant4.sh
cd -
fi