|
| 1 | +#!/bin/bash |
| 2 | +# |
| 3 | +# This script installs PCL, LPEL and S-Net. |
| 4 | +# Please set the 3 *_PREFIX environment variables |
| 5 | +# to your liking before invoking this script. |
| 6 | +# |
| 7 | + |
| 8 | +# Abort on error |
| 9 | +set -e |
| 10 | + |
| 11 | +# Where to install PCL to |
| 12 | +export PCL_PREFIX=$PWD/build |
| 13 | + |
| 14 | +# Where to install LPEL to |
| 15 | +export LPEL_PREFIX=$PWD/build |
| 16 | + |
| 17 | +# Where to install SNET-RTS to |
| 18 | +export SNET_PREFIX=$PWD/build |
| 19 | + |
| 20 | +# Where to get PCL from |
| 21 | +export PCL_DIST=http://www.xmailserver.org/pcl-1.12.tar.gz |
| 22 | + |
| 23 | +# Where to get LPEL from |
| 24 | +export LPEL_REPO=https://github.com/snetdev/lpel.git |
| 25 | + |
| 26 | +# Where to get SNET-RTS from |
| 27 | +export SNET_REPO=https://github.com/snetdev/snet-rts.git |
| 28 | + |
| 29 | +# Where to get the S-Net compiler |
| 30 | +export COMPILER_LINUX_64="https://raw.github.com/snetdev/releases/master/2013/snetc-20130507.x86_64.bz2" |
| 31 | +export COMPILER_LINUX_32="https://raw.github.com/snetdev/releases/master/2013/snetc-20130507.i686.bz2" |
| 32 | + |
| 33 | +mkdir -p $PCL_PREFIX $LPEL_PREFIX $SNET_PREFIX |
| 34 | + |
| 35 | +function get_pcl () { |
| 36 | + if [ ! -f pcl-1.12.tar.gz ]; then |
| 37 | + wget $PCL_DIST |
| 38 | + fi |
| 39 | +} |
| 40 | + |
| 41 | +function build_pcl () { |
| 42 | + tar zxf pcl-1.12.tar.gz |
| 43 | + cd pcl-1.12 |
| 44 | + ./configure --prefix=$PCL_PREFIX |
| 45 | + make |
| 46 | + make check |
| 47 | + make install |
| 48 | + cd .. |
| 49 | +} |
| 50 | + |
| 51 | +function get_lpel () { |
| 52 | + if [ ! -x lpel/build-aux/bootstrap ]; then |
| 53 | + rm -rf lpel |
| 54 | + git clone $LPEL_REPO |
| 55 | + elif [ -d lpel ]; then |
| 56 | + cd lpel |
| 57 | + git pull |
| 58 | + [ -f Makefile ] && make distclean || true |
| 59 | + cd .. |
| 60 | + fi |
| 61 | +} |
| 62 | + |
| 63 | +function build_lpel () { |
| 64 | + cd lpel |
| 65 | + sed -e 's/LT_PREREQ(.*)/LT_PREREQ([2.2])/' < configure.ac > configure.$$ |
| 66 | + mv -f configure.$$ configure.ac |
| 67 | + ./build-aux/bootstrap |
| 68 | + |
| 69 | + ./configure --with-pcl=$PCL_PREFIX \ |
| 70 | + --with-mctx=pcl \ |
| 71 | + --prefix=$LPEL_PREFIX --disable-hwloc |
| 72 | + |
| 73 | + make |
| 74 | + make install |
| 75 | + cd .. |
| 76 | +} |
| 77 | + |
| 78 | +function get_snet_rts () { |
| 79 | + if [ ! -x snet-rts/bootstrap ]; then |
| 80 | + rm -rf snet-rts |
| 81 | + git clone $SNET_REPO |
| 82 | + elif [ -d snet-rts ]; then |
| 83 | + cd snet-rts |
| 84 | + git pull |
| 85 | + [ -f Makefile ] && make distclean || true |
| 86 | + cd .. |
| 87 | + fi |
| 88 | +} |
| 89 | + |
| 90 | +function build_snet_rts () { |
| 91 | + if [ -f "$LPEL_PREFIX/lib64/liblpel.so.0.0.0" ]; then |
| 92 | + lpel=$LPEL_PREFIX/lib64 |
| 93 | + elif [ -f "$LPEL_PREFIX/lib/liblpel.so.0.0.0" ]; then |
| 94 | + lpel=$LPEL_PREFIX/lib |
| 95 | + else |
| 96 | + echo "$0: Could not locate the installed LPEL libraries!" >&2 |
| 97 | + exit 1 |
| 98 | + fi |
| 99 | + |
| 100 | + cd snet-rts |
| 101 | + sed -e 's/LT_PREREQ(.*)/LT_PREREQ([2.2])/' < configure.ac > configure.$$ |
| 102 | + mv -f configure.$$ configure.ac |
| 103 | + ./bootstrap |
| 104 | + |
| 105 | + ./configure --with-lpel-includes=$LPEL_PREFIX/include \ |
| 106 | + --with-lpel-libs=$lpel \ |
| 107 | + --disable-dist-mpi \ |
| 108 | + --prefix=$SNET_PREFIX |
| 109 | + |
| 110 | + make |
| 111 | + make install |
| 112 | + cd .. |
| 113 | +} |
| 114 | + |
| 115 | +function get_snetc () { |
| 116 | + case "`uname -p`" in |
| 117 | + i?86) COMPILER=$COMPILER_LINUX_32 ;; |
| 118 | + x86_64) COMPILER=$COMPILER_LINUX_64 ;; |
| 119 | + *) echo "$0: Unknown platform. Not downloading a compiler..." ;; |
| 120 | + esac |
| 121 | + if [ "$COMPILER" != "" ]; then |
| 122 | + raw=${COMPILER##*/} |
| 123 | + bz2=${raw%\?*} |
| 124 | + snc=${bz2%.bz2} |
| 125 | + rm -fv -- "$raw" "$bz2" "$snc" |
| 126 | + wget "$COMPILER" |
| 127 | + if [ "$raw" != "$bz2" ]; then |
| 128 | + mv -f "$raw" "$bz2" |
| 129 | + fi |
| 130 | + bunzip2 "$bz2" |
| 131 | + chmod +x "$snc" |
| 132 | + fi |
| 133 | +} |
| 134 | + |
| 135 | +function show_env () { |
| 136 | + |
| 137 | + if [ -f "$LPEL_PREFIX/lib64/liblpel.so.0.0.0" ]; then |
| 138 | + lpel=$LPEL_PREFIX/lib64 |
| 139 | + elif [ -f "$LPEL_PREFIX/lib/liblpel.so.0.0.0" ]; then |
| 140 | + lpel=$LPEL_PREFIX/lib |
| 141 | + else |
| 142 | + echo "$0: Could not locate the installed LPEL libraries!" >&2 |
| 143 | + exit 1 |
| 144 | + fi |
| 145 | + if [ -f "$SNET_PREFIX/lib64/snet/libC4SNet.so.0.0.0" ]; then |
| 146 | + snet=$SNET_PREFIX/lib64/snet |
| 147 | + elif [ -f "$SNET_PREFIX/lib/snet/libC4SNet.so.0.0.0" ]; then |
| 148 | + snet=$SNET_PREFIX/lib/snet |
| 149 | + else |
| 150 | + echo "$0: Could not locate the installed SNet libraries!" >&2 |
| 151 | + exit 1 |
| 152 | + fi |
| 153 | + |
| 154 | + echo |
| 155 | + echo "### The following variables should be added to your environment:" |
| 156 | + echo |
| 157 | + echo "export SNET_INCLUDES=$SNET_PREFIX/include/snet" |
| 158 | + echo "export SNET_LIBS=$snet" |
| 159 | + echo "export SNET_MISC=$SNET_PREFIX/share/snet" |
| 160 | + |
| 161 | + echo "export LD_LIBRARY_PATH=$snet:$lpel":'$LD_LIBRARY_PATH' |
| 162 | +} |
| 163 | + |
| 164 | +function do_fun () { |
| 165 | + echo |
| 166 | + echo "##############################################################################" |
| 167 | + echo "### executing $1 " |
| 168 | + eval $1 |
| 169 | +} |
| 170 | + |
| 171 | +do_fun get_pcl |
| 172 | +do_fun build_pcl |
| 173 | +do_fun get_lpel |
| 174 | +do_fun build_lpel |
| 175 | +do_fun get_snet_rts |
| 176 | +do_fun build_snet_rts |
| 177 | +do_fun get_snetc |
| 178 | +do_fun show_env |
| 179 | + |
| 180 | +exit 0 |
| 181 | + |
0 commit comments