-
Notifications
You must be signed in to change notification settings - Fork 448
/
Copy pathtravis-build
100 lines (82 loc) · 2.56 KB
/
travis-build
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
#!/bin/bash
# Script for building in a Docker container on Travis.
set -e # Exit on error.
export P4C_DEPS="bison \
build-essential \
cmake \
curl \
flex \
g++ \
libboost-dev \
libboost-graph-dev \
libboost-iostreams1.58-dev \
libfl-dev \
libgc-dev \
libgmp-dev \
pkg-config \
python \
python3 \
python3-pip \
python3-setuptools \
tcpdump"
export P4C_EBPF_DEPS="libpcap-dev \
libelf-dev \
llvm \
clang \
iproute2 \
net-tools"
export P4C_RUNTIME_DEPS="cpp \
libboost-graph1.58.0 \
libboost-iostreams1.58.0 \
libgc1c2 \
libgmp10 \
libgmpxx4ldbl \
python3"
export P4C_PIP_PACKAGES="ipaddr \
pyroute2 \
ply==3.8 \
scapy==2.4.0"
export P4C_PIP3_PACKAGES="ipaddr \
pyroute2 \
ply==3.8 \
scapy"
apt-get update
apt-get install -y --no-install-recommends \
${P4C_DEPS} \
${P4C_EBPF_DEPS} \
${P4C_RUNTIME_DEPS} \
git
pip3 install $P4C_PIP3_PACKAGES
# ! ------- BEGIN Python2 -------------------------------------------------
# ! ------- Should be deleted when conversion to Python3 is finalized -----
# We install pip with get-pip.py (https://pip.pypa.io/en/stable/installing/)
# since the Ubuntu package manager's version of pip seems to be broken on
# Ubuntu 16.04.
mkdir /tmp/pip
cd /tmp/pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python2 get-pip.py
cd -
rm -rf /tmp/pip
# just to make sure we don't break other downstream projects that have
# not yet converted, we still install python2 and the modules
pip install $P4C_PIP_PACKAGES
# ! ------ END Python2 ----------------------------------------------------
function build() {
if [ -e build ]; then /bin/rm -rf build; fi
mkdir -p build
cd build
cmake .. '-DCMAKE_CXX_FLAGS:STRING=-O3' "$@"
make
}
build "-DENABLE_UNIFIED_COMPILATION=${ENABLE_UNIFIED_COMPILATION}"
make install
/usr/local/bin/ccache -p -s
if [[ "${IMAGE_TYPE}" == "build" ]] ; then
apt-get purge -y ${P4C_DEPS} git
apt-get autoremove --purge -y
rm -rf /p4c /var/cache/apt/* /var/lib/apt/lists/*
echo 'Build image ready'
elif [[ "${IMAGE_TYPE}" == "test" ]] ; then
echo 'Test image ready'
fi