blob: d89b42692ddeda43780abf5df71df75f21c9537d [file] [log] [blame]
Junxiao Shi439d9722015-03-20 15:08:44 -07001#!/usr/bin/env bash
Davide Pesaventobd3642f2022-08-12 18:19:31 -04002set -exo pipefail
Junxiao Shi439d9722015-03-20 15:08:44 -07003
Davide Pesaventod8398822020-03-29 18:46:19 -04004pushd "$CACHE_DIR" >/dev/null
Junxiao Shi439d9722015-03-20 15:08:44 -07005
Ashlesh Gawande70750cf2017-05-27 17:10:34 +00006INSTALLED_VERSION=
Davide Pesaventobd3642f2022-08-12 18:19:31 -04007if [[ $ID == macos ]]; then
8 BOOST=$(brew list --formula --versions boost)
Ashlesh Gawande70750cf2017-05-27 17:10: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
Junxiao Shi439d9722015-03-20 15:08:44 -070019
Davide Pesaventod8398822020-03-29 18:46:19 -040020sudo rm -rf ndn-cxx-latest
Davide Pesaventofce39632020-03-31 23:16:55 -040021git clone --depth 1 https://github.com/named-data/ndn-cxx.git ndn-cxx-latest
Ashlesh Gawande70750cf2017-05-27 17:10:34 +000022LATEST_VERSION=$(git -C ndn-cxx-latest rev-parse HEAD 2>/dev/null || echo UNKNOWN)
Junxiao Shi439d9722015-03-20 15:08:44 -070023
24if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
Davide Pesaventod8398822020-03-29 18:46:19 -040025 sudo rm -rf ndn-cxx
Junxiao Shi439d9722015-03-20 15:08:44 -070026 mv ndn-cxx-latest ndn-cxx
27else
Davide Pesaventod8398822020-03-29 18:46:19 -040028 sudo rm -rf ndn-cxx-latest
Junxiao Shi439d9722015-03-20 15:08:44 -070029fi
30
Davide Pesavento5485ca92017-08-10 21:47:42 -040031sudo rm -f /usr/local/bin/ndnsec*
32sudo rm -fr /usr/local/include/ndn-cxx
Md Ashiqur Rahman25c37f12018-10-12 17:59:20 +000033sudo rm -f /usr/local/lib{,64}/libndn-cxx*
34sudo rm -f /usr/local/lib{,64}/pkgconfig/libndn-cxx.pc
Junxiao Shi439d9722015-03-20 15:08:44 -070035
36pushd ndn-cxx >/dev/null
37
Davide Pesavento9419dd52024-03-12 18:38:11 -040038./waf --color=yes configure
Davide Pesaventobd3642f2022-08-12 18:19:31 -040039./waf --color=yes build
40sudo ./waf --color=yes install
Junxiao Shi439d9722015-03-20 15:08:44 -070041
42popd >/dev/null
43popd >/dev/null
Joao Pereira4bd28fc2015-07-08 15:30:42 -040044
Davide Pesaventobd3642f2022-08-12 18:19:31 -040045if [[ $ID_LIKE == *linux* ]]; then
Davide Pesavento1df2cff2024-02-09 19:40:03 -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 Pereira4bd28fc2015-07-08 15:30:42 -040049 sudo ldconfig
Joao Pereira4bd28fc2015-07-08 15:30:42 -040050fi