blob: 7bf1cfe34d11480cccb665f1a72144a866b5ce8e [file] [log] [blame]
Junxiao Shi439d9722015-03-20 15:08:44 -07001#!/usr/bin/env bash
Davide Pesaventod8398822020-03-29 18:46:19 -04002set -ex
Junxiao Shi439d9722015-03-20 15:08:44 -07003
Davide Pesaventod8398822020-03-29 18:46:19 -04004pushd "$CACHE_DIR" >/dev/null
Junxiao Shi439d9722015-03-20 15:08:44 -07005
Ashlesh Gawande70750cf2017-05-27 17:10:34 +00006INSTALLED_VERSION=
7if has OSX $NODE_LABELS; then
8 BOOST=$(brew ls --versions boost)
9 OLD_BOOST=$(cat boost.txt || :)
10 if [[ $OLD_BOOST != $BOOST ]]; then
11 echo "$BOOST" > boost.txt
12 INSTALLED_VERSION=NONE
13 fi
14fi
15
16if [[ -z $INSTALLED_VERSION ]]; then
17 INSTALLED_VERSION=$(git -C ndn-cxx rev-parse HEAD 2>/dev/null || echo NONE)
18fi
Junxiao Shi439d9722015-03-20 15:08:44 -070019
Davide Pesaventod8398822020-03-29 18:46:19 -040020sudo rm -rf ndn-cxx-latest
Davide Pesaventofce39632020-03-31 23:16:55 -040021git clone --depth 1 https://github.com/named-data/ndn-cxx.git ndn-cxx-latest
Ashlesh Gawande70750cf2017-05-27 17:10:34 +000022LATEST_VERSION=$(git -C ndn-cxx-latest rev-parse HEAD 2>/dev/null || echo UNKNOWN)
Junxiao Shi439d9722015-03-20 15:08:44 -070023
24if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
Davide Pesaventod8398822020-03-29 18:46:19 -040025 sudo rm -rf ndn-cxx
Junxiao Shi439d9722015-03-20 15:08:44 -070026 mv ndn-cxx-latest ndn-cxx
27else
Davide Pesaventod8398822020-03-29 18:46:19 -040028 sudo rm -rf ndn-cxx-latest
Junxiao Shi439d9722015-03-20 15:08:44 -070029fi
30
Davide Pesavento5485ca92017-08-10 21:47:42 -040031sudo rm -f /usr/local/bin/ndnsec*
32sudo rm -fr /usr/local/include/ndn-cxx
Md Ashiqur Rahman25c37f12018-10-12 17:59:20 +000033sudo rm -f /usr/local/lib{,64}/libndn-cxx*
34sudo rm -f /usr/local/lib{,64}/pkgconfig/libndn-cxx.pc
Junxiao Shi439d9722015-03-20 15:08:44 -070035
36pushd ndn-cxx >/dev/null
37
Davide Pesaventod5c24472020-04-01 17:46:18 -040038if has Linux $NODE_LABELS && [[ $CXX != clang* && -z $DISABLE_ASAN ]]; then
39 # https://stackoverflow.com/a/47022141
40 ASAN="--with-sanitizer=address"
41fi
Davide Pesaventod8398822020-03-29 18:46:19 -040042if has CentOS-8 $NODE_LABELS; then
Davide Pesaventod5c24472020-04-01 17:46:18 -040043 # https://bugzilla.redhat.com/show_bug.cgi?id=1721553
Davide Pesaventod8398822020-03-29 18:46:19 -040044 PCH="--without-pch"
45fi
46
Davide Pesaventod5c24472020-04-01 17:46:18 -040047./waf --color=yes configure --disable-static --enable-shared --without-osx-keychain $ASAN $PCH
Davide Pesaventoa1a9d702020-03-29 00:58:15 -040048./waf --color=yes build -j$WAF_JOBS
Davide Pesavento9fa6a782020-03-10 19:47:06 -040049sudo_preserve_env PATH -- ./waf --color=yes install
Junxiao Shi439d9722015-03-20 15:08:44 -070050
51popd >/dev/null
52popd >/dev/null
Joao Pereira4bd28fc2015-07-08 15:30:42 -040053
Davide Pesaventod8398822020-03-29 18:46:19 -040054if has CentOS-8 $NODE_LABELS; then
55 sudo tee /etc/ld.so.conf.d/ndn.conf >/dev/null <<< /usr/local/lib64
56fi
Joao Pereira4bd28fc2015-07-08 15:30:42 -040057if has Linux $NODE_LABELS; then
58 sudo ldconfig
Joao Pereira4bd28fc2015-07-08 15:30:42 -040059fi