blob: bc9e6ab55dae5e3f4bcdc8835134842aab3fa1c4 [file] [log] [blame]
Ashlesh Gawande32ec3fd2018-07-18 13:42:32 -05001#!/usr/bin/env bash
Davide Pesaventoede59632022-08-26 20:35:44 -04002set -exo pipefail
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
Davide Pesaventoede59632022-08-26 20:35:44 -040038./waf --color=yes build
39sudo ./waf --color=yes install
Ashlesh Gawande32ec3fd2018-07-18 13:42:32 -050040
41popd >/dev/null
42popd >/dev/null
43
Davide Pesaventoede59632022-08-26 20:35:44 -040044if [[ $ID_LIKE == *linux* ]]; then
Davide Pesavento543f2b62024-02-10 16:22:24 -050045 if [[ $(uname -m) == x86_64 && -d /usr/lib64 ]]; then
46 sudo tee /etc/ld.so.conf.d/ndn.conf >/dev/null <<< /usr/local/lib64
47 fi
Ashlesh Gawande32ec3fd2018-07-18 13:42:32 -050048 sudo ldconfig
Ashlesh Gawande32ec3fd2018-07-18 13:42:32 -050049fi