blob: e25dd2aeff6e307788b9bed6af1859768f86dd0e [file] [log] [blame]
Zhiyi Zhang8617a792017-01-17 16:45:56 -08001#!/usr/bin/env bash
2set -e
3
4JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
5source "$JDIR"/util.sh
6
7set -x
8
9pushd "${CACHE_DIR:-/tmp}" >/dev/null
10
Ashlesh Gawande7ed62042017-05-28 13:42: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
Zhiyi Zhang8617a792017-01-17 16:45:56 -080024
25sudo rm -Rf ndn-cxx-latest
26
27git clone --depth 1 git://github.com/named-data/ndn-cxx ndn-cxx-latest
28
Ashlesh Gawande7ed62042017-05-28 13:42:34 +000029LATEST_VERSION=$(git -C ndn-cxx-latest rev-parse HEAD 2>/dev/null || echo UNKNOWN)
Zhiyi Zhangdefa9592017-02-21 10:56:22 -080030
Zhiyi Zhang8617a792017-01-17 16:45:56 -080031if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
32 sudo rm -Rf ndn-cxx
33 mv ndn-cxx-latest ndn-cxx
Zhiyi Zhang8617a792017-01-17 16:45:56 -080034else
35 sudo rm -Rf ndn-cxx-latest
36fi
37
38sudo rm -Rf /usr/local/include/ndn-cxx
39sudo rm -f /usr/local/lib/libndn-cxx*
40sudo rm -f /usr/local/lib/pkgconfig/libndn-cxx*
41
42pushd ndn-cxx >/dev/null
43
Ashlesh Gawande7ed62042017-05-28 13:42:34 +000044./waf configure -j1 --color=yes --enable-shared --disable-static --without-osx-keychain
45./waf -j1 --color=yes
46sudo ./waf install -j1 --color=yes
Zhiyi Zhang8617a792017-01-17 16:45:56 -080047
48popd >/dev/null
49popd >/dev/null
50
51if has Linux $NODE_LABELS; then
52 sudo ldconfig
Ashlesh Gawande7ed62042017-05-28 13:42:34 +000053elif has FreeBSD10 $NODE_LABELS; then
54 sudo ldconfig -m
Zhiyi Zhang8617a792017-01-17 16:45:56 -080055fi