blob: 29a41ea18f83020e646aa9935ff66a03eee8e149 [file] [log] [blame]
Alexander Afanasyev21034bf2014-09-02 18:31:53 -07001#!/usr/bin/env bash
Shock Jiang2d8483c2014-10-30 10:15:37 -07002set -e
Alexander Afanasyev21034bf2014-09-02 18:31:53 -07003
Alexander Afanasyevc7c99002015-10-09 17:27:30 -07004JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
5source "$JDIR"/util.sh
6
Alexander Afanasyev984ca9d2016-12-19 13:09:14 -08007set -x
8
9pushd "${CACHE_DIR:-/tmp}" >/dev/null
Alexander Afanasyevc7c99002015-10-09 17:27:30 -070010
Davide Pesavento90034832018-05-30 10:10:31 -040011INSTALLED_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
Alexander Afanasyevc7c99002015-10-09 17:27:30 -070024
25sudo rm -Rf ndn-cxx-latest
26
27git clone --depth 1 git://github.com/named-data/ndn-cxx ndn-cxx-latest
28
Davide Pesavento90034832018-05-30 10:10:31 -040029LATEST_VERSION=$(git -C ndn-cxx-latest rev-parse HEAD 2>/dev/null || echo UNKNOWN)
Alexander Afanasyevc7c99002015-10-09 17:27:30 -070030
31if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
32 sudo rm -Rf ndn-cxx
33 mv ndn-cxx-latest ndn-cxx
Alexander Afanasyev21034bf2014-09-02 18:31:53 -070034else
Alexander Afanasyevc7c99002015-10-09 17:27:30 -070035 sudo rm -Rf ndn-cxx-latest
Alexander Afanasyev21034bf2014-09-02 18:31:53 -070036fi
37
Davide Pesavento90034832018-05-30 10:10:31 -040038sudo rm -f /usr/local/bin/ndnsec*
39sudo rm -fr /usr/local/include/ndn-cxx
Alexander Afanasyev21034bf2014-09-02 18:31:53 -070040sudo rm -f /usr/local/lib/libndn-cxx*
Davide Pesavento90034832018-05-30 10:10:31 -040041sudo rm -f /usr/local/lib/pkgconfig/libndn-cxx.pc
Alexander Afanasyev21034bf2014-09-02 18:31:53 -070042
Alexander Afanasyevc7c99002015-10-09 17:27:30 -070043pushd ndn-cxx >/dev/null
Alexander Afanasyev21034bf2014-09-02 18:31:53 -070044
Davide Pesavento90034832018-05-30 10:10:31 -040045./waf configure --color=yes --enable-shared --disable-static --without-osx-keychain
46./waf build --color=yes -j${WAF_JOBS:-1}
Davide Pesavento4a315b32018-11-24 14:32:19 -050047sudo_preserve_env PATH -- ./waf install --color=yes
Alexander Afanasyevc7c99002015-10-09 17:27:30 -070048
49popd >/dev/null
50popd >/dev/null
51
52if has Linux $NODE_LABELS; then
53 sudo ldconfig
Davide Pesavento90034832018-05-30 10:10:31 -040054elif has FreeBSD10 $NODE_LABELS; then
55 sudo ldconfig -m
Alexander Afanasyevc7c99002015-10-09 17:27:30 -070056fi