blob: 7bf1cfe34d11480cccb665f1a72144a866b5ce8e [file] [log] [blame]
Alexander Afanasyevf34a3552017-08-13 21:17:05 -04001#!/usr/bin/env bash
Davide Pesavento4a160042020-04-13 16:50:02 -04002set -ex
Alexander Afanasyevf34a3552017-08-13 21:17:05 -04003
Davide Pesavento4a160042020-04-13 16:50:02 -04004pushd "$CACHE_DIR" >/dev/null
Alexander Afanasyevf34a3552017-08-13 21:17:05 -04005
6INSTALLED_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
19
Davide Pesavento4a160042020-04-13 16:50:02 -040020sudo rm -rf ndn-cxx-latest
21git clone --depth 1 https://github.com/named-data/ndn-cxx.git ndn-cxx-latest
Alexander Afanasyevf34a3552017-08-13 21:17:05 -040022LATEST_VERSION=$(git -C ndn-cxx-latest rev-parse HEAD 2>/dev/null || echo UNKNOWN)
23
24if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
Davide Pesavento4a160042020-04-13 16:50:02 -040025 sudo rm -rf ndn-cxx
Alexander Afanasyevf34a3552017-08-13 21:17:05 -040026 mv ndn-cxx-latest ndn-cxx
27else
Davide Pesavento4a160042020-04-13 16:50:02 -040028 sudo rm -rf ndn-cxx-latest
Alexander Afanasyevf34a3552017-08-13 21:17:05 -040029fi
30
31sudo rm -f /usr/local/bin/ndnsec*
32sudo rm -fr /usr/local/include/ndn-cxx
Davide Pesavento4a160042020-04-13 16:50:02 -040033sudo rm -f /usr/local/lib{,64}/libndn-cxx*
34sudo rm -f /usr/local/lib{,64}/pkgconfig/libndn-cxx.pc
Alexander Afanasyevf34a3552017-08-13 21:17:05 -040035
36pushd ndn-cxx >/dev/null
37
Davide Pesavento4a160042020-04-13 16:50:02 -040038if has Linux $NODE_LABELS && [[ $CXX != clang* && -z $DISABLE_ASAN ]]; then
39 # https://stackoverflow.com/a/47022141
40 ASAN="--with-sanitizer=address"
41fi
42if has CentOS-8 $NODE_LABELS; then
43 # https://bugzilla.redhat.com/show_bug.cgi?id=1721553
44 PCH="--without-pch"
45fi
46
47./waf --color=yes configure --disable-static --enable-shared --without-osx-keychain $ASAN $PCH
48./waf --color=yes build -j$WAF_JOBS
49sudo_preserve_env PATH -- ./waf --color=yes install
Alexander Afanasyevf34a3552017-08-13 21:17:05 -040050
51popd >/dev/null
52popd >/dev/null
53
Davide Pesavento4a160042020-04-13 16:50:02 -040054if has CentOS-8 $NODE_LABELS; then
55 sudo tee /etc/ld.so.conf.d/ndn.conf >/dev/null <<< /usr/local/lib64
56fi
Alexander Afanasyevf34a3552017-08-13 21:17:05 -040057if has Linux $NODE_LABELS; then
58 sudo ldconfig
Alexander Afanasyevf34a3552017-08-13 21:17:05 -040059fi