blob: c93f3b9a952bddcfa876ee233557885c53910da8 [file] [log] [blame]
Ashlesh Gawande415676b2016-12-22 00:26:23 -06001#!/usr/bin/env bash
Ashlesh Gawande415676b2016-12-22 00:26:23 -06002set -e
3
4JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
5source "$JDIR"/util.sh
6
Davide Pesavento813df802017-08-20 20:53:54 -04007set -x
8
9pushd "${CACHE_DIR:-/tmp}" >/dev/null
Ashlesh Gawande415676b2016-12-22 00:26:23 -060010
11INSTALLED_VERSION=
Ashlesh Gawande05cb7282018-08-30 14:39:41 -050012NDN_CXX=$(ndnsec version)
13OLD_NDN_CXX=$(cat ndn_cxx_chrono.txt || :)
14if [[ $OLD_NDN_CXX != $NDN_CXX ]]; then
15 echo "$NDN_CXX" > ndn_cxx_chrono.txt
16 INSTALLED_VERSION=NONE
17fi
18
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050019if [[ -z $INSTALLED_VERSION ]]; then
20 INSTALLED_VERSION=$(git -C ChronoSync rev-parse HEAD 2>/dev/null || echo NONE)
21fi
Ashlesh Gawande415676b2016-12-22 00:26:23 -060022
23sudo rm -Rf ChronoSync-latest
Ashlesh Gawande415676b2016-12-22 00:26:23 -060024
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050025git clone --depth 1 git://github.com/named-data/ChronoSync ChronoSync-latest
Nick Gordonb9c5cec2017-06-08 14:10:27 -050026
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050027LATEST_VERSION=$(git -C ChronoSync-latest rev-parse HEAD 2>/dev/null || echo UNKNOWN)
28
29if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
30 sudo rm -Rf ChronoSync
31 mv ChronoSync-latest ChronoSync
32else
33 sudo rm -Rf ChronoSync-latest
34fi
Nick Gordonb9c5cec2017-06-08 14:10:27 -050035
Davide Pesavento6a81b772017-08-20 18:43:46 -040036sudo rm -fr /usr/local/include/ChronoSync
Ashlesh Gawande415676b2016-12-22 00:26:23 -060037sudo rm -f /usr/local/lib/libChronoSync*
38sudo rm -f /usr/local/lib/pkgconfig/ChronoSync*
39
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050040pushd ChronoSync >/dev/null
Ashlesh Gawande415676b2016-12-22 00:26:23 -060041
42if has FreeBSD10 $NODE_LABELS; then
43 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
44fi
45
Davide Pesavento813df802017-08-20 20:53:54 -040046./waf configure --color=yes
47./waf build --color=yes -j${WAF_JOBS:-1}
Davide Pesavento6a81b772017-08-20 18:43:46 -040048sudo env "PATH=$PATH" ./waf install --color=yes
Ashlesh Gawande415676b2016-12-22 00:26:23 -060049
50popd >/dev/null
51popd >/dev/null
52
53if has Linux $NODE_LABELS; then
54 sudo ldconfig
55elif has FreeBSD10 $NODE_LABELS; then
56 sudo ldconfig -m
57fi