Carmelo Cascone | acf1225 | 2017-06-05 01:05:43 -0400 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | # ----------------------------------------------------------------------------- |
| 3 | # Builds and installs all tools needed for developing and testing P4 support in |
| 4 | # ONOS. |
| 5 | # |
Brian O'Connor | 73f8bd7 | 2017-06-16 15:27:49 -0700 | [diff] [blame] | 6 | # Tested on Ubuntu 14.04 and 16.04. |
Carmelo Cascone | acf1225 | 2017-06-05 01:05:43 -0400 | [diff] [blame] | 7 | # |
| 8 | # Recommended minimum system requirements: |
| 9 | # 4 GB of RAM |
| 10 | # 2 cores |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 11 | # 8 GB free hard drive space (~4 GB to build everything) |
Carmelo Cascone | acf1225 | 2017-06-05 01:05:43 -0400 | [diff] [blame] | 12 | # ----------------------------------------------------------------------------- |
| 13 | |
| 14 | # Exit on errors. |
| 15 | set -e |
| 16 | |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 17 | BUILD_DIR=~/p4tools |
Brian O'Connor | f373565 | 2017-12-05 15:22:08 -0800 | [diff] [blame] | 18 | BMV2_COMMIT="3f1d8d7893d7cf1657285c8aacbb4af5c6d22620" |
| 19 | PI_COMMIT="0325da7746efe192935e8969fd08eed68d654c98" |
| 20 | P4C_COMMIT="4c0d629ce2492294ff4108c910f8e6be44112c68" |
Andrea Campanella | 8bcd586 | 2017-12-11 11:34:45 +0100 | [diff] [blame] | 21 | PROTOBUF_COMMIT="tags/v3.2.0" |
Carmelo Cascone | b1936bd | 2017-12-12 14:42:27 -0800 | [diff] [blame] | 22 | GRPC_COMMIT="tags/v1.3.2" |
Brian O'Connor | f373565 | 2017-12-05 15:22:08 -0800 | [diff] [blame] | 23 | LIBYANG_COMMIT="v0.14-r1" |
| 24 | SYSREPO_COMMIT="v0.7.2" |
Carmelo Cascone | acf1225 | 2017-06-05 01:05:43 -0400 | [diff] [blame] | 25 | |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 26 | NUM_CORES=`grep -c ^processor /proc/cpuinfo` |
Carmelo Cascone | acf1225 | 2017-06-05 01:05:43 -0400 | [diff] [blame] | 27 | |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 28 | function do_requirements { |
| 29 | sudo apt update |
Brian O'Connor | 73f8bd7 | 2017-06-16 15:27:49 -0700 | [diff] [blame] | 30 | sudo apt-get install -y --no-install-recommends \ |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 31 | autoconf \ |
| 32 | automake \ |
| 33 | bison \ |
Carmelo Cascone | fb76b04 | 2017-07-17 19:42:00 -0400 | [diff] [blame] | 34 | build-essential \ |
| 35 | cmake \ |
| 36 | cpp \ |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 37 | curl \ |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 38 | flex \ |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 39 | git \ |
Brian O'Connor | f373565 | 2017-12-05 15:22:08 -0800 | [diff] [blame] | 40 | libavl-dev \ |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 41 | libboost-dev \ |
Brian O'Connor | 73f8bd7 | 2017-06-16 15:27:49 -0700 | [diff] [blame] | 42 | libboost-program-options-dev \ |
| 43 | libboost-system-dev \ |
Carmelo Cascone | fb76b04 | 2017-07-17 19:42:00 -0400 | [diff] [blame] | 44 | libboost-filesystem-dev \ |
Brian O'Connor | 73f8bd7 | 2017-06-16 15:27:49 -0700 | [diff] [blame] | 45 | libboost-thread-dev \ |
| 46 | libboost-filesystem-dev \ |
Carmelo Cascone | fb76b04 | 2017-07-17 19:42:00 -0400 | [diff] [blame] | 47 | libboost-program-options-dev \ |
| 48 | libboost-system-dev \ |
| 49 | libboost-test-dev \ |
| 50 | libboost-thread-dev \ |
| 51 | libc6-dev \ |
Brian O'Connor | f373565 | 2017-12-05 15:22:08 -0800 | [diff] [blame] | 52 | libev-dev \ |
Carmelo Cascone | fb76b04 | 2017-07-17 19:42:00 -0400 | [diff] [blame] | 53 | libevent-dev \ |
| 54 | libffi-dev \ |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 55 | libfl-dev \ |
| 56 | libgc-dev \ |
Carmelo Cascone | fb76b04 | 2017-07-17 19:42:00 -0400 | [diff] [blame] | 57 | libgc1c2 \ |
| 58 | libgflags-dev \ |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 59 | libgmp-dev \ |
Carmelo Cascone | fb76b04 | 2017-07-17 19:42:00 -0400 | [diff] [blame] | 60 | libgmp10 \ |
| 61 | libgmpxx4ldbl \ |
| 62 | libjudy-dev \ |
| 63 | libpcap-dev \ |
Brian O'Connor | f373565 | 2017-12-05 15:22:08 -0800 | [diff] [blame] | 64 | libpcre3-dev \ |
| 65 | libprotobuf-c-dev \ |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 66 | libreadline6 \ |
| 67 | libreadline6-dev \ |
Carmelo Cascone | fb76b04 | 2017-07-17 19:42:00 -0400 | [diff] [blame] | 68 | libssl-dev \ |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 69 | libtool \ |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 70 | make \ |
Carmelo Cascone | fb76b04 | 2017-07-17 19:42:00 -0400 | [diff] [blame] | 71 | mktemp \ |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 72 | pkg-config \ |
Brian O'Connor | f373565 | 2017-12-05 15:22:08 -0800 | [diff] [blame] | 73 | protobuf-c-compiler \ |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 74 | python \ |
Carmelo Cascone | fb76b04 | 2017-07-17 19:42:00 -0400 | [diff] [blame] | 75 | python-dev \ |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 76 | python-ipaddr \ |
Carmelo Cascone | fb76b04 | 2017-07-17 19:42:00 -0400 | [diff] [blame] | 77 | python-pip \ |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 78 | python-scapy \ |
Carmelo Cascone | ee09071 | 2017-12-14 23:01:03 -0800 | [diff] [blame] | 79 | python-setuptools \ |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 80 | tcpdump \ |
Carmelo Cascone | fb76b04 | 2017-07-17 19:42:00 -0400 | [diff] [blame] | 81 | wget \ |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 82 | unzip |
Carmelo Cascone | 87ac737 | 2017-09-15 01:58:59 +0200 | [diff] [blame] | 83 | |
Brian O'Connor | f373565 | 2017-12-05 15:22:08 -0800 | [diff] [blame] | 84 | sudo pip install setuptools cffi grpcio |
Brian O'Connor | 73f8bd7 | 2017-06-16 15:27:49 -0700 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | function do_requirements_1404 { |
| 88 | sudo apt install -y python-software-properties software-properties-common |
| 89 | sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test |
Carmelo Cascone | 6e4f7eb | 2017-08-21 23:00:43 +0200 | [diff] [blame] | 90 | sudo add-apt-repository -y ppa:george-edison55/cmake-3.x |
Brian O'Connor | 73f8bd7 | 2017-06-16 15:27:49 -0700 | [diff] [blame] | 91 | sudo apt update |
| 92 | sudo apt install -y \ |
| 93 | dpkg-dev \ |
| 94 | g++-4.9 \ |
| 95 | gcc-4.9 \ |
| 96 | libboost-iostreams-dev |
Carmelo Cascone | acf1225 | 2017-06-05 01:05:43 -0400 | [diff] [blame] | 97 | |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 98 | # Needed for p4c. |
| 99 | sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 50 |
| 100 | sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 50 |
| 101 | } |
Carmelo Cascone | acf1225 | 2017-06-05 01:05:43 -0400 | [diff] [blame] | 102 | |
Brian O'Connor | 73f8bd7 | 2017-06-16 15:27:49 -0700 | [diff] [blame] | 103 | function do_requirements_1604 { |
| 104 | sudo apt-get update |
| 105 | sudo apt-get install -y --no-install-recommends \ |
| 106 | ca-certificates \ |
| 107 | g++ \ |
| 108 | libboost-iostreams1.58-dev |
| 109 | } |
| 110 | |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 111 | function do_protobuf { |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 112 | cd ${BUILD_DIR} |
| 113 | if [ ! -d protobuf ]; then |
| 114 | git clone https://github.com/google/protobuf.git |
| 115 | fi |
| 116 | cd protobuf |
| 117 | git fetch |
| 118 | git checkout ${PROTOBUF_COMMIT} |
Carmelo Cascone | fb76b04 | 2017-07-17 19:42:00 -0400 | [diff] [blame] | 119 | |
| 120 | export CFLAGS="-Os" |
| 121 | export CXXFLAGS="-Os" |
| 122 | export LDFLAGS="-Wl,-s" |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 123 | ./autogen.sh |
| 124 | ./configure --prefix=/usr |
| 125 | make -j${NUM_CORES} |
| 126 | sudo make install |
| 127 | sudo ldconfig |
Carmelo Cascone | fb76b04 | 2017-07-17 19:42:00 -0400 | [diff] [blame] | 128 | unset CFLAGS CXXFLAGS LDFLAGS |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 129 | } |
Carmelo Cascone | acf1225 | 2017-06-05 01:05:43 -0400 | [diff] [blame] | 130 | |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 131 | function do_grpc { |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 132 | cd ${BUILD_DIR} |
| 133 | if [ ! -d grpc ]; then |
| 134 | git clone https://github.com/grpc/grpc.git |
| 135 | fi |
| 136 | cd grpc |
| 137 | git fetch |
| 138 | git checkout ${GRPC_COMMIT} |
| 139 | git submodule update --init |
Carmelo Cascone | acf1225 | 2017-06-05 01:05:43 -0400 | [diff] [blame] | 140 | |
Carmelo Cascone | fb76b04 | 2017-07-17 19:42:00 -0400 | [diff] [blame] | 141 | export LDFLAGS="-Wl,-s" |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 142 | make -j${NUM_CORES} |
| 143 | sudo make install |
| 144 | sudo ldconfig |
Carmelo Cascone | fb76b04 | 2017-07-17 19:42:00 -0400 | [diff] [blame] | 145 | unset LDFLAGS |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 146 | } |
Carmelo Cascone | acf1225 | 2017-06-05 01:05:43 -0400 | [diff] [blame] | 147 | |
Brian O'Connor | f373565 | 2017-12-05 15:22:08 -0800 | [diff] [blame] | 148 | function do_libyang { |
| 149 | cd ${BUILD_DIR} |
| 150 | if [ ! -d libyang ]; then |
| 151 | git clone https://github.com/CESNET/libyang.git |
| 152 | fi |
| 153 | cd libyang |
| 154 | git fetch |
| 155 | git checkout ${LIBYANG_COMMIT} |
| 156 | |
| 157 | mkdir build |
| 158 | cd build |
| 159 | cmake .. |
| 160 | make -j${NUM_CORES} |
| 161 | sudo make install |
| 162 | sudo ldconfig |
| 163 | } |
| 164 | |
| 165 | function do_sysrepo { |
| 166 | cd ${BUILD_DIR} |
| 167 | if [ ! -d sysrepo ]; then |
| 168 | git clone https://github.com/sysrepo/sysrepo.git |
| 169 | fi |
| 170 | cd sysrepo |
| 171 | git fetch |
| 172 | git checkout ${SYSREPO_COMMIT} |
| 173 | |
| 174 | mkdir build |
| 175 | cd build |
| 176 | cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=Off \ |
| 177 | -DCALL_TARGET_BINS_DIRECTLY=Off .. |
| 178 | make -j${NUM_CORES} |
| 179 | sudo make install |
| 180 | sudo ldconfig |
| 181 | } |
| 182 | |
Carmelo Cascone | 87ac737 | 2017-09-15 01:58:59 +0200 | [diff] [blame] | 183 | function checkout_bmv2 { |
| 184 | cd ${BUILD_DIR} |
| 185 | if [ ! -d bmv2 ]; then |
| 186 | git clone https://github.com/p4lang/behavioral-model.git bmv2 |
| 187 | fi |
| 188 | cd bmv2 |
| 189 | git fetch |
| 190 | git checkout ${BMV2_COMMIT} |
| 191 | } |
| 192 | |
| 193 | function do_pi_bmv2_deps { |
| 194 | checkout_bmv2 |
| 195 | # From bmv2's install_deps.sh. |
| 196 | # Nanomsg is required also by p4runtime. |
| 197 | tmpdir=`mktemp -d -p .` |
| 198 | cd ${tmpdir} |
| 199 | bash ../travis/install-thrift.sh |
| 200 | bash ../travis/install-nanomsg.sh |
| 201 | sudo ldconfig |
| 202 | bash ../travis/install-nnpy.sh |
| 203 | cd .. |
| 204 | sudo rm -rf $tmpdir |
| 205 | } |
| 206 | |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 207 | function do_p4runtime { |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 208 | cd ${BUILD_DIR} |
| 209 | if [ ! -d p4runtime ]; then |
| 210 | git clone https://github.com/p4lang/PI.git p4runtime |
| 211 | fi |
| 212 | cd p4runtime |
| 213 | git fetch |
| 214 | git checkout ${PI_COMMIT} |
| 215 | git submodule update --init --recursive |
Carmelo Cascone | fb76b04 | 2017-07-17 19:42:00 -0400 | [diff] [blame] | 216 | |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 217 | ./autogen.sh |
Brian O'Connor | f373565 | 2017-12-05 15:22:08 -0800 | [diff] [blame] | 218 | ./configure --with-proto --with-sysrepo 'CXXFLAGS=-O0 -g' |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 219 | make -j${NUM_CORES} |
| 220 | sudo make install |
| 221 | sudo ldconfig |
Brian O'Connor | f373565 | 2017-12-05 15:22:08 -0800 | [diff] [blame] | 222 | |
| 223 | sudo sysrepo/install_yangs.sh |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 224 | } |
Carmelo Cascone | acf1225 | 2017-06-05 01:05:43 -0400 | [diff] [blame] | 225 | |
Carmelo Cascone | fb76b04 | 2017-07-17 19:42:00 -0400 | [diff] [blame] | 226 | function do_bmv2 { |
Carmelo Cascone | 87ac737 | 2017-09-15 01:58:59 +0200 | [diff] [blame] | 227 | checkout_bmv2 |
Carmelo Cascone | aaf6d98 | 2017-07-29 19:52:58 -0400 | [diff] [blame] | 228 | |
Carmelo Cascone | fb76b04 | 2017-07-17 19:42:00 -0400 | [diff] [blame] | 229 | ./autogen.sh |
Carmelo Cascone | 28f3778 | 2017-08-29 20:11:21 +0200 | [diff] [blame] | 230 | ./configure --enable-debugger --with-pi 'CXXFLAGS=-O0 -g' |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 231 | make -j${NUM_CORES} |
| 232 | sudo make install |
| 233 | sudo ldconfig |
Carmelo Cascone | acf1225 | 2017-06-05 01:05:43 -0400 | [diff] [blame] | 234 | |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 235 | # Simple_switch_grpc target |
| 236 | cd targets/simple_switch_grpc |
| 237 | ./autogen.sh |
Brian O'Connor | f373565 | 2017-12-05 15:22:08 -0800 | [diff] [blame] | 238 | ./configure --with-sysrepo --with-thrift 'CXXFLAGS=-O0 -g' |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 239 | make -j${NUM_CORES} |
| 240 | sudo make install |
| 241 | sudo ldconfig |
| 242 | } |
Carmelo Cascone | acf1225 | 2017-06-05 01:05:43 -0400 | [diff] [blame] | 243 | |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 244 | function do_p4c { |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 245 | cd ${BUILD_DIR} |
| 246 | if [ ! -d p4c ]; then |
| 247 | git clone https://github.com/p4lang/p4c.git |
| 248 | fi |
| 249 | cd p4c |
| 250 | git fetch |
| 251 | git checkout ${P4C_COMMIT} |
| 252 | git submodule update --init --recursive |
Carmelo Cascone | fb76b04 | 2017-07-17 19:42:00 -0400 | [diff] [blame] | 253 | |
Carmelo Cascone | 6e4f7eb | 2017-08-21 23:00:43 +0200 | [diff] [blame] | 254 | mkdir -p build |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 255 | cd build |
Carmelo Cascone | 6e4f7eb | 2017-08-21 23:00:43 +0200 | [diff] [blame] | 256 | cmake .. |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 257 | make -j${NUM_CORES} |
| 258 | sudo make install |
| 259 | sudo ldconfig |
| 260 | } |
Carmelo Cascone | acf1225 | 2017-06-05 01:05:43 -0400 | [diff] [blame] | 261 | |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 262 | function check_commit { |
| 263 | if [ ! -e $2 ]; then |
| 264 | return 0 # true |
| 265 | fi |
| 266 | if [[ $(< $2) != "$1" ]]; then |
| 267 | return 0 # true |
| 268 | fi |
| 269 | return 1 # false |
| 270 | } |
Carmelo Cascone | acf1225 | 2017-06-05 01:05:43 -0400 | [diff] [blame] | 271 | |
Brian O'Connor | 73f8bd7 | 2017-06-16 15:27:49 -0700 | [diff] [blame] | 272 | # The following is borrowed from Mininet's util/install.sh |
| 273 | function version_ge { |
| 274 | # sort -V sorts by *version number* |
| 275 | latest=`printf "$1\n$2" | sort -V | tail -1` |
| 276 | # If $1 is latest version, then $1 >= $2 |
| 277 | [ "$1" == "$latest" ] |
| 278 | } |
| 279 | |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 280 | MUST_DO_ALL=false |
| 281 | DID_REQUIREMENTS=false |
| 282 | function check_and_do { |
Brian O'Connor | f373565 | 2017-12-05 15:22:08 -0800 | [diff] [blame] | 283 | # Check if the latest built commit is the same we are trying to build now, |
| 284 | # or if all projects must be built. If true builds this project. |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 285 | commit_id="$1" |
| 286 | proj_dir="$2" |
| 287 | func_name="$3" |
Carmelo Cascone | 87ac737 | 2017-09-15 01:58:59 +0200 | [diff] [blame] | 288 | simple_name="$4" |
Brian O'Connor | f373565 | 2017-12-05 15:22:08 -0800 | [diff] [blame] | 289 | if ${MUST_DO_ALL} = true \ |
| 290 | || check_commit ${commit_id} ${proj_dir}/.last_built_commit; then |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 291 | echo "#" |
Carmelo Cascone | 87ac737 | 2017-09-15 01:58:59 +0200 | [diff] [blame] | 292 | echo "# Building ${simple_name} (${commit_id})" |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 293 | echo "#" |
Brian O'Connor | 73f8bd7 | 2017-06-16 15:27:49 -0700 | [diff] [blame] | 294 | # Print commands used to install to aid debugging |
| 295 | set -x |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 296 | if ! ${DID_REQUIREMENTS} = true; then |
| 297 | do_requirements |
Brian O'Connor | f373565 | 2017-12-05 15:22:08 -0800 | [diff] [blame] | 298 | # TODO consider other Linux distros; presently this script assumes |
| 299 | # that it is running on Ubuntu. |
Brian O'Connor | 73f8bd7 | 2017-06-16 15:27:49 -0700 | [diff] [blame] | 300 | RELEASE=`lsb_release -rs` |
| 301 | if version_ge $RELEASE 16.04; then |
| 302 | do_requirements_1604 |
| 303 | elif version_ge $RELEASE 14.04; then |
| 304 | do_requirements_1404 |
| 305 | else |
| 306 | echo "Ubuntu version $RELEASE is not supported" |
| 307 | exit 1 |
| 308 | fi |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 309 | DID_REQUIREMENTS=true |
| 310 | fi |
| 311 | eval ${func_name} |
| 312 | echo ${commit_id} > ${BUILD_DIR}/${proj_dir}/.last_built_commit |
| 313 | # Build all next projects as they might depend on this one. |
| 314 | MUST_DO_ALL=true |
Brian O'Connor | 73f8bd7 | 2017-06-16 15:27:49 -0700 | [diff] [blame] | 315 | # Disable printing to reduce output |
| 316 | set +x |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 317 | else |
| 318 | echo "${proj_dir} is up to date (commit ${commit_id})" |
| 319 | fi |
| 320 | } |
| 321 | |
| 322 | mkdir -p ${BUILD_DIR} |
| 323 | cd ${BUILD_DIR} |
| 324 | # In dependency order. |
Carmelo Cascone | 87ac737 | 2017-09-15 01:58:59 +0200 | [diff] [blame] | 325 | check_and_do ${PROTOBUF_COMMIT} protobuf do_protobuf protobuf |
| 326 | check_and_do ${GRPC_COMMIT} grpc do_grpc grpc |
Brian O'Connor | f373565 | 2017-12-05 15:22:08 -0800 | [diff] [blame] | 327 | check_and_do ${LIBYANG_COMMIT} libyang do_libyang libyang |
| 328 | check_and_do ${SYSREPO_COMMIT} sysrepo do_sysrepo sysrepo |
Carmelo Cascone | 87ac737 | 2017-09-15 01:58:59 +0200 | [diff] [blame] | 329 | check_and_do ${BMV2_COMMIT} bmv2 do_pi_bmv2_deps bmv2-deps |
| 330 | check_and_do ${PI_COMMIT} p4runtime do_p4runtime p4runtime |
| 331 | check_and_do ${BMV2_COMMIT} bmv2 do_bmv2 bmv2 |
| 332 | check_and_do ${P4C_COMMIT} p4c do_p4c p4c |
Carmelo Cascone | 7e8f832 | 2017-06-05 13:31:47 -0400 | [diff] [blame] | 333 | |
| 334 | echo "Done!" |