-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathinstall-fedora.sh
executable file
·284 lines (213 loc) · 8.21 KB
/
install-fedora.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
#!/bin/bash
# TSGL install script for Fedora.
# Last modified: 06/29/16.
#
# -SUBJECT TO CHANGE-
#####################################
echo "Begin installation..."
#This determines whether or not we need to make a symlink
glSymlink=0
#Store the working directory
#(So that we can come back to the TSGL directory easily)
workingDir=$(pwd)
#First, check if g++ is even installed.
gVersCheck=$(g++ --version)
#http://stackoverflow.com/questions/18147884/shell-variable-in-a-grep-regex
#Get a string containing the version number.
gVersString=$(echo "$gVersCheck" | grep "g++ (GCC)")
#http://stackoverflow.com/questions/7516455/sed-extract-version-number-from-string-only-version-without-other-numbers
#http://superuser.com/questions/363865/how-to-extract-a-version-number-using-sed
#Get the version number from the version string.
gVersNum=$(echo "$gVersString" | sed 's/[^0-9.]*\([0-9.]*\).*/\1/')
#http://tldp.org/LDP/abs/html/comparison-ops.html
#Check if the version number is null...
if [ -z "$gVersNum" ]
then
#Yep. g++ is NOT installed.
echo "g++ not installed!"
echo "Installing g++..."
sudo yum install gcc-c++
#Update versioning info
gVersCheck=$(g++ --version)
gVersString=$(echo "$gVersCheck" | grep "g++ (GCC)")
#http://stackoverflow.com/questions/7516455/sed-extract-version-number-from-string-only-version-without-other-numbers
#http://superuser.com/questions/363865/how-to-extract-a-version-number-using-sed
gVersNum=$(echo "$gVersString" | sed 's/[^0-9.]*\([0-9.]*\).*/\1/')
else
echo "g++ already installed."
#No. Check the version.
#Check if it's below the threshold...
if [ "$gVersNum" \< "4.8" ]
then
echo "The version of g++ is: $gVersNum."
echo "You need at least g++ 4.8 or greater in order to continue."
echo "I can install a greater version of g++ for you."
echo "Would you like me to do that? (1 = Yes, 2 = No)"
#Adapted from: http://stackoverflow.com/questions/226703/how-do-i-prompt-for-input-in-a-linux-shell-script
#Get the choice from the user.
select choice in "Yes" "No"; do
case $choice in
Yes ) #Yes, so...
echo "Installing g++ 4.8...."
sudo yum install gcc-c++
#Update version info
gVersCheck=$(g++ --version)
#http://stackoverflow.com/questions/18147884/shell-variable-in-a-grep-regex
gVersString=$(echo "$gVersCheck" | grep "g++ (GCC)")
#http://stackoverflow.com/questions/7516455/sed-extract-version-number-from-string-only-version-without-other-numbers
#http://superuser.com/questions/363865/how-to-extract-a-version-number-using-sed
gVersNum=$(echo "$gVersString" | sed 's/[^0-9.]*\([0-9.]*\).*/\1/')
break;;
No ) #No, use the current version
echo "Cannot continue without g++ 4.8 or greater."
echo "Abort."
exit 1
esac
done
else
#Version number is okay.
echo "g++ version is sufficient to continue."
fi
fi
#Step 2: Install Cmake (because Cmake is up to 3.5.2).
#First, Get dependencies.
sudo yum install libX11-devel libXrandr-devel libXinerama-devel libXcursor-devel mesa-libGLU-devel libXmu-devel libXi-devel libGL-devel glew-devel freetype-devel doxygen
#Now, check the version.
cmakeVersCheck=$(cmake --version)
#http://stackoverflow.com/questions/18147884/shell-variable-in-a-grep-regex
cmakeVersString=$(echo "$cmakeVersCheck" | grep "cmake version ")
#http://stackoverflow.com/questions/7516455/sed-extract-version-number-from-string-only-version-without-other-numbers
#http://superuser.com/questions/363865/how-to-extract-a-version-number-using-sed
cmakeVersNum=$(echo "$cmakeVersString" | sed 's/[^0-9.]*\([0-9.]*\).*/\1/')
#Check if not installed.
if [ -z "$cmakeVersNum" ]
then
echo "Cmake not installed!"
echo "Installing Cmake..."
sudo yum install cmake
#Update versioning info.
cmakeVersCheck=$(cmake --version)
cmakeVersString=$(echo "$cmakeVersCheck" | grep "cmake version ")
cmakeVersNum=$(echo "$cmakeVersString" | sed 's/[^0-9.]*\([0-9.]*\).*/\1/')
else
echo "Cmake already installed."
#http://tldp.org/LDP/abs/html/comparison-ops.html
#Check if the version is less than the threshold
if [ "$cmakeVersNum" \< "3.0" ]
then
echo "The version of Cmake is: $cmakeVersNum."
echo "You need at least Cmake 3.0 or greater in order to continue."
echo "I can install a greater version of Cmake for you."
#Adapted from: http://stackoverflow.com/questions/226703/how-do-i-prompt-for-input-in-a-linux-shell-script
#Get the choice from the user.
echo "Would you like me to do that for you? (1 = Yes, 2 = No)"
select choice in "Yes" "No"; do
case $choice in
Yes ) #Yes, so...
echo "Installing Cmake..."
sudo yum install cmake
#Update the version info.
cmakeVersCheck=$(cmake --version)
cmakeVersString=$(echo "$cmakeVersCheck" | grep "cmake version ")
cmakeVersNum=$(echo "$cmakeVersString" | sed 's/[^0-9.]*\([0-9.]*\).*/\1/')
break;;
No ) #No. Can't use the current version, so abort.
echo "Cannot continue without Cmake 3.0 or greater."
echo "Abort."
exit 1
esac
done
else #Version number is okay.
echo "Cmake version is sufficient to continue."
fi
fi
#GL version checking.
sudo yum install glxinfo
GLVersInfo=$(glxinfo | grep OpenGL)
#http://stackoverflow.com/questions/18147884/shell-variable-in-a-grep-regex
#Get a string containing the version number.
GLVersString=$(echo "$GLVersInfo" | grep "OpenGL version string: ")
#http://stackoverflow.com/questions/7516455/sed-extract-version-number-from-string-only-version-without-other-numbers
#http://superuser.com/questions/363865/how-to-extract-a-version-number-using-sed
#Get the version number from the version string.
GLVersNum=$(echo "$GLVersString" | sed 's/[^0-9.]*\([0-9.]*\).*/\1/')
#http://tldp.org/LDP/abs/html/comparison-ops.html
#Check if the version is less than the threshold
if [ "$GLVersNum" \< "3.2" ]
then
echo "Your version of GL is: $GLVersNum."
echo "You need at least OpenGL version 3.2 or greater."
echo "Please update your drivers in order to continue."
echo "If you have an Nvidia graphics card, you can follow this online tutorial"
echo "in order to update your binary drivers:"
echo
echo "http://rpmfusion.org/Howto/nVidia"
echo
echo "AMD users, here is a possible solution: "
echo
echo "https://bluehatrecord.wordpress.com/2015/09/17/installing-the-proprietary-amd-catalyst-15-9-fglrx-15-201-driver-on-fedora-22-with-linux-kernel-4-1-6/"
echo
echo "We apologize for any inconvienence."
echo "Abort."
exit 1
else
echo "OpenGL version is sufficient to continue."
echo "Did you update your graphics card drivers before installing TSGL? (1 = Yes, 2 = No)"
select choice in "Yes" "No"; do
case $choice in
Yes ) #Yes, so, make a symlink
echo "Making a note of that..."
glSymlink=1
echo "Thanks for telling me!"
break;;
No ) #No, don't have to make a symlink
echo "Thanks for telling me!" break;;
esac
done
fi
#Step 3: Build GLFW from source
echo "Installing GLFW..."
git clone https://www.github.com/glfw/glfw.git
cd glfw
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DBUILD_SHARED_LIBS=ON
make
sudo make install
cd ../
sudo rm -rf glfw/
#Copy over the .so file into lib64/ (so it can be found...)
sudo cp /usr/lib/libglfw.so.3 /usr/lib64
echo "GLFW installed."
#Step 4: Build freetype from source
echo "Installing freetype..."
wget downloads.sourceforge.net/project/freetype/freetype2/2.6.3/freetype-2.6.3.tar.bz2
tar vxfj freetype-2.6.3.tar.bz2
cd freetype-2.6.3
./configure
make
sudo make install
#Go back to the TSGL directory
cd $workingDir
rm -rf freetype*
echo "Freetype installed."
#Make a symlink to GL.so file (so it can be found...)
#(Apparently, after updating the drivers, TSGL CANNOT find -lGL).
#(After doing a bit of research, I found that it's because of a broken symlink...)
#Check if we even need to do a symlink first!
if [ $glSymlink == 1 ]
then
sudo ln -sfn /usr/lib64/libGL.so.1 /usr/lib64/libGL.so
fi
#Edit the LD_LIBRARY_PATH variable
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/include:/usr/lib:/usr/lib:/usr/lib64
#Now, make and install TSGL!
echo "Installing TSGL..."
cd $workingDir
sudo rm -rf /usr/include/TSGL
sudo rm -rf /usr/lib/libtsgl.*
mkdir -p lib bin
make
sudo make install
sudo rm -rf /usr/include/TSGL/*.cpp
sudo ldconfig
echo "Installation complete! Execute the runtests bash script to verify that everything works."
echo