blob: 0225e2d269bb97cf6659973ebde3275c2b6bf8cd [file] [log] [blame]
Junxiao Shi439d9722015-03-20 15:08:44 -07001#!/usr/bin/env bash
Junxiao Shi439d9722015-03-20 15:08:44 -07002set -e
3
Joao Pereira4bd28fc2015-07-08 15:30:42 -04004JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
5source "$JDIR"/util.sh
6
Davide Pesavento956ac312016-09-20 19:11:30 +02007set -x
8
9pushd "${CACHE_DIR:-/tmp}" >/dev/null
Junxiao Shi439d9722015-03-20 15:08:44 -070010
Ashlesh Gawande70750cf2017-05-27 17:10:34 +000011INSTALLED_VERSION=
12if has OSX $NODE_LABELS; then
13 BOOST=$(brew ls --versions boost)
14 OLD_BOOST=$(cat boost.txt || :)
15 if [[ $OLD_BOOST != $BOOST ]]; then
16 echo "$BOOST" > boost.txt
17 INSTALLED_VERSION=NONE
18 fi
19fi
20
21if [[ -z $INSTALLED_VERSION ]]; then
22 INSTALLED_VERSION=$(git -C ndn-cxx rev-parse HEAD 2>/dev/null || echo NONE)
23fi
Junxiao Shi439d9722015-03-20 15:08:44 -070024
25sudo rm -Rf ndn-cxx-latest
Joao Pereira4bd28fc2015-07-08 15:30:42 -040026
Junxiao Shi439d9722015-03-20 15:08:44 -070027git clone --depth 1 git://github.com/named-data/ndn-cxx ndn-cxx-latest
Joao Pereira4bd28fc2015-07-08 15:30:42 -040028
Ashlesh Gawande70750cf2017-05-27 17:10:34 +000029LATEST_VERSION=$(git -C ndn-cxx-latest rev-parse HEAD 2>/dev/null || echo UNKNOWN)
Junxiao Shi439d9722015-03-20 15:08:44 -070030
31if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
32 sudo rm -Rf ndn-cxx
33 mv ndn-cxx-latest ndn-cxx
34else
35 sudo rm -Rf ndn-cxx-latest
36fi
37
Davide Pesavento5485ca92017-08-10 21:47:42 -040038sudo rm -f /usr/local/bin/ndnsec*
39sudo rm -fr /usr/local/include/ndn-cxx
Junxiao Shi439d9722015-03-20 15:08:44 -070040sudo rm -f /usr/local/lib/libndn-cxx*
Davide Pesavento5485ca92017-08-10 21:47:42 -040041sudo rm -f /usr/local/lib/pkgconfig/libndn-cxx.pc
Junxiao Shi439d9722015-03-20 15:08:44 -070042
43pushd ndn-cxx >/dev/null
44
Ashlesh Gawande70750cf2017-05-27 17:10:34 +000045./waf configure -j1 --color=yes --enable-shared --disable-static --without-osx-keychain
46./waf -j1 --color=yes
Davide Pesavento5485ca92017-08-10 21:47:42 -040047sudo env "PATH=$PATH" ./waf install --color=yes
Junxiao Shi439d9722015-03-20 15:08:44 -070048
49popd >/dev/null
50popd >/dev/null
Joao Pereira4bd28fc2015-07-08 15:30:42 -040051
52if has Linux $NODE_LABELS; then
53 sudo ldconfig
Ashlesh Gawande70750cf2017-05-27 17:10:34 +000054elif has FreeBSD10 $NODE_LABELS; then
55 sudo ldconfig -m
Joao Pereira4bd28fc2015-07-08 15:30:42 -040056fi