blob: 7bf1cfe34d11480cccb665f1a72144a866b5ce8e [file] [log] [blame]
Zhiyi Zhang8617a792017-01-17 16:45:56 -08001#!/usr/bin/env bash
Davide Pesavento552174c2020-04-16 01:54:08 -04002set -ex
Zhiyi Zhang8617a792017-01-17 16:45:56 -08003
Davide Pesavento552174c2020-04-16 01:54:08 -04004pushd "$CACHE_DIR" >/dev/null
Zhiyi Zhang8617a792017-01-17 16:45:56 -08005
Ashlesh Gawande7ed62042017-05-28 13:42: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
Zhiyi Zhang8617a792017-01-17 16:45:56 -080019
Davide Pesavento552174c2020-04-16 01:54:08 -040020sudo rm -rf ndn-cxx-latest
21git clone --depth 1 https://github.com/named-data/ndn-cxx.git ndn-cxx-latest
Ashlesh Gawande7ed62042017-05-28 13:42:34 +000022LATEST_VERSION=$(git -C ndn-cxx-latest rev-parse HEAD 2>/dev/null || echo UNKNOWN)
Zhiyi Zhangdefa9592017-02-21 10:56:22 -080023
Zhiyi Zhang8617a792017-01-17 16:45:56 -080024if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
Davide Pesavento552174c2020-04-16 01:54:08 -040025 sudo rm -rf ndn-cxx
Zhiyi Zhang8617a792017-01-17 16:45:56 -080026 mv ndn-cxx-latest ndn-cxx
Zhiyi Zhang8617a792017-01-17 16:45:56 -080027else
Davide Pesavento552174c2020-04-16 01:54:08 -040028 sudo rm -rf ndn-cxx-latest
Zhiyi Zhang8617a792017-01-17 16:45:56 -080029fi
30
Davide Pesaventocf9ffe42018-01-21 22:21:53 -050031sudo rm -f /usr/local/bin/ndnsec*
32sudo rm -fr /usr/local/include/ndn-cxx
Davide Pesavento552174c2020-04-16 01:54:08 -040033sudo rm -f /usr/local/lib{,64}/libndn-cxx*
34sudo rm -f /usr/local/lib{,64}/pkgconfig/libndn-cxx.pc
Zhiyi Zhang8617a792017-01-17 16:45:56 -080035
36pushd ndn-cxx >/dev/null
37
Davide Pesavento552174c2020-04-16 01:54:08 -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
Zhiyi Zhang8617a792017-01-17 16:45:56 -080050
51popd >/dev/null
52popd >/dev/null
53
Davide Pesavento552174c2020-04-16 01:54:08 -040054if has CentOS-8 $NODE_LABELS; then
55 sudo tee /etc/ld.so.conf.d/ndn.conf >/dev/null <<< /usr/local/lib64
56fi
Zhiyi Zhang8617a792017-01-17 16:45:56 -080057if has Linux $NODE_LABELS; then
58 sudo ldconfig
Zhiyi Zhang8617a792017-01-17 16:45:56 -080059fi