Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [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 | # |
| 6 | # Tested on Ubuntu 14.04 and 16.04. |
| 7 | # |
| 8 | # Recommended minimum system requirements: |
| 9 | # 4 GB of RAM |
| 10 | # 2 cores |
| 11 | # 8 GB free hard drive space (~4 GB to build everything) |
Carmelo Cascone | 95e5afd | 2018-07-17 14:45:23 +0200 | [diff] [blame] | 12 | # |
| 13 | # To execute up to a given step, pass the step name as the first argument. For |
| 14 | # example, to install PI, but not BMv2, p4c, etc: |
| 15 | # ./install-p4-tools.sh PI |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 16 | # ----------------------------------------------------------------------------- |
| 17 | |
| 18 | # Exit on errors. |
| 19 | set -e |
| 20 | |
| 21 | BUILD_DIR=~/p4tools |
Esin Karaman | 971fb7f | 2017-12-28 13:44:52 +0000 | [diff] [blame] | 22 | # in case BMV2_COMMIT value is updated, the same variable in |
| 23 | # protocols/bmv2/thrift-api/BUCK file should also be updated |
Carmelo Cascone | 03ae0ac | 2018-10-11 08:31:59 -0700 | [diff] [blame] | 24 | BMV2_COMMIT="ae87b4d4523488ac935133b4aef437796ad1bbd1" |
| 25 | PI_COMMIT="539e4624f16aac39f8890a6dfb11c65040e735ad" |
| 26 | P4C_COMMIT="380830f6c26135d1d65e1312e3ba2da628c18145" |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 27 | PROTOBUF_COMMIT="tags/v3.2.0" |
| 28 | GRPC_COMMIT="tags/v1.3.2" |
| 29 | LIBYANG_COMMIT="v0.14-r1" |
| 30 | SYSREPO_COMMIT="v0.7.2" |
| 31 | |
| 32 | NUM_CORES=`grep -c ^processor /proc/cpuinfo` |
| 33 | |
Carmelo Cascone | f02872d | 2018-06-20 08:49:02 +0200 | [diff] [blame] | 34 | # If false, build tools without debug features to improve throughput of BMv2 and |
Carmelo Cascone | 03ae0ac | 2018-10-11 08:31:59 -0700 | [diff] [blame] | 35 | # reduce CPU/memory footprint. Default is true. |
Carmelo Cascone | f02872d | 2018-06-20 08:49:02 +0200 | [diff] [blame] | 36 | DEBUG_FLAGS=${DEBUG_FLAGS:-true} |
| 37 | |
Carmelo Cascone | 95e5afd | 2018-07-17 14:45:23 +0200 | [diff] [blame] | 38 | # Execute up to the given step (first argument), or all if not defined. |
| 39 | LAST_STEP=${1:-all} |
| 40 | |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 41 | function do_requirements { |
| 42 | sudo apt update |
| 43 | sudo apt-get install -y --no-install-recommends \ |
| 44 | autoconf \ |
| 45 | automake \ |
| 46 | bison \ |
| 47 | build-essential \ |
| 48 | cmake \ |
| 49 | cpp \ |
| 50 | curl \ |
| 51 | flex \ |
| 52 | git \ |
Carmelo Cascone | 4d5757d | 2018-11-25 02:26:32 -0800 | [diff] [blame^] | 53 | graphviz \ |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 54 | libavl-dev \ |
| 55 | libboost-dev \ |
Carmelo Cascone | 4d5757d | 2018-11-25 02:26:32 -0800 | [diff] [blame^] | 56 | libboost-graph-dev \ |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 57 | libboost-program-options-dev \ |
| 58 | libboost-system-dev \ |
| 59 | libboost-filesystem-dev \ |
| 60 | libboost-thread-dev \ |
| 61 | libboost-filesystem-dev \ |
| 62 | libboost-program-options-dev \ |
| 63 | libboost-system-dev \ |
| 64 | libboost-test-dev \ |
| 65 | libboost-thread-dev \ |
| 66 | libc6-dev \ |
| 67 | libev-dev \ |
| 68 | libevent-dev \ |
| 69 | libffi-dev \ |
| 70 | libfl-dev \ |
| 71 | libgc-dev \ |
| 72 | libgc1c2 \ |
| 73 | libgflags-dev \ |
| 74 | libgmp-dev \ |
| 75 | libgmp10 \ |
| 76 | libgmpxx4ldbl \ |
| 77 | libjudy-dev \ |
| 78 | libpcap-dev \ |
| 79 | libpcre3-dev \ |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 80 | libreadline6 \ |
| 81 | libreadline6-dev \ |
| 82 | libssl-dev \ |
| 83 | libtool \ |
| 84 | make \ |
| 85 | mktemp \ |
| 86 | pkg-config \ |
| 87 | protobuf-c-compiler \ |
Carmelo Cascone | 57defd3 | 2018-05-11 14:34:01 -0700 | [diff] [blame] | 88 | python2.7 \ |
| 89 | python2.7-dev \ |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 90 | tcpdump \ |
| 91 | wget \ |
| 92 | unzip |
| 93 | |
Charles Chan | 87dc82e | 2018-08-05 16:27:10 -0700 | [diff] [blame] | 94 | sudo -H pip install setuptools cffi ipaddr ipaddress pypcap |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 95 | } |
| 96 | |
| 97 | function do_requirements_1404 { |
| 98 | sudo apt install -y python-software-properties software-properties-common |
| 99 | sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test |
| 100 | sudo add-apt-repository -y ppa:george-edison55/cmake-3.x |
| 101 | sudo apt update |
| 102 | sudo apt install -y \ |
| 103 | dpkg-dev \ |
| 104 | g++-4.9 \ |
| 105 | gcc-4.9 \ |
Kevin Chuang | 53a9d5b | 2018-01-17 15:55:32 +0800 | [diff] [blame] | 106 | cmake \ |
| 107 | libbz2-dev |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 108 | |
| 109 | # Needed for p4c. |
| 110 | sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 50 |
| 111 | sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 50 |
Kevin Chuang | 53a9d5b | 2018-01-17 15:55:32 +0800 | [diff] [blame] | 112 | |
| 113 | if [ -z "$(ldconfig -p | grep libboost_iostreams.so.1.58.0)" ]; then |
| 114 | do_boost |
| 115 | fi |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 116 | } |
| 117 | |
| 118 | function do_requirements_1604 { |
| 119 | sudo apt-get update |
| 120 | sudo apt-get install -y --no-install-recommends \ |
| 121 | ca-certificates \ |
| 122 | g++ \ |
Kevin Chuang | 53a9d5b | 2018-01-17 15:55:32 +0800 | [diff] [blame] | 123 | libboost-iostreams1.58-dev \ |
| 124 | libprotobuf-c-dev |
| 125 | } |
| 126 | |
| 127 | function do_boost { |
| 128 | cd ${BUILD_DIR} |
| 129 | wget https://sourceforge.net/projects/boost/files/boost/1.58.0/boost_1_58_0.tar.bz2/download -O boost_1_58_0.tar.bz2 |
| 130 | tar --bzip2 -xf boost_1_58_0.tar.bz2 |
| 131 | cd boost_1_58_0 |
| 132 | |
| 133 | ./bootstrap.sh --with-libraries=iostreams |
| 134 | sudo ./b2 install |
| 135 | sudo ldconfig |
| 136 | |
| 137 | cd .. |
| 138 | sudo rm -rf boost_1_58_0 |
| 139 | } |
| 140 | |
| 141 | function do_protobuf-c { |
| 142 | cd ${BUILD_DIR} |
| 143 | git clone https://github.com/protobuf-c/protobuf-c.git |
| 144 | cd protobuf-c |
| 145 | |
| 146 | ./autogen.sh |
| 147 | ./configure --prefix=/usr |
| 148 | make -j${NUM_CORES} |
| 149 | sudo make install |
| 150 | sudo ldconfig |
| 151 | |
| 152 | cd .. |
| 153 | sudo rm -rf protobuf-c |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 154 | } |
| 155 | |
| 156 | function do_protobuf { |
| 157 | cd ${BUILD_DIR} |
| 158 | if [ ! -d protobuf ]; then |
| 159 | git clone https://github.com/google/protobuf.git |
| 160 | fi |
| 161 | cd protobuf |
| 162 | git fetch |
| 163 | git checkout ${PROTOBUF_COMMIT} |
| 164 | |
| 165 | export CFLAGS="-Os" |
| 166 | export CXXFLAGS="-Os" |
| 167 | export LDFLAGS="-Wl,-s" |
| 168 | ./autogen.sh |
| 169 | ./configure --prefix=/usr |
| 170 | make -j${NUM_CORES} |
| 171 | sudo make install |
| 172 | sudo ldconfig |
| 173 | unset CFLAGS CXXFLAGS LDFLAGS |
Carmelo Cascone | f645e84 | 2018-07-16 18:31:52 +0200 | [diff] [blame] | 174 | |
| 175 | cd python |
| 176 | sudo python setup.py install --cpp_implementation |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 177 | } |
| 178 | |
| 179 | function do_grpc { |
| 180 | cd ${BUILD_DIR} |
| 181 | if [ ! -d grpc ]; then |
| 182 | git clone https://github.com/grpc/grpc.git |
| 183 | fi |
| 184 | cd grpc |
| 185 | git fetch |
| 186 | git checkout ${GRPC_COMMIT} |
| 187 | git submodule update --init |
| 188 | |
| 189 | export LDFLAGS="-Wl,-s" |
| 190 | make -j${NUM_CORES} |
| 191 | sudo make install |
| 192 | sudo ldconfig |
| 193 | unset LDFLAGS |
Carmelo Cascone | f645e84 | 2018-07-16 18:31:52 +0200 | [diff] [blame] | 194 | |
| 195 | sudo pip install -r requirements.txt |
| 196 | sudo pip install . |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 197 | } |
| 198 | |
| 199 | function do_libyang { |
| 200 | cd ${BUILD_DIR} |
| 201 | if [ ! -d libyang ]; then |
| 202 | git clone https://github.com/CESNET/libyang.git |
| 203 | fi |
| 204 | cd libyang |
| 205 | git fetch |
| 206 | git checkout ${LIBYANG_COMMIT} |
| 207 | |
Kevin Chuang | 53a9d5b | 2018-01-17 15:55:32 +0800 | [diff] [blame] | 208 | mkdir -p build |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 209 | cd build |
| 210 | cmake .. |
| 211 | make -j${NUM_CORES} |
| 212 | sudo make install |
| 213 | sudo ldconfig |
| 214 | } |
| 215 | |
Kevin Chuang | 53a9d5b | 2018-01-17 15:55:32 +0800 | [diff] [blame] | 216 | function do_sysrepo_deps { |
| 217 | RELEASE=`lsb_release -rs` |
| 218 | if version_ge $RELEASE 14.04 && [ -z "$(ldconfig -p | grep libprotobuf-c)" ]; then |
| 219 | do_protobuf-c |
| 220 | fi |
| 221 | } |
| 222 | |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 223 | function do_sysrepo { |
Kevin Chuang | 53a9d5b | 2018-01-17 15:55:32 +0800 | [diff] [blame] | 224 | do_sysrepo_deps |
| 225 | |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 226 | cd ${BUILD_DIR} |
| 227 | if [ ! -d sysrepo ]; then |
| 228 | git clone https://github.com/sysrepo/sysrepo.git |
| 229 | fi |
| 230 | cd sysrepo |
| 231 | git fetch |
| 232 | git checkout ${SYSREPO_COMMIT} |
| 233 | |
Kevin Chuang | 53a9d5b | 2018-01-17 15:55:32 +0800 | [diff] [blame] | 234 | mkdir -p build |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 235 | cd build |
| 236 | cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=Off \ |
| 237 | -DCALL_TARGET_BINS_DIRECTLY=Off .. |
| 238 | make -j${NUM_CORES} |
| 239 | sudo make install |
| 240 | sudo ldconfig |
| 241 | } |
| 242 | |
| 243 | function checkout_bmv2 { |
| 244 | cd ${BUILD_DIR} |
| 245 | if [ ! -d bmv2 ]; then |
| 246 | git clone https://github.com/p4lang/behavioral-model.git bmv2 |
| 247 | fi |
| 248 | cd bmv2 |
| 249 | git fetch |
| 250 | git checkout ${BMV2_COMMIT} |
| 251 | } |
| 252 | |
| 253 | function do_pi_bmv2_deps { |
| 254 | checkout_bmv2 |
| 255 | # From bmv2's install_deps.sh. |
Carmelo Cascone | 95e5afd | 2018-07-17 14:45:23 +0200 | [diff] [blame] | 256 | # Nanomsg is required also by PI. |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 257 | tmpdir=`mktemp -d -p .` |
| 258 | cd ${tmpdir} |
| 259 | bash ../travis/install-thrift.sh |
| 260 | bash ../travis/install-nanomsg.sh |
| 261 | sudo ldconfig |
| 262 | bash ../travis/install-nnpy.sh |
| 263 | cd .. |
| 264 | sudo rm -rf $tmpdir |
| 265 | } |
| 266 | |
Carmelo Cascone | 95e5afd | 2018-07-17 14:45:23 +0200 | [diff] [blame] | 267 | function do_PI { |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 268 | cd ${BUILD_DIR} |
Carmelo Cascone | 95e5afd | 2018-07-17 14:45:23 +0200 | [diff] [blame] | 269 | if [ ! -d PI ]; then |
| 270 | git clone https://github.com/p4lang/PI.git |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 271 | fi |
Carmelo Cascone | 95e5afd | 2018-07-17 14:45:23 +0200 | [diff] [blame] | 272 | cd PI |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 273 | git fetch |
| 274 | git checkout ${PI_COMMIT} |
| 275 | git submodule update --init --recursive |
| 276 | |
| 277 | ./autogen.sh |
Carmelo Cascone | 4f985cd | 2018-02-11 17:36:42 -0800 | [diff] [blame] | 278 | # FIXME: re-enable --with-sysrepo when gNMI support becomes more stable |
Carmelo Cascone | 03ae0ac | 2018-10-11 08:31:59 -0700 | [diff] [blame] | 279 | # ./configure --with-proto --with-sysrepo |
| 280 | ./configure --with-proto --without-internal-rpc --without-cli |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 281 | make -j${NUM_CORES} |
| 282 | sudo make install |
| 283 | sudo ldconfig |
| 284 | |
Carmelo Cascone | 4f985cd | 2018-02-11 17:36:42 -0800 | [diff] [blame] | 285 | # FIXME: re-enable when gNMI support becomes more stable |
| 286 | # sudo proto/sysrepo/install_yangs.sh |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 287 | } |
| 288 | |
| 289 | function do_bmv2 { |
| 290 | checkout_bmv2 |
| 291 | |
| 292 | ./autogen.sh |
Carmelo Cascone | f02872d | 2018-06-20 08:49:02 +0200 | [diff] [blame] | 293 | if [ "${DEBUG_FLAGS}" = true ] ; then |
Carmelo Cascone | 03ae0ac | 2018-10-11 08:31:59 -0700 | [diff] [blame] | 294 | ./configure --with-pi --disable-elogger --without-nanomsg |
Carmelo Cascone | f02872d | 2018-06-20 08:49:02 +0200 | [diff] [blame] | 295 | else |
Carmelo Cascone | 03ae0ac | 2018-10-11 08:31:59 -0700 | [diff] [blame] | 296 | ./configure --with-pi --disable-elogger --without-nanomsg --disable-logging-macros |
Carmelo Cascone | f02872d | 2018-06-20 08:49:02 +0200 | [diff] [blame] | 297 | fi |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 298 | make -j${NUM_CORES} |
| 299 | sudo make install |
| 300 | sudo ldconfig |
| 301 | |
| 302 | # Simple_switch_grpc target |
| 303 | cd targets/simple_switch_grpc |
| 304 | ./autogen.sh |
Carmelo Cascone | 03ae0ac | 2018-10-11 08:31:59 -0700 | [diff] [blame] | 305 | ./configure --with-thrift |
Carmelo Cascone | 4f985cd | 2018-02-11 17:36:42 -0800 | [diff] [blame] | 306 | # FIXME: re-enable --with-sysrepo when gNMI support becomes more stable |
Carmelo Cascone | 03ae0ac | 2018-10-11 08:31:59 -0700 | [diff] [blame] | 307 | # ./configure --with-sysrepo --with-thrift |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 308 | make -j${NUM_CORES} |
| 309 | sudo make install |
| 310 | sudo ldconfig |
| 311 | } |
| 312 | |
| 313 | function do_p4c { |
| 314 | cd ${BUILD_DIR} |
| 315 | if [ ! -d p4c ]; then |
| 316 | git clone https://github.com/p4lang/p4c.git |
| 317 | fi |
| 318 | cd p4c |
| 319 | git fetch |
| 320 | git checkout ${P4C_COMMIT} |
| 321 | git submodule update --init --recursive |
| 322 | |
| 323 | mkdir -p build |
| 324 | cd build |
Carmelo Cascone | 03ae0ac | 2018-10-11 08:31:59 -0700 | [diff] [blame] | 325 | cmake .. -DENABLE_EBPF=OFF |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 326 | make -j${NUM_CORES} |
| 327 | sudo make install |
| 328 | sudo ldconfig |
| 329 | } |
| 330 | |
Carmelo Cascone | 95e5afd | 2018-07-17 14:45:23 +0200 | [diff] [blame] | 331 | function do_scapy-vxlan { |
Carmelo Cascone | 76b3ee6 | 2018-01-30 15:45:27 -0800 | [diff] [blame] | 332 | cd ${BUILD_DIR} |
Carmelo Cascone | 95e5afd | 2018-07-17 14:45:23 +0200 | [diff] [blame] | 333 | if [ ! -d scapy-vxlan ]; then |
| 334 | git clone https://github.com/p4lang/scapy-vxlan.git |
Carmelo Cascone | 76b3ee6 | 2018-01-30 15:45:27 -0800 | [diff] [blame] | 335 | fi |
Carmelo Cascone | 95e5afd | 2018-07-17 14:45:23 +0200 | [diff] [blame] | 336 | cd scapy-vxlan |
| 337 | |
Carmelo Cascone | 76b3ee6 | 2018-01-30 15:45:27 -0800 | [diff] [blame] | 338 | git pull origin master |
| 339 | |
Carmelo Cascone | 95e5afd | 2018-07-17 14:45:23 +0200 | [diff] [blame] | 340 | sudo python setup.py install |
| 341 | } |
| 342 | |
| 343 | function do_ptf { |
| 344 | cd ${BUILD_DIR} |
| 345 | if [ ! -d ptf ]; then |
| 346 | git clone https://github.com/p4lang/ptf.git |
| 347 | fi |
| 348 | cd ptf |
| 349 | git pull origin master |
| 350 | |
| 351 | sudo python setup.py install |
Carmelo Cascone | 76b3ee6 | 2018-01-30 15:45:27 -0800 | [diff] [blame] | 352 | } |
| 353 | |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 354 | function check_commit { |
| 355 | if [ ! -e $2 ]; then |
| 356 | return 0 # true |
| 357 | fi |
| 358 | if [[ $(< $2) != "$1" ]]; then |
| 359 | return 0 # true |
| 360 | fi |
| 361 | return 1 # false |
| 362 | } |
| 363 | |
| 364 | # The following is borrowed from Mininet's util/install.sh |
| 365 | function version_ge { |
| 366 | # sort -V sorts by *version number* |
| 367 | latest=`printf "$1\n$2" | sort -V | tail -1` |
| 368 | # If $1 is latest version, then $1 >= $2 |
| 369 | [ "$1" == "$latest" ] |
| 370 | } |
| 371 | |
| 372 | MUST_DO_ALL=false |
| 373 | DID_REQUIREMENTS=false |
| 374 | function check_and_do { |
| 375 | # Check if the latest built commit is the same we are trying to build now, |
| 376 | # or if all projects must be built. If true builds this project. |
| 377 | commit_id="$1" |
| 378 | proj_dir="$2" |
| 379 | func_name="$3" |
Carmelo Cascone | 95e5afd | 2018-07-17 14:45:23 +0200 | [diff] [blame] | 380 | step_name="$4" |
| 381 | commit_file=${BUILD_DIR}/${proj_dir}/.last_built_commit_${step_name} |
Carmelo Cascone | 0535467 | 2018-04-10 13:24:03 -0700 | [diff] [blame] | 382 | if [ ${MUST_DO_ALL} = true ] \ |
Carmelo Cascone | 95e5afd | 2018-07-17 14:45:23 +0200 | [diff] [blame] | 383 | || check_commit ${commit_id} ${commit_file}; then |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 384 | echo "#" |
Carmelo Cascone | 95e5afd | 2018-07-17 14:45:23 +0200 | [diff] [blame] | 385 | echo "# Building ${step_name} (${commit_id})" |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 386 | echo "#" |
| 387 | # Print commands used to install to aid debugging |
| 388 | set -x |
| 389 | if ! ${DID_REQUIREMENTS} = true; then |
| 390 | do_requirements |
| 391 | # TODO consider other Linux distros; presently this script assumes |
| 392 | # that it is running on Ubuntu. |
| 393 | RELEASE=`lsb_release -rs` |
| 394 | if version_ge $RELEASE 16.04; then |
| 395 | do_requirements_1604 |
| 396 | elif version_ge $RELEASE 14.04; then |
| 397 | do_requirements_1404 |
| 398 | else |
| 399 | echo "Ubuntu version $RELEASE is not supported" |
| 400 | exit 1 |
| 401 | fi |
| 402 | DID_REQUIREMENTS=true |
| 403 | fi |
| 404 | eval ${func_name} |
Carmelo Cascone | 95e5afd | 2018-07-17 14:45:23 +0200 | [diff] [blame] | 405 | echo ${commit_id} > ${commit_file} |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 406 | # Build all next projects as they might depend on this one. |
| 407 | MUST_DO_ALL=true |
| 408 | # Disable printing to reduce output |
| 409 | set +x |
| 410 | else |
Carmelo Cascone | 95e5afd | 2018-07-17 14:45:23 +0200 | [diff] [blame] | 411 | echo "${step_name} is up to date (commit ${commit_id})" |
| 412 | fi |
| 413 | # Exit if last step. |
| 414 | if [ ${step_name} = ${LAST_STEP} ]; then |
| 415 | exit |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 416 | fi |
| 417 | } |
| 418 | |
| 419 | mkdir -p ${BUILD_DIR} |
| 420 | cd ${BUILD_DIR} |
| 421 | # In dependency order. |
| 422 | check_and_do ${PROTOBUF_COMMIT} protobuf do_protobuf protobuf |
| 423 | check_and_do ${GRPC_COMMIT} grpc do_grpc grpc |
Carmelo Cascone | 4f985cd | 2018-02-11 17:36:42 -0800 | [diff] [blame] | 424 | # FIXME: re-enable when gNMI support becomes more stable |
| 425 | # check_and_do ${LIBYANG_COMMIT} libyang do_libyang libyang |
| 426 | # check_and_do ${SYSREPO_COMMIT} sysrepo do_sysrepo sysrepo |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 427 | check_and_do ${BMV2_COMMIT} bmv2 do_pi_bmv2_deps bmv2-deps |
Carmelo Cascone | 95e5afd | 2018-07-17 14:45:23 +0200 | [diff] [blame] | 428 | check_and_do ${PI_COMMIT} PI do_PI PI |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 429 | check_and_do ${BMV2_COMMIT} bmv2 do_bmv2 bmv2 |
| 430 | check_and_do ${P4C_COMMIT} p4c do_p4c p4c |
Carmelo Cascone | 95e5afd | 2018-07-17 14:45:23 +0200 | [diff] [blame] | 431 | check_and_do master scapy-vxlan do_scapy-vxlan scapy-vxlan |
| 432 | check_and_do master ptf do_ptf ptf |
Carmelo Cascone | b7e618d | 2018-01-12 18:31:33 -0800 | [diff] [blame] | 433 | |
| 434 | echo "Done!" |