Ashlesh Gawande | 415676b | 2016-12-22 00:26:23 -0600 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Davide Pesavento | ede5963 | 2022-08-26 20:35:44 -0400 | [diff] [blame] | 2 | set -exo pipefail |
Ashlesh Gawande | 415676b | 2016-12-22 00:26:23 -0600 | [diff] [blame] | 3 | |
Davide Pesavento | f6be8e3 | 2020-04-30 16:06:03 -0400 | [diff] [blame] | 4 | PROJ=ChronoSync |
Ashlesh Gawande | 415676b | 2016-12-22 00:26:23 -0600 | [diff] [blame] | 5 | |
Davide Pesavento | f6be8e3 | 2020-04-30 16:06:03 -0400 | [diff] [blame] | 6 | pushd "$CACHE_DIR" >/dev/null |
Ashlesh Gawande | 415676b | 2016-12-22 00:26:23 -0600 | [diff] [blame] | 7 | |
| 8 | INSTALLED_VERSION= |
Ashlesh Gawande | 05cb728 | 2018-08-30 14:39:41 -0500 | [diff] [blame] | 9 | NDN_CXX=$(ndnsec version) |
Davide Pesavento | f6be8e3 | 2020-04-30 16:06:03 -0400 | [diff] [blame] | 10 | OLD_NDN_CXX=$(cat "$PROJ-ndn-cxx.txt" || :) |
Ashlesh Gawande | 05cb728 | 2018-08-30 14:39:41 -0500 | [diff] [blame] | 11 | if [[ $OLD_NDN_CXX != $NDN_CXX ]]; then |
Davide Pesavento | f6be8e3 | 2020-04-30 16:06:03 -0400 | [diff] [blame] | 12 | echo "$NDN_CXX" > "$PROJ-ndn-cxx.txt" |
Ashlesh Gawande | 05cb728 | 2018-08-30 14:39:41 -0500 | [diff] [blame] | 13 | INSTALLED_VERSION=NONE |
| 14 | fi |
| 15 | |
Muktadir Chowdhury | f04f989 | 2017-08-20 20:42:56 -0500 | [diff] [blame] | 16 | if [[ -z $INSTALLED_VERSION ]]; then |
Davide Pesavento | f6be8e3 | 2020-04-30 16:06:03 -0400 | [diff] [blame] | 17 | INSTALLED_VERSION=$(git -C "$PROJ" rev-parse HEAD 2>/dev/null || echo NONE) |
Muktadir Chowdhury | f04f989 | 2017-08-20 20:42:56 -0500 | [diff] [blame] | 18 | fi |
Ashlesh Gawande | 415676b | 2016-12-22 00:26:23 -0600 | [diff] [blame] | 19 | |
Davide Pesavento | f6be8e3 | 2020-04-30 16:06:03 -0400 | [diff] [blame] | 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) |
Muktadir Chowdhury | f04f989 | 2017-08-20 20:42:56 -0500 | [diff] [blame] | 23 | |
| 24 | if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then |
Davide Pesavento | f6be8e3 | 2020-04-30 16:06:03 -0400 | [diff] [blame] | 25 | sudo rm -rf "$PROJ" |
| 26 | mv "$PROJ-latest" "$PROJ" |
Muktadir Chowdhury | f04f989 | 2017-08-20 20:42:56 -0500 | [diff] [blame] | 27 | else |
Davide Pesavento | f6be8e3 | 2020-04-30 16:06:03 -0400 | [diff] [blame] | 28 | sudo rm -rf "$PROJ-latest" |
Muktadir Chowdhury | f04f989 | 2017-08-20 20:42:56 -0500 | [diff] [blame] | 29 | fi |
Nick Gordon | b9c5cec | 2017-06-08 14:10:27 -0500 | [diff] [blame] | 30 | |
Davide Pesavento | f6be8e3 | 2020-04-30 16:06:03 -0400 | [diff] [blame] | 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 |
Ashlesh Gawande | 415676b | 2016-12-22 00:26:23 -0600 | [diff] [blame] | 34 | |
Davide Pesavento | f6be8e3 | 2020-04-30 16:06:03 -0400 | [diff] [blame] | 35 | pushd "$PROJ" >/dev/null |
Ashlesh Gawande | 415676b | 2016-12-22 00:26:23 -0600 | [diff] [blame] | 36 | |
Davide Pesavento | f6be8e3 | 2020-04-30 16:06:03 -0400 | [diff] [blame] | 37 | ./waf --color=yes configure |
Davide Pesavento | ede5963 | 2022-08-26 20:35:44 -0400 | [diff] [blame] | 38 | ./waf --color=yes build |
| 39 | sudo ./waf --color=yes install |
Ashlesh Gawande | 415676b | 2016-12-22 00:26:23 -0600 | [diff] [blame] | 40 | |
| 41 | popd >/dev/null |
| 42 | popd >/dev/null |
| 43 | |
Davide Pesavento | ede5963 | 2022-08-26 20:35:44 -0400 | [diff] [blame] | 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 |
Ashlesh Gawande | 415676b | 2016-12-22 00:26:23 -0600 | [diff] [blame] | 48 | sudo ldconfig |
Ashlesh Gawande | 415676b | 2016-12-22 00:26:23 -0600 | [diff] [blame] | 49 | fi |