blob: 51051971b7c850a2ba4479882f797c55e9b0d855 [file] [log] [blame]
Varun Patil7d2d6892022-10-14 12:50:30 -07001#!/usr/bin/env bash
2set -exo pipefail
3
4PROJ=ndn-svs
5
6pushd "$CACHE_DIR" >/dev/null
7
8INSTALLED_VERSION=
9NDN_CXX=$(ndnsec version)
10OLD_NDN_CXX=$(cat "$PROJ-ndn-cxx.txt" || :)
11if [[ $OLD_NDN_CXX != $NDN_CXX ]]; then
12 echo "$NDN_CXX" > "$PROJ-ndn-cxx.txt"
13 INSTALLED_VERSION=NONE
14fi
15
16if [[ -z $INSTALLED_VERSION ]]; then
17 INSTALLED_VERSION=$(git -C "$PROJ" rev-parse HEAD 2>/dev/null || echo NONE)
18fi
19
20sudo 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)
23
24if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
25 sudo rm -rf "$PROJ"
26 mv "$PROJ-latest" "$PROJ"
27else
28 sudo rm -rf "$PROJ-latest"
29fi
30
31sudo 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
34
35pushd "$PROJ" >/dev/null
36
37./waf --color=yes configure
38./waf --color=yes build
39sudo ./waf --color=yes install
40
41popd >/dev/null
42popd >/dev/null
43
44if [[ $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
48 sudo ldconfig
49fi