forked from Calvin-CS/TSGL
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-mac
More file actions
executable file
·115 lines (97 loc) · 3.4 KB
/
Copy pathinstall-mac
File metadata and controls
executable file
·115 lines (97 loc) · 3.4 KB
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
#!/bin/bash
# Easy install script for TSGL on OS X
VER_XQ="XQuartz-2.7.7"
VER_MP="MacPorts-2.3.3"
#Function for checking command availability
has () {
(command -v "$1" >/dev/null 2>&1 && echo 1) || echo 0
}
#Needed for some bugs that occurred when we couldn't have permissions to these directory paths
sudo chmod -R 777 /usr/local/Cellar /usr/local /Library/Caches/Homebrew/Formula /usr/local/lib
#Remove any broken symlinks
sudo rm -f /usr/local/lib/libtsgl.*
sudo rm -rf /usr/local/include/TSGL
#Print X11 warning
if [ $(ls /Applications/Utilities | grep XQuartz.app | wc -l) -eq 0 ]; then
echo "Installing X11"
curl -L -O "http://xquartz.macosforge.org/downloads/SL/$VER_XQ.dmg"
open -W "$VER_XQ.dmg"
echo "Please continue the installation process by double-clicking XQuartz.pkg and following the instructions on screen."
echo "Please enter to continue once XQuartz has finished installing."
read
fi
#Install Xcode command line tools (will do nothing if already installed)
if [ ! -e "/Library/Developer/CommandLineTools" ]; then
cmd="xcode-select --install"
$cmd # Fix for vim syntax highlighting bugginess
echo "Please select \"Install\" from the confirmation window that appears, and Agree to the license terms."
echo "Press enter to continue once Xcode command line tools has finished installing"
read
fi
#Install brew
if [ $(has brew) = 0 ]; then
echo "Installing Homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
else
echo "Homebrew detected."
fi
#Install glfw3 (will do nothing if already installed)
echo "Installing GLFW..."
brew install homebrew/versions/glfw3
#Install port
if [ $(has port) = 0 ]; then
echo "Installing Macports..."
curl -O "https://distfiles.macports.org/MacPorts/$VER_MP.tar.bz2"
tar xf "$VER_MP.tar.bz2"
cd "$VER_MP/"
./configure
make
sudo make install
cd ..
else
echo "Macports detected."
fi
#Get port packages
echo "Installing GLEW..."
sudo port install glew
echo "Installing Freetype2..."
sudo port install freetype
gver=$(g++ -v 2>&1 | grep "gcc version" | cut -f 3 -d ' ' | tr -d .)
if [ $gver -lt 490 ]; then
echo "Installing GCC 4.9...this may take a while, please be patient..."
sudo port install gcc49
echo "Switching default compiler to mp-gcc49"
sudo port select --set gcc mp-gcc49
fi
echo "Fixing missing symlinks"
if [ ! -e /usr/X11/lib/libX11.dylib ]; then
sudo ln -s /usr/X11/lib/libX11.6.dylib /usr/X11/lib/libX11.dylib
fi
if [ ! -e /usr/X11/lib/libXrandr.dylib ]; then
sudo ln -s /usr/X11/lib/libXrandr.2.dylib /usr/X11/lib/libXrandr.dylib
fi
if [ -e /usr/lib/libstdc++.dylib ]; then
sudo mv /usr/lib/libstdc++.dylib /usr/lib/libstdc++.dylib-old
fi
if [ ! -e /usr/bin/gcc_tsglbak ]; then
sudo mv /usr/bin/gcc /usr/bin/gcc_tsglbak
sudo ln -s /opt/local/bin/gcc-mp-4.9 /usr/bin/gcc
fi
if [ ! -e /usr/bin/g++_tsglbak ]; then
sudo mv /usr/bin/g++ /usr/bin/g++_tsglbak
sudo ln -s /opt/local/bin/g++-mp-4.9 /usr/bin/g++
fi
#Make TSGL
echo "Making TSGL..."
make -j debug
#Move the necessary lib files needed
cp -R lib/* /usr/local/lib/
#Create the TSGL directory
mkdir /usr/local/include/TSGL
#Move the .h files to their destination
cp -R src/TSGL/*.h /usr/local/include/TSGL
echo
#Reset permissions back to normal
sudo chmod -R 755 /usr/local/Cellar /usr/local /Library/Caches/Homebrew/Formula /usr/local/lib
echo "Installation complete!"
echo "Run \"./runtests\" to verify everything is working."