blob: c4b88b2184c57a8e71878378825654c33b414ec0 [file] [log] [blame]
Ashlesh Gawande32ec3fd2018-07-18 13:42:32 -05001#!/usr/bin/env bash
Davide Pesaventof6be8e32020-04-30 16:06:03 -04002set -ex
Ashlesh Gawande32ec3fd2018-07-18 13:42:32 -05003
Davide Pesaventof6be8e32020-04-30 16:06:03 -04004PROJ=PSync
Ashlesh Gawande32ec3fd2018-07-18 13:42:32 -05005
Davide Pesaventof6be8e32020-04-30 16:06:03 -04006pushd "$CACHE_DIR" >/dev/null
Ashlesh Gawande32ec3fd2018-07-18 13:42:32 -05007
8INSTALLED_VERSION=
9NDN_CXX=$(ndnsec version)
Davide Pesaventof6be8e32020-04-30 16:06:03 -040010OLD_NDN_CXX=$(cat "$PROJ-ndn-cxx.txt" || :)
Ashlesh Gawande32ec3fd2018-07-18 13:42:32 -050011if [[ $OLD_NDN_CXX != $NDN_CXX ]]; then
Davide Pesaventof6be8e32020-04-30 16:06:03 -040012 echo "$NDN_CXX" > "$PROJ-ndn-cxx.txt"
Ashlesh Gawande32ec3fd2018-07-18 13:42:32 -050013 INSTALLED_VERSION=NONE
14fi
15
16if [[ -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)
Ashlesh Gawande32ec3fd2018-07-18 13:42:32 -050018fi
19
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)
Ashlesh Gawande32ec3fd2018-07-18 13:42:32 -050023
24if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
Davide Pesaventof6be8e32020-04-30 16:06:03 -040025 sudo rm -rf "$PROJ"
26 mv "$PROJ-latest" "$PROJ"
Ashlesh Gawande32ec3fd2018-07-18 13:42:32 -050027else
Davide Pesaventof6be8e32020-04-30 16:06:03 -040028 sudo rm -rf "$PROJ-latest"
Ashlesh Gawande32ec3fd2018-07-18 13:42:32 -050029fi
30
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 Gawande32ec3fd2018-07-18 13:42:32 -050034
Davide Pesaventof6be8e32020-04-30 16:06:03 -040035pushd "$PROJ" >/dev/null
Ashlesh Gawande32ec3fd2018-07-18 13:42:32 -050036
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 Gawande32ec3fd2018-07-18 13:42:32 -050040
41popd >/dev/null
42popd >/dev/null
43
44if has Linux $NODE_LABELS; then
45 sudo ldconfig
Ashlesh Gawande32ec3fd2018-07-18 13:42:32 -050046fi