blob: 29a41ea18f83020e646aa9935ff66a03eee8e149 [file] [log] [blame]
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -07001#!/usr/bin/env bash
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -07002set -e
3
Joao Pereira08f07012015-07-06 18:13:29 -04004JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
5source "$JDIR"/util.sh
6
Davide Pesaventoe0edc4c2016-09-13 18:29:52 +00007set -x
8
9pushd "${CACHE_DIR:-/tmp}" >/dev/null
Joao Pereira08f07012015-07-06 18:13:29 -040010
Ashlesh Gawande6f6ef012017-05-11 16:05:40 +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
Joao Pereira08f07012015-07-06 18:13:29 -040024
25sudo rm -Rf ndn-cxx-latest
26
27git clone --depth 1 git://github.com/named-data/ndn-cxx ndn-cxx-latest
28
Junxiao Shi33a24e82017-05-27 17:09:31 +000029LATEST_VERSION=$(git -C ndn-cxx-latest rev-parse HEAD 2>/dev/null || echo UNKNOWN)
Joao Pereira08f07012015-07-06 18:13:29 -040030
31if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
32 sudo rm -Rf ndn-cxx
33 mv ndn-cxx-latest ndn-cxx
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -070034else
Joao Pereira08f07012015-07-06 18:13:29 -040035 sudo rm -Rf ndn-cxx-latest
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -070036fi
37
Davide Pesavento9ac95d32017-07-01 01:51:37 -040038sudo rm -f /usr/local/bin/ndnsec*
39sudo rm -fr /usr/local/include/ndn-cxx
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -070040sudo rm -f /usr/local/lib/libndn-cxx*
Davide Pesavento9ac95d32017-07-01 01:51:37 -040041sudo rm -f /usr/local/lib/pkgconfig/libndn-cxx.pc
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -070042
Joao Pereira08f07012015-07-06 18:13:29 -040043pushd ndn-cxx >/dev/null
Alexander Afanasyev4d4e7252014-10-25 12:21:53 -070044
Davide Pesavento9ac95d32017-07-01 01:51:37 -040045./waf configure --color=yes --enable-shared --disable-static --without-osx-keychain
46./waf build --color=yes -j${WAF_JOBS:-1}
Davide Pesaventodda258a2018-09-06 02:43:10 -040047sudo_preserve_env PATH -- ./waf install --color=yes
Joao Pereira08f07012015-07-06 18:13:29 -040048
49popd >/dev/null
50popd >/dev/null
51
52if has Linux $NODE_LABELS; then
53 sudo ldconfig
Ashlesh Gawande6f6ef012017-05-11 16:05:40 +000054elif has FreeBSD10 $NODE_LABELS; then
55 sudo ldconfig -m
Joao Pereira08f07012015-07-06 18:13:29 -040056fi