-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
getDepsUnix.sh
executable file
·277 lines (252 loc) · 6.98 KB
/
getDepsUnix.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
#!/bin/bash
# this tries to download all project requirements and builds/installs them for you
# get to the root directory of the launcher
cd ../..
if [ ! -d "depbuild" ]; then
echo "Creating depbuild dir"
mkdir depbuild
fi
echo "Changing pwd to ./depbuild"
cd depbuild
echo "Checking for needed downloads"
# even if we have the binary, doesn't mean we have the header
#if ! type "openssl" > /dev/null; then
# if we don't have the file get it
if [ ! -f "openssl-1.1.1.tar.gz" ]; then
curl -L https://www.openssl.org/source/openssl-1.1.1.tar.gz > openssl-1.1.1.tar.gz
fi
#fi
# if we don't have boost tarball get it
if [ ! -f "boost_1_69_0.tar.bz2" ]; then
curl -L https://sourceforge.net/projects/boost/files/boost/1.69.0/boost_1_69_0.tar.bz2 > boost_1_69_0.tar.bz2
fi
# may not need this one
# if we don't have zeromq tarball get it
if [ ! -f "zeromq-4.2.5.tar.gz" ]; then
curl -L https://github.com/zeromq/libzmq/releases/download/v4.2.5/zeromq-4.2.5.tar.gz > zeromq-4.2.5.tar.gz
fi
# if we don't have zmqc++ tarball get it
if [ ! -f "v4.3.0.tar.gz" ]; then
curl -L https://github.com/zeromq/cppzmq/archive/v4.3.0.tar.gz > v4.3.0.tar.gz
fi
# if we don't have openpgm tarball get it
if [ ! -f "libpgm-5.2.122.tar.bz2" ]; then
curl -L https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/openpgm/libpgm-5.2.122.tar.bz2 > libpgm-5.2.122.tar.bz2
fi
# if we don't have libexpat tarball get it
if [ ! -f "expat-2.2.6.tar.bz2" ]; then
curl -L https://github.com/libexpat/libexpat/releases/download/R_2_2_6/expat-2.2.6.tar.bz2 > expat-2.2.6.tar.bz2
fi
# if we don't have unbound tarball get it
if [ ! -f "unbound-1.8.1.tar.gz" ]; then
curl -L https://nlnetlabs.nl/downloads/unbound/unbound-1.8.1.tar.gz > unbound-1.8.1.tar.gz
fi
# if we don't have libsoidum tarball get it
if [ ! -f "libsodium-1.0.16.tar.gz" ]; then
curl -L https://github.com/jedisct1/libsodium/releases/download/1.0.16/libsodium-1.0.16.tar.gz > libsodium-1.0.16.tar.gz
fi
echo "Extracing needed files"
#isGnuTar=$(tar --version | grep -q 'gnu')
#if [ $? -eq 0 ]
#then
# echo "Detected GNU tar"
#else
# echo "Detected BSD tar"
#fi
#if ! type "openssl" > /dev/null; then
# if we have openssl tarball
if [ -f "openssl-1.1.1.tar.gz" ]; then
# if we haven't extracted it yet
if [ ! -d "openssl-1.1.1" ]; then
echo "Extracing OpenSSL"
tar zxf openssl-1.1.1.tar.gz
fi
fi
#fi
# if we have boost tarball
if [ -f "boost_1_69_0.tar.bz2" ]; then
# if we haven't extracted it yet
if [ ! -d "boost_1_69_0" ]; then
echo "Extracing Boost"
tar jxf boost_1_69_0.tar.bz2
fi
fi
# if we have zeromq tarball
if [ -f "zeromq-4.2.5.tar.gz" ]; then
# if we haven't extracted it yet
if [ ! -d "zeromq-4.2.5" ]; then
echo "Extracing ZeroMQ"
tar zxf zeromq-4.2.5.tar.gz
fi
fi
if [ -f "v4.3.0.tar.gz" ]; then
# if we haven't extracted it yet
if [ ! -d "cppzmq-4.3.0" ]; then
echo "Extracing ZMQ C++"
tar zxf v4.3.0.tar.gz
fi
fi
# if we have openpgm tarball
if [ -f "libpgm-5.2.122.tar.bz2" ]; then
# if we haven't extracted it yet
if [ ! -d "libpgm-5.2.122" ]; then
echo "Extracing LibPGM"
tar jxf libpgm-5.2.122.tar.bz2
fi
fi
# if we have libexpat tarball
if [ -f "expat-2.2.6.tar.bz2" ]; then
# if we haven't extracted it yet
if [ ! -d "expat-2.2.6" ]; then
echo "Extracing LibExpat"
tar jxf expat-2.2.6.tar.bz2
fi
fi
# if we have unbound tarball
if [ -f "unbound-1.8.1.tar.gz" ]; then
# if we haven't extracted it yet
if [ ! -d "unbound-1.8.1" ]; then
echo "Extracing Unbound"
tar zxf unbound-1.8.1.tar.gz
fi
fi
# if we have libsoidum tarball
if [ -f "libsodium-1.0.16.tar.gz" ]; then
# if we haven't extracted it yet
if [ ! -d "libsodium-1.0.16" ]; then
echo "Extracing LibSodium"
tar zxf libsodium-1.0.16.tar.gz
fi
fi
physicalCpuCount=$([[ $(uname) = 'Darwin' ]] &&
sysctl -n hw.physicalcpu_max ||
lscpu -p | egrep -v '^#' | sort -u -t, -k 2,4 | wc -l)
echo "Detected for $physicalCpuCount physical CPU cores"
echo "Configuring, Building and Installing packages"
if [ -d "openssl-1.1.1" ]; then
cd openssl-1.1.1
if [ ! -f "Makefile" ]; then
echo "Configuring OpenSSL"
./config
fi
if [ ! -f "apps/openssl" ]; then
echo "Building OpenSSL"
make -j$physicalCpuCount
fi
if [ ! -f "/usr/local/bin/openssl" ]; then
echo "Installing OpenSSL"
sudo make install
fi
cd ..
fi
if [ -d "boost_1_69_0" ]; then
cd boost_1_69_0
if [ ! -f "b2" ]; then
echo "Configuring Boost"
./bootstrap.sh
fi
if [ ! -d "bin.v2" ]; then
echo "Building and installing Boost"
sudo ./b2
fi
cd ..
fi
if [ -d "zeromq-4.2.5" ]; then
cd zeromq-4.2.5
if [ ! -f "Makefile" ]; then
echo "Configuring ZeroMQ"
./configure
fi
if [ ! -f "tools/curve_keygen" ]; then
echo "Building ZeroMQ"
make -j$physicalCpuCount
fi
if [ ! -f "/usr/local/bin/curve_keygen" ]; then
echo "Installing ZeroMQ"
sudo make install
fi
cd ..
fi
if [ -d "cppzmq-4.3.0" ]; then
cd cppzmq-4.3.0
if [ ! -f "Makefile" ]; then
echo "Configuring ZMQ C++"
cmake .
fi
if [ ! -f "bin/unit_tests" ]; then
echo "Building ZMQ C++"
make -j$physicalCpuCount
fi
if [ ! -f "/usr/local/include/zmq.hpp" ]; then
echo "Installing ZMQ C++"
sudo make install
fi
cd ..
fi
if [ -d "libpgm-5.2.122" ]; then
cd libpgm-5.2.122/openpgm/pgm
if [ ! -f "Makefile" ]; then
echo "Configuring OpenPGM"
./configure
fi
if [ ! -f "libpgm.la" ]; then
echo "Building OpenPGM"
make -j$physicalCpuCount
fi
if [ ! -f "/usr/local/lib/libpgm.la" ]; then
echo "Installing OpenPGM"
sudo make install
fi
cd ../../..
fi
if [ -d "expat-2.2.6" ]; then
cd expat-2.2.6
if [ ! -f "Makefile" ]; then
echo "Configuring LibExpat"
./configure
fi
if [ ! -f "lib/.libs/libexpat.a" ]; then
echo "Building LibExpat"
make -j$physicalCpuCount
fi
if [ ! -f "/usr/local/lib/libexpat.a" ]; then
echo "Installing LibExpat"
sudo make install
fi
cd ..
fi
# needs libexpat
if [ -d "unbound-1.8.1" ]; then
cd unbound-1.8.1
if [ ! -f "Makefile" ]; then
echo "Configuring Unbound"
./configure
fi
if [ ! -f ".libs/libunbound.a" ]; then
echo "Building Unbound"
make -j$physicalCpuCount
fi
if [ ! -f "/usr/local/lib/libunbound.a" ]; then
echo "Installing Unbound"
sudo make install
fi
cd ..
fi
if [ -d "libsodium-1.0.16" ]; then
cd libsodium-1.0.16
if [ ! -f "Makefile" ]; then
echo "Configuring LibSodium"
./configure
fi
if [ ! -f "src/libsodium/libsodium.la" ]; then
echo "Building LibSodium"
make -j$physicalCpuCount
fi
if [ ! -f "/usr/local/lib/libsodium.a" ]; then
echo "Installing LibSodium"
sudo make install
fi
cd ..
fi
echo "Done, restoring pwd"
cd ..