blob: 145273c37de3b33bd74c61d18dd703a7ae1d6005 [file] [log] [blame]
Ashlesh Gawande415676b2016-12-22 00:26:23 -06001#!/usr/bin/env bash
Davide Pesaventoede59632022-08-26 20:35:44 -04002set -exo pipefail
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
Davide Pesaventoede59632022-08-26 20:35:44 -040038./waf --color=yes build
39sudo ./waf --color=yes install
Ashlesh Gawande415676b2016-12-22 00:26:23 -060040
41popd >/dev/null
42popd >/dev/null
43
Davide Pesaventoede59632022-08-26 20:35:44 -040044if [[ $ID_LIKE == *fedora* ]]; then
45 sudo tee /etc/ld.so.conf.d/ndn.conf >/dev/null <<< /usr/local/lib64
46fi
47if [[ $ID_LIKE == *linux* ]]; then
Ashlesh Gawande415676b2016-12-22 00:26:23 -060048 sudo ldconfig
Ashlesh Gawande415676b2016-12-22 00:26:23 -060049fi