-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·312 lines (289 loc) · 7.19 KB
/
bootstrap.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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
#!/bin/bash
#
# This is an easy-bake script to download and build all SCR's external
# dependencies. The dependencies will be build in scr/deps/ and
# installed to scr/install/
#
# Optional flags:
# --ssh clone dependency repos with git ssh instead of https
# --debug compiles dependencies with full debug "-g -O0"
# --opt compiles dependencies with optimization (non-debug)
# --dev builds each dependency from its latest commit
# --tag builds each dependency from a hardcoded tag
# --clean deletes deps and install directories before build
# --verbose build with VERBOSE=1 flag set to capture more build output
# --static build static libraries instead of shared libraries
#
set -x
echo "CC is ${CC}"
echo "CXX is ${CXX}"
# optional builds
clone_ssh=0 # whether to clone with https (0) or ssh (1)
build_debug=0 # whether to build optimized (0) or debug "-g -O0" (1)
build_dev=1 # whether to checkout fixed version tags (0) or use latest (1)
build_clean=0 # whether to keep deps directory (0) or delete and recreate (1)
make_verbose="" # whether to run make with "VERBOSE=1" or not
shared_flags="-DBUILD_SHARED_LIBS=ON"
while [ $# -ge 1 ]; do
case "$1" in
"--ssh" )
clone_ssh=1 ;;
"--debug" )
build_debug=1 ;;
"--opt" )
build_debug=0 ;;
"--dev" )
build_dev=1 ;;
"--tag" )
build_dev=0 ;;
"--clean" )
build_clean=1 ;;
"--verbose" )
make_verbose="VERBOSE=1" ;;
"--static" )
shared_flags="-DBUILD_SHARED_LIBS=OFF" ;;
*)
echo "USAGE ERROR: unknown option $1"
exit 1 ;;
esac
shift
done
ROOT="$(pwd)"
INSTALL_DIR=$ROOT/install
# whether to build optimized or "-g -O0" debug
buildtype="Release"
if [ $build_debug -eq 1 ] ; then
buildtype="Debug"
fi
if [ $build_clean -eq 1 ] ; then
rm -rf deps
rm -rf install
fi
mkdir -p deps
mkdir -p install
cd deps
lwgrp=lwgrp-1.0.5
dtcmp=dtcmp-1.1.4
pdsh=pdsh-2.34
if [ ! -f ${lwgrp}.tar.gz ] ; then
wget https://github.com/LLNL/lwgrp/releases/download/v1.0.5/${lwgrp}.tar.gz
fi
if [ ! -f ${dtcmp}.tar.gz ] ; then
wget https://github.com/LLNL/dtcmp/releases/download/v1.1.4/${dtcmp}.tar.gz
fi
if [ ! -f ${pdsh}.tar.gz ] ; then
wget https://github.com/chaos/pdsh/releases/download/${pdsh}/${pdsh}.tar.gz
fi
if [ $clone_ssh -eq 0 ] ; then
# clone with https
url_prefix="https://github.com/"
else
# clone with ssh (requires user to have their ssh keys registered on github)
url_prefix="[email protected]:"
fi
repos=(${url_prefix}ECP-VeloC/KVTree.git
${url_prefix}ECP-VeloC/AXL.git
${url_prefix}ECP-VeloC/spath.git
${url_prefix}ECP-VeloC/rankstr.git
${url_prefix}ECP-VeloC/redset.git
${url_prefix}ECP-VeloC/shuffile.git
${url_prefix}ECP-VeloC/er.git
)
for i in "${repos[@]}" ; do
# Get just the name of the project (like "KVTree")
name=$(basename $i | sed 's/\.git//g')
if [ -d $name ] ; then
echo "$name already exists, skipping it"
else
git clone $i
fi
done
rm -rf ${lwgrp}
tar -zxf ${lwgrp}.tar.gz
pushd ${lwgrp}
./configure \
--prefix=${INSTALL_DIR} && \
make ${make_verbose} && \
make ${make_verbose} install
if [ $? -ne 0 ]; then
echo "failed to configure, build, or install liblwgrp"
exit 1
fi
popd
rm -rf ${dtcmp}
tar -zxf ${dtcmp}.tar.gz
pushd ${dtcmp}
./configure \
--prefix=${INSTALL_DIR} \
--with-lwgrp=${INSTALL_DIR} && \
make ${make_verbose} && \
make ${make_verbose} install
if [ $? -ne 0 ]; then
echo "failed to configure, build, or install libdtcmp"
exit 1
fi
popd
rm -rf ${pdsh}
tar -zxf ${pdsh}.tar.gz
pushd ${pdsh}
./configure --prefix=$INSTALL_DIR && \
make ${make_verbose} && \
make ${make_verbose} install
if [ $? -ne 0 ]; then
echo "failed to configure, build, or install pdsh"
exit 1
fi
popd
pushd KVTree
if [ $build_dev -eq 0 ] ; then
git checkout v1.3.0
fi
rm -rf build
mkdir -p build
pushd build
cmake \
${shared_flags} \
-DCMAKE_BUILD_TYPE=$buildtype \
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \
-DMPI=ON \
.. && \
make ${make_verbose} -j `nproc` && \
make ${make_verbose} install
if [ $? -ne 0 ]; then
echo "failed to configure, build, or install kvtree"
exit 1
fi
popd
popd
pushd AXL
if [ $build_dev -eq 0 ] ; then
git checkout v0.6.0
fi
rm -rf build
mkdir -p build
pushd build
cmake \
${shared_flags} \
-DCMAKE_BUILD_TYPE=$buildtype \
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \
-DMPI=ON \
.. && \
make ${make_verbose} -j `nproc` && \
make ${make_verbose} install
if [ $? -ne 0 ]; then
echo "failed to configure, build, or install axl"
exit 1
fi
popd
popd
pushd spath
if [ $build_dev -eq 0 ] ; then
git checkout v0.2.0
fi
rm -rf build
mkdir -p build
pushd build
cmake \
${shared_flags} \
-DCMAKE_BUILD_TYPE=$buildtype \
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \
-DMPI=ON \
.. && \
make ${make_verbose} -j `nproc` && \
make ${make_verbose} install
if [ $? -ne 0 ]; then
echo "failed to configure, build, or install spath"
exit 1
fi
popd
popd
pushd rankstr
if [ $build_dev -eq 0 ] ; then
git checkout v0.2.0
fi
rm -rf build
mkdir -p build
pushd build
cmake \
${shared_flags} \
-DCMAKE_BUILD_TYPE=$buildtype \
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \
.. && \
make ${make_verbose} -j `nproc` && \
make ${make_verbose} install
if [ $? -ne 0 ]; then
echo "failed to configure, build, or install rankstr"
exit 1
fi
popd
popd
pushd redset
if [ $build_dev -eq 0 ] ; then
git checkout v0.2.0
fi
rm -rf build
mkdir -p build
pushd build
cmake \
${shared_flags} \
-DCMAKE_BUILD_TYPE=$buildtype \
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \
.. && \
make ${make_verbose} -j `nproc` && \
make ${make_verbose} install
if [ $? -ne 0 ]; then
echo "failed to configure, build, or install redset"
exit 1
fi
popd
popd
pushd shuffile
if [ $build_dev -eq 0 ] ; then
git checkout v0.2.0
fi
rm -rf build
mkdir -p build
pushd build
cmake \
${shared_flags} \
-DCMAKE_BUILD_TYPE=$buildtype \
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \
.. && \
make ${make_verbose} -j `nproc` && \
make ${make_verbose} install
if [ $? -ne 0 ]; then
echo "failed to configure, build, or install shuffile"
exit 1
fi
popd
popd
pushd er
if [ $build_dev -eq 0 ] ; then
git checkout v0.2.0
fi
rm -rf build
mkdir -p build
pushd build
cmake \
${shared_flags} \
-DCMAKE_BUILD_TYPE=$buildtype \
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \
.. && \
make ${make_verbose} -j `nproc` && \
make ${make_verbose} install
if [ $? -ne 0 ]; then
echo "failed to configure, build, or install er"
exit 1
fi
popd
popd
set +x
cd "$ROOT"
mkdir -p build
echo "*************************************************************************"
echo "Dependencies are all built. You can now build SCR with:"
echo ""
echo " mkdir -p build && cd build"
echo " cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR .."
echo " make && make install"
echo "*************************************************************************"