blob: 642e469a86ca8a690fe305be8a45af792889c150 [file] [log] [blame]
Ashlesh Gawande415676b2016-12-22 00:26:23 -06001#!/usr/bin/env bash
Davide Pesaventof6be8e32020-04-30 16:06:03 -04002set -ex
Ashlesh Gawande415676b2016-12-22 00:26:23 -06003
Davide Pesaventof6be8e32020-04-30 16:06:03 -04004PROJ=ChronoSync
Ashlesh Gawande415676b2016-12-22 00:26:23 -06005
Davide Pesaventof6be8e32020-04-30 16:06:03 -04006pushd "$CACHE_DIR" >/dev/null
Ashlesh Gawande415676b2016-12-22 00:26:23 -06007
8INSTALLED_VERSION=
Ashlesh Gawande05cb7282018-08-30 14:39:41 -05009NDN_CXX=$(ndnsec version)
Davide Pesaventof6be8e32020-04-30 16:06:03 -040010OLD_NDN_CXX=$(cat "$PROJ-ndn-cxx.txt" || :)
Ashlesh Gawande05cb7282018-08-30 14:39:41 -050011if [[ $OLD_NDN_CXX != $NDN_CXX ]]; then
Davide Pesaventof6be8e32020-04-30 16:06:03 -040012 echo "$NDN_CXX" > "$PROJ-ndn-cxx.txt"
Ashlesh Gawande05cb7282018-08-30 14:39:41 -050013 INSTALLED_VERSION=NONE
14fi
15
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050016if [[ -z $INSTALLED_VERSION ]]; then
Davide Pesaventof6be8e32020-04-30 16:06:03 -040017 INSTALLED_VERSION=$(git -C "$PROJ" rev-parse HEAD 2>/dev/null || echo NONE)
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050018fi
Ashlesh Gawande415676b2016-12-22 00:26:23 -060019
Davide Pesaventof6be8e32020-04-30 16:06:03 -040020sudo rm -rf "$PROJ-latest"
21git clone --depth 1 "https://github.com/named-data/$PROJ.git" "$PROJ-latest"
22LATEST_VERSION=$(git -C "$PROJ-latest" rev-parse HEAD 2>/dev/null || echo UNKNOWN)
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050023
24if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
Davide Pesaventof6be8e32020-04-30 16:06:03 -040025 sudo rm -rf "$PROJ"
26 mv "$PROJ-latest" "$PROJ"
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050027else
Davide Pesaventof6be8e32020-04-30 16:06:03 -040028 sudo rm -rf "$PROJ-latest"
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050029fi
Nick Gordonb9c5cec2017-06-08 14:10:27 -050030
Davide Pesaventof6be8e32020-04-30 16:06:03 -040031sudo rm -fr /usr/local/include/"$PROJ"
32sudo rm -f /usr/local/lib{,64}/lib"$PROJ"*
33sudo rm -f /usr/local/lib{,64}/pkgconfig/"$PROJ".pc
Ashlesh Gawande415676b2016-12-22 00:26:23 -060034
Davide Pesaventof6be8e32020-04-30 16:06:03 -040035pushd "$PROJ" >/dev/null
Ashlesh Gawande415676b2016-12-22 00:26:23 -060036
Davide Pesaventof6be8e32020-04-30 16:06:03 -040037./waf --color=yes configure
38./waf --color=yes build -j$WAF_JOBS
39sudo_preserve_env PATH -- ./waf --color=yes install
Ashlesh Gawande415676b2016-12-22 00:26:23 -060040
41popd >/dev/null
42popd >/dev/null
43
44if has Linux $NODE_LABELS; then
45 sudo ldconfig
Ashlesh Gawande415676b2016-12-22 00:26:23 -060046fi