forked from p4fpga/p4fpga
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap_env.sh
More file actions
executable file
·60 lines (47 loc) · 1.4 KB
/
bootstrap_env.sh
File metadata and controls
executable file
·60 lines (47 loc) · 1.4 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
#!/bin/bash
die () {
if [ $# -gt 0 ]; then
echo >&2 "$@"
fi
exit 1
}
function version_LT() {
test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" != "$1";
}
SUDO=sudo
LDCONFIG=ldconfig
install_linux_packages() {
ubuntu_release=$(lsb_release -r | cut -f 2)
apt_packages="g++ git automake libtool libgc-dev bison flex libfl-dev \
libgmp-dev libboost-dev libboost-iostreams-dev libboost-graph-dev \
libboost-system-dev libboost-filesystem-dev \
pkg-config python python-scapy python-ipaddr tcpdump cmake"
echo "Need sudo privs to install apt packages"
$SUDO apt-get update || die "Failed to update apt"
$SUDO apt-get install -y $apt_packages || die "Failed to install needed packages"
}
function install_protobuf() {
tmpdir=$(mktemp -d)
echo "Using $tmpdir for temporary build files"
echo "Checking for and installing protobuf"
if ! `pkg-config protobuf` || version_LT `pkg-config --modversion protobuf` "3.0.0"; then
pushd $tmpdir
git clone https://github.com/google/protobuf
cd protobuf
git checkout tags/v3.2.0
git submodule update --init --recursive
./autogen.sh && \
./configure && \
make && \
$SUDO make install && \
$SUDO $LDCONFIG || \
die "Failed to install protobuf"
cd ../
/bin/rm -rf protobuf
PI_clean_before_rebuild=true
popd # tmpdir
fi
rm -rf $tmpdir
}
install_linux_packages
install_protobuf