blob: d89b42692ddeda43780abf5df71df75f21c9537d [file] [log] [blame]
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -07001#!/usr/bin/env bash
Davide Pesavento72517b52022-08-13 18:50:55 -04002set -exo pipefail
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -07003
Davide Pesavento69857c32020-04-05 16:36:26 -04004pushd "$CACHE_DIR" >/dev/null
Joao Pereira08f07012015-07-06 18:13:29 -04005
Ashlesh Gawande6f6ef012017-05-11 16:05:40 +00006INSTALLED_VERSION=
Davide Pesavento72517b52022-08-13 18:50:55 -04007if [[ $ID == macos ]]; then
8 BOOST=$(brew list --formula --versions boost)
Ashlesh Gawande6f6ef012017-05-11 16:05:40 +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
Joao Pereira08f07012015-07-06 18:13:29 -040019
Davide Pesavento69857c32020-04-05 16:36:26 -040020sudo rm -rf ndn-cxx-latest
21git clone --depth 1 https://github.com/named-data/ndn-cxx.git ndn-cxx-latest
Junxiao Shi33a24e82017-05-27 17:09:31 +000022LATEST_VERSION=$(git -C ndn-cxx-latest rev-parse HEAD 2>/dev/null || echo UNKNOWN)
Joao Pereira08f07012015-07-06 18:13:29 -040023
24if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
Davide Pesavento69857c32020-04-05 16:36:26 -040025 sudo rm -rf ndn-cxx
Joao Pereira08f07012015-07-06 18:13:29 -040026 mv ndn-cxx-latest ndn-cxx
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -070027else
Davide Pesavento69857c32020-04-05 16:36:26 -040028 sudo rm -rf ndn-cxx-latest
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -070029fi
30
Davide Pesavento9ac95d32017-07-01 01:51:37 -040031sudo rm -f /usr/local/bin/ndnsec*
32sudo rm -fr /usr/local/include/ndn-cxx
Md Ashiqur Rahman922330b2018-09-04 17:55:18 +000033sudo rm -f /usr/local/lib{,64}/libndn-cxx*
34sudo rm -f /usr/local/lib{,64}/pkgconfig/libndn-cxx.pc
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -070035
Joao Pereira08f07012015-07-06 18:13:29 -040036pushd ndn-cxx >/dev/null
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -070037
Davide Pesavento44198de2024-03-12 20:30:24 -040038./waf --color=yes configure
Davide Pesavento72517b52022-08-13 18:50:55 -040039./waf --color=yes build
40sudo ./waf --color=yes install
Joao Pereira08f07012015-07-06 18:13:29 -040041
42popd >/dev/null
43popd >/dev/null
44
Davide Pesavento72517b52022-08-13 18:50:55 -040045if [[ $ID_LIKE == *linux* ]]; then
Davide Pesaventoa1b15192024-02-09 19:27:34 -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
Joao Pereira08f07012015-07-06 18:13:29 -040049 sudo ldconfig
Joao Pereira08f07012015-07-06 18:13:29 -040050fi