blob: 6c7fb220fdc5829b438352a5570a87dbe1064d03 [file] [log] [blame]
Alexander Afanasyevbc98fcf2014-08-16 23:18:50 -07001#!/usr/bin/env bash
Davide Pesaventoede59632022-08-26 20:35:44 -04002set -exo pipefail
Alexander Afanasyevbc98fcf2014-08-16 23:18:50 -07003
Davide Pesaventof6be8e32020-04-30 16:06:03 -04004pushd "$CACHE_DIR" >/dev/null
Alexander Afanasyev24ed83a2015-03-30 11:06:50 -07005
Ashlesh Gawande812af972017-04-21 09:26:37 -05006INSTALLED_VERSION=
Davide Pesaventoede59632022-08-26 20:35:44 -04007if [[ $ID == macos ]]; then
8 BOOST=$(brew list --formula --versions boost)
Ashlesh Gawande812af972017-04-21 09:26:37 -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
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050016if [[ -z $INSTALLED_VERSION ]]; then
17 INSTALLED_VERSION=$(git -C ndn-cxx rev-parse HEAD 2>/dev/null || echo NONE)
18fi
Alexander Afanasyev24ed83a2015-03-30 11:06:50 -070019
Davide Pesaventof6be8e32020-04-30 16:06:03 -040020sudo rm -rf ndn-cxx-latest
21git clone --depth 1 https://github.com/named-data/ndn-cxx.git ndn-cxx-latest
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050022LATEST_VERSION=$(git -C ndn-cxx-latest rev-parse HEAD 2>/dev/null || echo UNKNOWN)
23
24if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
Davide Pesaventof6be8e32020-04-30 16:06:03 -040025 sudo rm -rf ndn-cxx
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050026 mv ndn-cxx-latest ndn-cxx
27else
Davide Pesaventof6be8e32020-04-30 16:06:03 -040028 sudo rm -rf ndn-cxx-latest
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050029fi
Nick Gordonb9c5cec2017-06-08 14:10:27 -050030
Davide Pesavento6a81b772017-08-20 18:43:46 -040031sudo rm -f /usr/local/bin/ndnsec*
32sudo rm -fr /usr/local/include/ndn-cxx
Davide Pesavento0b0eddd2019-03-19 14:42:15 -040033sudo rm -f /usr/local/lib{,64}/libndn-cxx*
34sudo rm -f /usr/local/lib{,64}/pkgconfig/libndn-cxx.pc
Alexander Afanasyevbc98fcf2014-08-16 23:18:50 -070035
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050036pushd ndn-cxx >/dev/null
Alexander Afanasyevf9f39102015-12-01 17:43:40 -080037
Davide Pesaventoede59632022-08-26 20:35:44 -040038./waf --color=yes configure --without-osx-keychain
39./waf --color=yes build
40sudo ./waf --color=yes install
Alexander Afanasyev24ed83a2015-03-30 11:06:50 -070041
42popd >/dev/null
43popd >/dev/null
Alexander Afanasyevf9f39102015-12-01 17:43:40 -080044
Davide Pesaventoede59632022-08-26 20:35:44 -040045if [[ $ID_LIKE == *linux* ]]; then
Davide Pesavento543f2b62024-02-10 16:22:24 -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
Alexander Afanasyevf9f39102015-12-01 17:43:40 -080049 sudo ldconfig
Alexander Afanasyevf9f39102015-12-01 17:43:40 -080050fi