-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall-snet
executable file
·189 lines (159 loc) · 4.58 KB
/
install-snet
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
#!/bin/bash
#
# This script installs PCL, LPEL and S-Net.
# Please set the 3 *_PREFIX environment variables
# to your liking before invoking this script.
#
# Where to install PCL to
export PCL_PREFIX=$PWD/build
# Where to install LPEL to
export LPEL_PREFIX=$PWD/build
# Where to install SNET-RTS to
export SNET_PREFIX=$PWD/build
# Where to get PCL from
export PCL_DIST=http://www.xmailserver.org/pcl-1.12.tar.gz
# Where to get LPEL from
export LPEL_REPO=https://github.com/snetdev/lpel.git
# Where to get SNET-RTS from
export SNET_REPO=https://github.com/snetdev/snet-rts.git
# Where to get the S-Net compiler
export COMPILER_LINUX_64="https://raw.github.com/snetdev/releases/master/snetc-latest.x86_64.bz2"
export COMPILER_LINUX_32="https://raw.github.com/snetdev/releases/master/snetc-latest.i686.bz2"
# Whether to disable/enable Distributed S-Net with MPI. Enable this only when
# you have a working installation of MPI with a working mpicc + mpirun.
export DIST_MPI=--enable-dist-mpi
# Abort on error
set -e
# Construct destination directories, if needed.
mkdir -p $PCL_PREFIX $LPEL_PREFIX $SNET_PREFIX
function get_pcl () {
if [ ! -f pcl-1.12.tar.gz ]; then
wget $PCL_DIST
fi
}
function build_pcl () {
tar zxf pcl-1.12.tar.gz
cd pcl-1.12
./configure --prefix=$PCL_PREFIX
make
make check
make install
cd ..
}
function get_lpel () {
if [ ! -x lpel/build-aux/bootstrap ]; then
rm -rf lpel
git clone $LPEL_REPO
elif [ -d lpel ]; then
cd lpel
git pull
[ -f Makefile ] && make distclean || true
cd ..
fi
}
function build_lpel () {
cd lpel
sed -e 's/LT_PREREQ(.*)/LT_PREREQ([2.2])/' < configure.ac > configure.$$
mv -f configure.$$ configure.ac
./build-aux/bootstrap
./configure --with-pcl=$PCL_PREFIX \
--with-mctx=pcl \
--prefix=$LPEL_PREFIX --disable-hwloc
make
make install
cd ..
}
function get_snet_rts () {
if [ ! -x snet-rts/bootstrap ]; then
rm -rf snet-rts
git clone $SNET_REPO
elif [ -d snet-rts ]; then
cd snet-rts
git pull
[ -f Makefile ] && make distclean || true
cd ..
fi
}
function build_snet_rts () {
if [ -f "$LPEL_PREFIX/lib64/liblpel.so.0.0.0" ]; then
lpel=$LPEL_PREFIX/lib64
elif [ -f "$LPEL_PREFIX/lib/liblpel.so.0.0.0" ]; then
lpel=$LPEL_PREFIX/lib
else
echo "$0: Could not locate the installed LPEL libraries!" >&2
exit 1
fi
cd snet-rts
sed -e 's/LT_PREREQ(.*)/LT_PREREQ([2.2])/' < configure.ac > configure.$$
mv -f configure.$$ configure.ac
./bootstrap
./configure --with-lpel-includes=$LPEL_PREFIX/include \
--with-lpel-libs=$lpel \
$DIST_MPI \
--prefix=$SNET_PREFIX
make
make install
cd ..
}
function get_snetc () {
case "`uname -p`" in
i?86) COMPILER=$COMPILER_LINUX_32 ;;
x86_64) COMPILER=$COMPILER_LINUX_64 ;;
*) echo "$0: Unknown platform. Not downloading a compiler..." ;;
esac
if [ "$COMPILER" != "" ]; then
raw=${COMPILER##*/}
bz2=${raw%\?*}
snc=${bz2%.bz2}
rm -fv -- "$raw" "$bz2" "$snc"
wget "$COMPILER"
if [ "$raw" != "$bz2" ]; then
mv -f "$raw" "$bz2"
fi
bunzip2 "$bz2"
chmod +x "$snc"
echo
echo "### Please move $snc to a directory in your PATH as snetc."
echo
fi
}
function show_env () {
if [ -f "$LPEL_PREFIX/lib64/liblpel.so.0.0.0" ]; then
lpel=$LPEL_PREFIX/lib64
elif [ -f "$LPEL_PREFIX/lib/liblpel.so.0.0.0" ]; then
lpel=$LPEL_PREFIX/lib
else
echo "$0: Could not locate the installed LPEL libraries!" >&2
exit 1
fi
if [ -f "$SNET_PREFIX/lib64/snet/libC4SNet.so.0.0.0" ]; then
snet=$SNET_PREFIX/lib64/snet
elif [ -f "$SNET_PREFIX/lib/snet/libC4SNet.so.0.0.0" ]; then
snet=$SNET_PREFIX/lib/snet
else
echo "$0: Could not locate the installed SNet libraries!" >&2
exit 1
fi
echo
echo "### The following variables should be added to your environment:"
echo
echo "export SNET_INCLUDES=$SNET_PREFIX/include/snet"
echo "export SNET_LIBS=$snet"
echo "export SNET_MISC=$SNET_PREFIX/share/snet"
echo "export LD_LIBRARY_PATH=$snet:$lpel":'$LD_LIBRARY_PATH'
}
function do_fun () {
echo
echo "##############################################################################"
echo "### executing $1 "
eval $1
}
do_fun get_pcl
do_fun build_pcl
do_fun get_lpel
do_fun build_lpel
do_fun get_snet_rts
do_fun build_snet_rts
do_fun get_snetc
do_fun show_env
exit 0