blob: 82145f6e0e5302819d5a020df3910ee1357a41fd [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=
12if has OSX $NODE_LABELS; then
13 BOOST=$(brew ls --versions boost)
14 OLD_BOOST=$(cat boost_chrono.txt || :)
15 if [[ $OLD_BOOST != $BOOST ]]; then
16 echo "$BOOST" > boost_chrono.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 ChronoSync rev-parse HEAD 2>/dev/null || echo NONE)
23fi
Ashlesh Gawande415676b2016-12-22 00:26:23 -060024
25sudo rm -Rf ChronoSync-latest
Ashlesh Gawande415676b2016-12-22 00:26:23 -060026
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050027git clone --depth 1 git://github.com/named-data/ChronoSync ChronoSync-latest
Nick Gordonb9c5cec2017-06-08 14:10:27 -050028
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050029LATEST_VERSION=$(git -C ChronoSync-latest rev-parse HEAD 2>/dev/null || echo UNKNOWN)
30
31if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
32 sudo rm -Rf ChronoSync
33 mv ChronoSync-latest ChronoSync
34else
35 sudo rm -Rf ChronoSync-latest
36fi
Nick Gordonb9c5cec2017-06-08 14:10:27 -050037
Davide Pesavento6a81b772017-08-20 18:43:46 -040038sudo rm -fr /usr/local/include/ChronoSync
Ashlesh Gawande415676b2016-12-22 00:26:23 -060039sudo rm -f /usr/local/lib/libChronoSync*
40sudo rm -f /usr/local/lib/pkgconfig/ChronoSync*
41
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050042pushd ChronoSync >/dev/null
Ashlesh Gawande415676b2016-12-22 00:26:23 -060043
44if has FreeBSD10 $NODE_LABELS; then
45 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
46fi
47
Davide Pesavento813df802017-08-20 20:53:54 -040048./waf configure --color=yes
49./waf build --color=yes -j${WAF_JOBS:-1}
Davide Pesavento6a81b772017-08-20 18:43:46 -040050sudo env "PATH=$PATH" ./waf install --color=yes
Ashlesh Gawande415676b2016-12-22 00:26:23 -060051
52popd >/dev/null
53popd >/dev/null
54
55if has Linux $NODE_LABELS; then
56 sudo ldconfig
57elif has FreeBSD10 $NODE_LABELS; then
58 sudo ldconfig -m
59fi