blob: c9e2a63c46cb8652adea93f36de2ebe317824b7c [file] [log] [blame]
Alexander Afanasyevbc98fcf2014-08-16 23:18:50 -07001#!/usr/bin/env bash
Vince Lehman0a7da612014-10-29 14:39:29 -05002set -e
Alexander Afanasyevbc98fcf2014-08-16 23:18:50 -07003
Alexander Afanasyevf9f39102015-12-01 17:43:40 -08004JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
5source "$JDIR"/util.sh
6
Davide Pesavento6a81b772017-08-20 18:43:46 -04007set -x
8
Davide Pesavento813df802017-08-20 20:53:54 -04009pushd "${CACHE_DIR:-/tmp}" >/dev/null
Alexander Afanasyev24ed83a2015-03-30 11:06:50 -070010
Ashlesh Gawande812af972017-04-21 09:26:37 -050011INSTALLED_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
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050021if [[ -z $INSTALLED_VERSION ]]; then
22 INSTALLED_VERSION=$(git -C ndn-cxx rev-parse HEAD 2>/dev/null || echo NONE)
23fi
Alexander Afanasyev24ed83a2015-03-30 11:06:50 -070024
Muktadir R Chowdhury4c7caad2015-09-03 15:49:22 -050025sudo rm -Rf ndn-cxx-latest
Nick Gordona75fdb22017-07-06 14:10:43 -050026
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050027git clone --depth 1 git://github.com/named-data/ndn-cxx ndn-cxx-latest
Nick Gordonb9c5cec2017-06-08 14:10:27 -050028
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050029LATEST_VERSION=$(git -C ndn-cxx-latest rev-parse HEAD 2>/dev/null || echo UNKNOWN)
30
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
Nick Gordonb9c5cec2017-06-08 14:10:27 -050037
Davide Pesavento6a81b772017-08-20 18:43:46 -040038sudo rm -f /usr/local/bin/ndnsec*
39sudo rm -fr /usr/local/include/ndn-cxx
Alexander Afanasyevbc98fcf2014-08-16 23:18:50 -070040sudo rm -f /usr/local/lib/libndn-cxx*
Davide Pesavento6a81b772017-08-20 18:43:46 -040041sudo rm -f /usr/local/lib/pkgconfig/libndn-cxx.pc
Alexander Afanasyevbc98fcf2014-08-16 23:18:50 -070042
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050043pushd ndn-cxx >/dev/null
Alexander Afanasyevf9f39102015-12-01 17:43:40 -080044
Davide Pesavento813df802017-08-20 20:53:54 -040045./waf configure --color=yes --enable-shared --disable-static --without-osx-keychain
46./waf build --color=yes -j${WAF_JOBS:-1}
Davide Pesavento6a81b772017-08-20 18:43:46 -040047sudo env "PATH=$PATH" ./waf install --color=yes
Alexander Afanasyev24ed83a2015-03-30 11:06:50 -070048
49popd >/dev/null
50popd >/dev/null
Alexander Afanasyevf9f39102015-12-01 17:43:40 -080051
52if has Linux $NODE_LABELS; then
53 sudo ldconfig
Ashlesh Gawande415676b2016-12-22 00:26:23 -060054elif has FreeBSD10 $NODE_LABELS; then
55 sudo ldconfig -m
Alexander Afanasyevf9f39102015-12-01 17:43:40 -080056fi