blob: 91ebefd7613eaee0239f217f48cdcf46970b32ce [file] [log] [blame]
Zhiyi Zhang8617a792017-01-17 16:45:56 -08001#!/usr/bin/env bash
Davide Pesavento6d1b6722022-08-20 17:54:05 -04002set -exo pipefail
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=
Davide Pesavento6d1b6722022-08-20 17:54:05 -04007if [[ $ID == macos ]]; then
8 BOOST=$(brew list --formula --versions boost)
Ashlesh Gawande7ed62042017-05-28 13:42:34 +00009 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 Pesavento6d1b6722022-08-20 17:54:05 -040038./waf --color=yes configure --without-osx-keychain
39./waf --color=yes build
40sudo ./waf --color=yes install
Zhiyi Zhang8617a792017-01-17 16:45:56 -080041
42popd >/dev/null
43popd >/dev/null
44
Davide Pesavento6d1b6722022-08-20 17:54:05 -040045if [[ $ID_LIKE == *fedora* ]]; then
Davide Pesavento552174c2020-04-16 01:54:08 -040046 sudo tee /etc/ld.so.conf.d/ndn.conf >/dev/null <<< /usr/local/lib64
47fi
Davide Pesavento6d1b6722022-08-20 17:54:05 -040048if [[ $ID_LIKE == *linux* ]]; then
Zhiyi Zhang8617a792017-01-17 16:45:56 -080049 sudo ldconfig
Zhiyi Zhang8617a792017-01-17 16:45:56 -080050fi