blob: ed226b7b1ec192263afcc28943e017a56f72b7e4 (
plain) (
blame)
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
|
#!/bin/sh
# Shave and a Haircut
# (c) 2019 Epic Games
# US Patent 6720962
returnVersion=n
returnDTS=n
vray=
while [ "$1" != "" ]; do
if [ "$1" = "-v" ]; then
returnVersion=y
elif [ "$1" == "-dts" ]; then
returnDTS=y
else
vray=$1
fi
shift
done
if [ "${vray}" = "" ]; then
echo "Usage: $0 vrayVersion" >&2
echo "Where vrayVersion is 31, 36, 40, etc"
echo ""
exit
fi
gpp=
utilsDir=`dirname $0`
os=`${utilsDir}/getos.sh`
if [ "${os/.*/}" = "ce6" ]; then
isCentOS6=y
else
isCentOS6=n
fi
case ${os} in
ce*|deb*|fc*|rh*)
gppVerNeeded=
case $vray in
30|31|36)
if [ "${returnDTS}" = "y" ]; then
echo n
exit
fi
gppVerNeeded=4.4.7
;;
40) # On CentOS 6 we need to use DTS for gcc 4.8.2 builds.
if [ "${returnDTS}" = "y" ]; then
echo ${isCentOS6}
exit
fi
if [ ${isCentOS6} = y ]; then
source /opt/rh/devtoolset-2/enable
fi
gppVerNeeded=4.8.2
;;
esac
if [ "${gppVerNeeded}" != "" ]; then
if [ "${returnVersion}" = "y" ]; then
echo ${gppVerNeeded}
exit
fi
# Does the native g++ command give us the correct version?
nativeVer=`g++ -v 2>&1 | grep "gcc version" | sed 's/^[^0-9]*\([0-9.]*\).*$/\1/'`
if [ "${nativeVer}" = "${gppVerNeeded}" ]; then
gpp=g++
else
# Check to see if there is a directory in /opt containing the
# compiler we want.
compressedVer=`echo ${gppVerNeeded} | sed 's/\.//g'`
shortVer=`echo ${gppVerNeeded} | cut -d. -f-2`
if [ -x /opt/gcc${compressedVer}/bin/g++ ]; then
gpp="/opt/gcc${compressedVer}/bin/g++"
elif [ -x /opt/gcc${compressedVer}/bin/g++${compressedVer} ]; then
gpp="/opt/gcc${compressedVer}/bin/g++${compressedVer}"
elif [ -x /usr/bin/g++-${shortVer} ]; then
gpp="/usr/bin/g++-${shortVer}"
fi
fi
fi
;;
osx*)
if [ "${returnDTS}" = "y" ]; then
echo n
exit
fi
# getosxvars.sh sets environment variables which control where we find
# the compiler, so we can just use 'g++' in all cases.
gpp=g++
;;
esac
echo ${gpp}
|