Varun Patil | 7d2d689 | 2022-10-14 12:50:30 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | set -exo pipefail |
| 3 | |
| 4 | PROJ=ndn-svs |
| 5 | |
| 6 | pushd "$CACHE_DIR" >/dev/null |
| 7 | |
| 8 | INSTALLED_VERSION= |
| 9 | NDN_CXX=$(ndnsec version) |
| 10 | OLD_NDN_CXX=$(cat "$PROJ-ndn-cxx.txt" || :) |
| 11 | if [[ $OLD_NDN_CXX != $NDN_CXX ]]; then |
| 12 | echo "$NDN_CXX" > "$PROJ-ndn-cxx.txt" |
| 13 | INSTALLED_VERSION=NONE |
| 14 | fi |
| 15 | |
| 16 | if [[ -z $INSTALLED_VERSION ]]; then |
| 17 | INSTALLED_VERSION=$(git -C "$PROJ" rev-parse HEAD 2>/dev/null || echo NONE) |
| 18 | fi |
| 19 | |
| 20 | sudo rm -rf "$PROJ-latest" |
| 21 | git clone --depth 1 "https://github.com/named-data/$PROJ.git" "$PROJ-latest" |
| 22 | LATEST_VERSION=$(git -C "$PROJ-latest" rev-parse HEAD 2>/dev/null || echo UNKNOWN) |
| 23 | |
| 24 | if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then |
| 25 | sudo rm -rf "$PROJ" |
| 26 | mv "$PROJ-latest" "$PROJ" |
| 27 | else |
| 28 | sudo rm -rf "$PROJ-latest" |
| 29 | fi |
| 30 | |
| 31 | sudo rm -fr /usr/local/include/"$PROJ" |
| 32 | sudo rm -f /usr/local/lib{,64}/lib"$PROJ"* |
| 33 | sudo rm -f /usr/local/lib{,64}/pkgconfig/"$PROJ".pc |
| 34 | |
| 35 | pushd "$PROJ" >/dev/null |
| 36 | |
| 37 | ./waf --color=yes configure |
| 38 | ./waf --color=yes build |
| 39 | sudo ./waf --color=yes install |
| 40 | |
| 41 | popd >/dev/null |
| 42 | popd >/dev/null |
| 43 | |
| 44 | if [[ $ID_LIKE == *fedora* ]]; then |
| 45 | sudo tee /etc/ld.so.conf.d/ndn.conf >/dev/null <<< /usr/local/lib64 |
| 46 | fi |
| 47 | if [[ $ID_LIKE == *linux* ]]; then |
| 48 | sudo ldconfig |
| 49 | fi |