-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall-dependencies.sh
More file actions
executable file
·217 lines (186 loc) · 6.5 KB
/
install-dependencies.sh
File metadata and controls
executable file
·217 lines (186 loc) · 6.5 KB
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
#!/bin/bash
# Raspberry Dependencies installation and management for 02 software experiments.
# Copyright (C) 2018 Amsterdam University of Applied Sciences.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# Determine absolute path of this file regardless of path from which the file is executed
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
# List of commands required for execution of the setup script
REQUIRE=("git" "wget" "gcc" "g++" "make" "python" "icuinfo" "ping" "grep" "cut" "hash" "dirname" "pwd" "ln" "cp" "doxygen")
BOOST_VERSION="1_68"
DEBUG=true
CMAKE_PARAMATERS=""
if [ ! "$DEBUG" ]; then
CMAKE_PARAMATERS="-DCMAKE_BUILD_TYPE=Debug"
fi
NUM_THREADS=""
if [ ! "$TRAVIS" ]; then
NUM_THREADS=1
else
NUM_THREADS=4
fi
################################
## Start Function Definitions ##
################################
function pingGateway() {
ping -q -w 1 -c 1 "$(ip r | grep default | cut -d ' ' -f 3)" > /dev/null && echo ok || echo error
}
function verifyNetwork() {
# Attempt to ping the gateway to verify an active network connection
if [ "$(pingGateway)" == error ]; then
echo "An active internet connection is required."
read -r -p "Does this machine have an active internet connection: yes[y] / no[n]" yn
case $yn in
[Yy]* ) INET=true;;
[Nn]* ) ;;
* ) echo "Please answer: yes[y] / no[n]";;
esac
else
INET=true
fi
# Halt execution if not connected to the internet
if [ ! $INET ]; then
echo "Can not continue without internet connection."
exit 1;
fi
}
function verifyRequirement() {
if hash "$1" 2>/dev/null; then
echo >&2 "Found $1";
return 0
else
echo >&2 "Could not find: $1 , is not installed.";
return 1
fi
}
##############################
## end Function Definitions ##
##############################
# verify existence of requirements
echo "verifying requirements...";
for i in "${REQUIRE[@]}"
do verifyRequirement "$i" || exit 1
done
echo "Full path was determined to be: $ROOT"
# Determine if necessary symlink exists because boost is incorrectly detects python path on Manjaro
if [ -d /usr/include/python3.7m/ ] && [ ! -d /usr/include/python3.7/ ]; then
echo "Symlinking python to prevent boost error when building"
sudo ln -s /usr/include/python3.7m/ /usr/include/python3.7
fi
# Set locale if not properly set
if ! grep -q "en_US" /etc/locale.gen; then
echo "en_US.UTF-8 UTF-8" | sudo tee /etc/locale.gen
sudo locale-gen
fi
if [ ! "$TRAVIS" ]; then
verifyNetwork
fi
cd "$ROOT" || exit
# Copy cppunit.m4 into aclocal folder if it does not already exist
# this file is required by zookeeper.
if [ ! -f "/usr/share/aclocal/cppunit.m4" ]; then
echo "Copying cppunit.m4"
sudo cp cppunit.m4 /usr/share/aclocal/
fi
# Update all the submodules their submodules
if [ ! "$TRAVIS" ]; then
echo "Updating submodules."
git submodule update --init --recursive
fi
# Compile and install cmake
if ! verifyRequirement "cmake"; then
cd "$ROOT/cmake" || exit
./bootstrap
make -j $NUM_THREADS
sudo make install
fi
# Compile and install boost
if [ ! -f "/usr/local/include/boost/version.hpp" ] || ! grep -q $BOOST_VERSION /usr/local/include/boost/version.hpp; then
cd "$ROOT/boost" || exit
./bootstrap.sh
./b2
sudo ./b2 install
sudo cp libs/program_options/include/boost/program_options.hpp /usr/local/include/boost/
sudo cp libs/signals/include/boost/signals.hpp /usr/local/include/boost/
sudo cp libs/process/include/boost/process.hpp /usr/local/include/boost/
sudo cp libs/signals2/include/boost/signals2.hpp /usr/local/include/boost/
sudo cp libs/parameter/include/boost/parameter.hpp /usr/local/include/boost/
sudo cp libs/iterator/include/boost/function_output_iterator.hpp /usr/local/include/boost/
sudo cp libs/filesystem/include/boost/filesystem.hpp /usr/local/include/boost/
sudo cp libs/format/include/boost/format.hpp /usr/local/include/boost/
sudo cp -R libs/signals2/include/boost/signals2/ /usr/local/include/boost/
sudo cp -R libs/process/include/boost/process/ /usr/local/include/boost/
sudo cp -R libs/uuid/include/boost/uuid/ /usr/local/include/boost/
sudo cp -R libs/msm/include/boost/msm/ /usr/local/include/boost/
sudo cp -R libs/dll/include/boost/dll /usr/local/include/boost/
sudo cp -R libs/core/include/boost/utility/ /usr/local/include/boost/
fi
# Compile and install yaml-cpp
if [ ! -f "/usr/local/lib/libyaml-cpp.so" ]; then
cd "$ROOT/yaml-cpp" || exit
if [ ! -d "build" ]; then
mkdir build
fi
cd build || exit
cmake $CMAKE_PARAMATERS -DBUILD_SHARED_LIBS=ON ../
make -j $NUM_THREADS
sudo make install
fi
# Compile and install libzmq
if [ ! -f "/usr/local/lib/libzmq.so" ]; then
cd "$ROOT/libzmq" || exit
if [ ! -d "build" ]; then
mkdir build
fi
cd build || exit
cmake $CMAKE_PARAMATERS ../
make -j $NUM_THREADS
sudo make install
fi
# Compile and install FairLogger
if [ ! -f "/usr/local/lib/libFairLogger.so" ]; then
cd "$ROOT/FairLogger" || exit
if [ ! -d "build" ]; then
mkdir build
fi
cd build || exit
cmake $CMAKE_PARAMATERS ../
make -j $NUM_THREADS
sudo make install
fi
# Compile and install FairMQ
if [ ! -f "/usr/local/lib/libFairMQ.so" ]; then
cd "$ROOT/FairMQ" || exit
if [ ! -d "build" ]; then
mkdir build
fi
cd build || exit
cmake $CMAKE_PARAMATERS -DBUILD_TESTING=0 ../ # Do not build unit tests as it requires GTest as dependency
make -j $NUM_THREADS # Device will run out of memory if more then 1 compile job runs in parallel!
sudo make install
fi
cd "$ROOT" || exit
# Compile and install ZooKeeper
#cd "$ROOT/zookeeper-arch" || exit
#makepkg -Acs
#PACKAGE="$(echo ./*.pkg.tar.xz)"
#sudo pacman -U "$PACKAGE"
# Compile and install ZooKeeper c bindings
# cd "$ROOT/zookeeper/src/c" || exit
# export CFLAGS="-Wno-error" # Don't worry about it~ just a bug in GCC 8.2
# libtoolize --force
# aclocal
# autoheader
# automake --force-missing --add-missing
# autoconf
# ./configure
# make -j 2
# make install