blob: 91ebefd7613eaee0239f217f48cdcf46970b32ce [file] [log] [blame]
Alexander Afanasyev21034bf2014-09-02 18:31:53 -07001#!/usr/bin/env bash
Davide Pesavento423553e2022-08-19 20:46:06 -04002set -exo pipefail
Alexander Afanasyev21034bf2014-09-02 18:31:53 -07003
Davide Pesaventofee7ee32020-04-15 02:45:07 -04004pushd "$CACHE_DIR" >/dev/null
Alexander Afanasyevc7c99002015-10-09 17:27:30 -07005
Davide Pesavento90034832018-05-30 10:10:31 -04006INSTALLED_VERSION=
Davide Pesavento423553e2022-08-19 20:46:06 -04007if [[ $ID == macos ]]; then
8 BOOST=$(brew list --formula --versions boost)
Davide Pesavento90034832018-05-30 10:10:31 -04009 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
Alexander Afanasyevc7c99002015-10-09 17:27:30 -070019
Davide Pesaventofee7ee32020-04-15 02:45:07 -040020sudo rm -rf ndn-cxx-latest
21git clone --depth 1 https://github.com/named-data/ndn-cxx.git ndn-cxx-latest
Davide Pesavento90034832018-05-30 10:10:31 -040022LATEST_VERSION=$(git -C ndn-cxx-latest rev-parse HEAD 2>/dev/null || echo UNKNOWN)
Alexander Afanasyevc7c99002015-10-09 17:27:30 -070023
24if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
Davide Pesaventofee7ee32020-04-15 02:45:07 -040025 sudo rm -rf ndn-cxx
Alexander Afanasyevc7c99002015-10-09 17:27:30 -070026 mv ndn-cxx-latest ndn-cxx
Alexander Afanasyev21034bf2014-09-02 18:31:53 -070027else
Davide Pesaventofee7ee32020-04-15 02:45:07 -040028 sudo rm -rf ndn-cxx-latest
Alexander Afanasyev21034bf2014-09-02 18:31:53 -070029fi
30
Davide Pesavento90034832018-05-30 10:10:31 -040031sudo rm -f /usr/local/bin/ndnsec*
32sudo rm -fr /usr/local/include/ndn-cxx
Davide Pesaventofee7ee32020-04-15 02:45:07 -040033sudo rm -f /usr/local/lib{,64}/libndn-cxx*
34sudo rm -f /usr/local/lib{,64}/pkgconfig/libndn-cxx.pc
Alexander Afanasyev21034bf2014-09-02 18:31:53 -070035
Alexander Afanasyevc7c99002015-10-09 17:27:30 -070036pushd ndn-cxx >/dev/null
Alexander Afanasyev21034bf2014-09-02 18:31:53 -070037
Davide Pesavento423553e2022-08-19 20:46:06 -040038./waf --color=yes configure --without-osx-keychain
39./waf --color=yes build
40sudo ./waf --color=yes install
Alexander Afanasyevc7c99002015-10-09 17:27:30 -070041
42popd >/dev/null
43popd >/dev/null
44
Davide Pesavento423553e2022-08-19 20:46:06 -040045if [[ $ID_LIKE == *fedora* ]]; then
Davide Pesaventofee7ee32020-04-15 02:45:07 -040046 sudo tee /etc/ld.so.conf.d/ndn.conf >/dev/null <<< /usr/local/lib64
47fi
Davide Pesavento423553e2022-08-19 20:46:06 -040048if [[ $ID_LIKE == *linux* ]]; then
Alexander Afanasyevc7c99002015-10-09 17:27:30 -070049 sudo ldconfig
Alexander Afanasyevc7c99002015-10-09 17:27:30 -070050fi