-
Notifications
You must be signed in to change notification settings - Fork 87
/
setup.sh
executable file
·262 lines (213 loc) · 6.06 KB
/
setup.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
#!/bin/sh
if [ "`which git`" == "" ]; then
echo "git command line tool is not found. Either re-install and make sure its added to your path environment variable.";
exit 1;
fi
if [ "`which ninja`" == "" ]; then
echo "ninja build system is not found. Attemping to install.";
if [ ! -d "install-tools" ]; then
mkdir install-tools
fi
cd install-tools
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=`pwd`/depot_tools:"$PATH"
if [ "`grep depot_tools ~/.profile`" == "" ]; then
echo "export PATH=\"`pwd`/depot_tools:\$PATH\"" >> ~/.profile
fi
if [ "`grep depot_tools ~/.bashrc`" == "" ]; then
echo "export PATH=\"`pwd`/depot_tools:\$PATH\"" >> ~/.bashrc
fi
cd ..
if [ "`which ninja`" == "" ]; then
echo "Even after install we cannot find ninja build tool. Check the log above for errors."
exit 1
fi
fi
if [ "`which gcc`" == "" ]; then
echo "Command tools such as clang are not available, attempting to install universally."
if [ "$(uname)" == "Darwin" ]; then
xcode-select --install
echo "Complete the GUI installation then restart this program."
exit 1;
fi
if [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
#Update the package lists
sudo apt-get update
# Install *gcc* (and related dependencies)
sudo apt-get install build-essential
# Install cmake
sudo apt-get install cmake
# Install Python
sudo apt-get install python2.7
# Install node.js
sudo apt-get install nodejs
# Install Java
sudo apt-get install default-jre
fi
if [ "`which gcc`" == "" ]; then
echo "Even after installing command line tools were still unable to find the build essentials, see output log above."
exit 1
fi
fi
if [ "`which python2`" == "" ]; then
echo "Python 2 isn't correctly linked, attempting to link it if found, or install globally."
if [ "$(uname)" == "Darwin" ]; then
if [ ! -f "/usr/bin/python" ]; then
sudo ln /usr/bin/python2.7 /usr/bin/python
fi
if [ ! -f "/usr/bin/python2" ]; then
sudo ln /usr/bin/python2.7 /usr/bin/python2
fi
if [ ! -f "/usr/bin/python22.7" ]; then
sudo ln /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 /usr/bin/python22.7
fi
fi
if [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
# Install Python
sudo apt-get install python2.7
fi
if [ "`which python2`" == "" ]; then
echo "Even after installing python we cannot find python2 command line. See log from above."
exit 1
fi
fi
if [ "$EMSCRIPTEN" == "" ]; then
echo "Cannot find esmcripten path. Attemping to install it into install-tools"
if [ ! -d "install-tools" ]; then
mkdir install-tools
fi
cd install-tools
curl -OL https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz
tar -xzf emsdk-portable.tar.gz
cd emsdk-portable
./emsdk update
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
cd ..
if [ "`grep emsdk_env ~/.profile`" == "" ]; then
echo "source `pwd`/emsdk-portable/emsdk_env.sh" >> ~/.profile
fi
if [ "`grep emsdk_env ~/.bashrc`" == "" ]; then
echo "source `pwd`/emsdk-portable/emsdk_env.sh" >> ~/.bashrc
fi
cd ..
fi
if [ "`which autoconf`" == "" ]; then
echo "Attemping to install autoconf."
if [ ! -d "install-tools" ]; then
mkdir install-tools
fi
cd install-tools
curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-2.69.tar.gz
tar -xzf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure && make && sudo make install
cd ..
curl -OL http://ftpmirror.gnu.org/automake/automake-1.14.tar.gz
tar -xzf automake-1.14.tar.gz
cd automake-1.14
./configure && make && sudo make install
cd ..
curl -OL http://ftpmirror.gnu.org/libtool/libtool-2.4.2.tar.gz
tar -xzf libtool-2.4.2.tar.gz
cd libtool-2.4.2
./configure && make && sudo make install
cd ..
cd ..
if [ "`which autoconf`" == "" ]; then
echo "Even after attempting to install auto conf we cannot find its utility. Check log output."
exit 1
fi
fi
if [ ! -f "$EMSCRIPTEN/system/lib/pkgconfig/glesv2.pc" ]; then
cat <<EOF > $EMSCRIPTEN/system/lib/pkgconfig/glesv2.pc
prefix=
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
sharedlibdir=\${libdir}
includedir=\${prefix}/include
Name: glesv2
Description: OpenGL ES 2.0 library
Version: 2.1.45
Requires:
Libs: -L\${libdir} -L\${sharedlibdir}
Cflags: -I\${includedir}
EOF
fi
if [ ! -f "$EMSCRIPTEN/system/lib/pkgconfig/libpng.pc" ]; then
cat <<EOF > $EMSCRIPTEN/system/lib/pkgconfig/libpng.pc
prefix=
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
sharedlibdir=\${libdir}
includedir=\${prefix}/include
Name: libpng
Description: png library
Version: 1.2.45
Requires:
Libs: -L\${libdir} -L\${sharedlibdir}
Cflags: -I\${includedir}
EOF
fi
if [ ! -f "$EMSCRIPTEN/system/lib/pkgconfig/freetype2.pc" ]; then
cat <<EOF > $EMSCRIPTEN/system/lib/pkgconfig/freetype2.pc
prefix=
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
sharedlibdir=\${libdir}
includedir=\${prefix}/include
Name: freetype2
Description: Freetype library
Version: 1.0.0
Requires:
Libs: -L\${libdir} -L$\{sharedlibdir}
Cflags: -I\${includedir}
EOF
fi
if [ ! -f "$EMSCRIPTEN/system/lib/pkgconfig/egl.pc" ]; then
cat <<EOF > $EMSCRIPTEN/system/lib/pkgconfig/egl.pc
prefix=
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
sharedlibdir=\${libdir}
includedir=\${prefix}/include
Name: egl
Description: EGL library
Version: 1.0.0
Requires:
Libs: -L\${libdir} -L$\{sharedlibdir}
Cflags: -I\${includedir}
EOF
fi
if [ ! -f "$EMSCRIPTEN/system/lib/pkgconfig/zlib.pc" ]; then
cat <<EOF > $EMSCRIPTEN/system/lib/pkgconfig/zlib.pc
prefix=
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
sharedlibdir=${libdir}
includedir=${prefix}/include
Name: zlib
Description: zlib compression library
Version: 1.2.5
Requires:
Libs: -L${libdir} -L${sharedlibdir}
Cflags: -I${includedir}
EOF
fi
if [ ! -f "$EMSCRIPTEN/system/lib/pkgconfig/sdl.pc" ]; then
cat <<EOF > $EMSCRIPTEN/system/lib/pkgconfig/sdl.pc
prefix=
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
sharedlibdir=${libdir}
includedir=${prefix}/include
Name: sdl
Description: Simple DirectMedia Layer
Version: 1.2.12
Requires:
Libs: -L${libdir} -L${sharedlibdir}
Cflags: -I${includedir}
EOF
fi
echo "Install complete"