blob: d89b42692ddeda43780abf5df71df75f21c9537d [file] [log] [blame]
Ashlesh Gawande0b2897e2018-06-20 14:40:47 -05001#!/usr/bin/env bash
Davide Pesaventoda1a4d32022-08-19 19:03:24 -04002set -exo pipefail
Ashlesh Gawande0b2897e2018-06-20 14:40:47 -05003
Davide Pesavento133067f2020-04-02 22:08:27 -04004pushd "$CACHE_DIR" >/dev/null
Ashlesh Gawande0b2897e2018-06-20 14:40:47 -05005
6INSTALLED_VERSION=
Davide Pesaventoda1a4d32022-08-19 19:03:24 -04007if [[ $ID == macos ]]; then
8 BOOST=$(brew list --formula --versions boost)
Ashlesh Gawande0b2897e2018-06-20 14:40:47 -05009 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 Pesavento133067f2020-04-02 22:08:27 -040020sudo rm -rf ndn-cxx-latest
21git clone --depth 1 https://github.com/named-data/ndn-cxx.git ndn-cxx-latest
Ashlesh Gawande0b2897e2018-06-20 14:40:47 -050022LATEST_VERSION=$(git -C ndn-cxx-latest rev-parse HEAD 2>/dev/null || echo UNKNOWN)
23
24if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
Davide Pesavento133067f2020-04-02 22:08:27 -040025 sudo rm -rf ndn-cxx
Ashlesh Gawande0b2897e2018-06-20 14:40:47 -050026 mv ndn-cxx-latest ndn-cxx
27else
Davide Pesavento133067f2020-04-02 22:08:27 -040028 sudo rm -rf ndn-cxx-latest
Ashlesh Gawande0b2897e2018-06-20 14:40:47 -050029fi
30
31sudo rm -f /usr/local/bin/ndnsec*
32sudo rm -fr /usr/local/include/ndn-cxx
Davide Pesavento1526fee2019-03-18 19:31:55 -040033sudo rm -f /usr/local/lib{,64}/libndn-cxx*
34sudo rm -f /usr/local/lib{,64}/pkgconfig/libndn-cxx.pc
Ashlesh Gawande0b2897e2018-06-20 14:40:47 -050035
36pushd ndn-cxx >/dev/null
37
Davide Pesavento9fa6f8d2024-03-12 19:40:26 -040038./waf --color=yes configure
Davide Pesaventoda1a4d32022-08-19 19:03:24 -040039./waf --color=yes build
40sudo ./waf --color=yes install
Ashlesh Gawande0b2897e2018-06-20 14:40:47 -050041
42popd >/dev/null
43popd >/dev/null
44
Davide Pesaventoda1a4d32022-08-19 19:03:24 -040045if [[ $ID_LIKE == *linux* ]]; then
Davide Pesavento8d6192a2024-02-09 21:23:50 -050046 if [[ $(uname -m) == x86_64 && -d /usr/lib64 ]]; then
47 sudo tee /etc/ld.so.conf.d/ndn.conf >/dev/null <<< /usr/local/lib64
48 fi
Ashlesh Gawande0b2897e2018-06-20 14:40:47 -050049 sudo ldconfig
Ashlesh Gawande0b2897e2018-06-20 14:40:47 -050050fi