blob: 5da6d35d704fad0daae246e7a9c07bdef282b611 [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 Pesavento573a6212022-07-09 21:56:41 -040038./waf --color=yes configure --disable-static --enable-shared --without-osx-keychain
Davide Pesavento552174c2020-04-16 01:54:08 -040039./waf --color=yes build -j$WAF_JOBS
40sudo_preserve_env PATH -- ./waf --color=yes install
Zhiyi Zhang8617a792017-01-17 16:45:56 -080041
42popd >/dev/null
43popd >/dev/null
44
Davide Pesavento573a6212022-07-09 21:56:41 -040045if has CentOS $NODE_LABELS; then
Davide Pesavento552174c2020-04-16 01:54:08 -040046 sudo tee /etc/ld.so.conf.d/ndn.conf >/dev/null <<< /usr/local/lib64
47fi
Zhiyi Zhang8617a792017-01-17 16:45:56 -080048if has Linux $NODE_LABELS; then
49 sudo ldconfig
Zhiyi Zhang8617a792017-01-17 16:45:56 -080050fi