Ashlesh Gawande | 32ec3fd | 2018-07-18 13:42:32 -0500 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | set -e |
| 3 | |
| 4 | JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) |
| 5 | source "$JDIR"/util.sh |
| 6 | |
| 7 | set -x |
| 8 | |
| 9 | pushd "${CACHE_DIR:-/tmp}" >/dev/null |
| 10 | |
| 11 | INSTALLED_VERSION= |
| 12 | NDN_CXX=$(ndnsec version) |
| 13 | OLD_NDN_CXX=$(cat ndn_cxx_psync.txt || :) |
| 14 | if [[ $OLD_NDN_CXX != $NDN_CXX ]]; then |
| 15 | echo "$NDN_CXX" > ndn_cxx_psync.txt |
| 16 | INSTALLED_VERSION=NONE |
| 17 | fi |
| 18 | |
| 19 | if [[ -z $INSTALLED_VERSION ]]; then |
| 20 | INSTALLED_VERSION=$(git -C PSync rev-parse HEAD 2>/dev/null || echo NONE) |
| 21 | fi |
| 22 | |
| 23 | sudo rm -Rf PSync-latest |
| 24 | |
| 25 | git clone --depth 1 git://github.com/named-data/PSync PSync-latest |
| 26 | |
| 27 | LATEST_VERSION=$(git -C PSync-latest rev-parse HEAD 2>/dev/null || echo UNKNOWN) |
| 28 | |
| 29 | if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then |
| 30 | sudo rm -Rf PSync |
| 31 | mv PSync-latest PSync |
| 32 | else |
| 33 | sudo rm -Rf PSync-latest |
| 34 | fi |
| 35 | |
| 36 | sudo rm -fr /usr/local/include/PSync |
Davide Pesavento | 0b0eddd | 2019-03-19 14:42:15 -0400 | [diff] [blame^] | 37 | sudo rm -f /usr/local/lib{,64}/libPSync* |
| 38 | sudo rm -f /usr/local/lib{,64}/pkgconfig/PSync.pc |
Ashlesh Gawande | 32ec3fd | 2018-07-18 13:42:32 -0500 | [diff] [blame] | 39 | |
| 40 | pushd PSync >/dev/null |
| 41 | |
| 42 | if has FreeBSD10 $NODE_LABELS; then |
| 43 | export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ |
| 44 | fi |
| 45 | |
| 46 | ./waf configure --color=yes |
| 47 | ./waf build --color=yes -j${WAF_JOBS:-1} |
Davide Pesavento | 0b0eddd | 2019-03-19 14:42:15 -0400 | [diff] [blame^] | 48 | sudo_preserve_env PATH -- ./waf install --color=yes |
Ashlesh Gawande | 32ec3fd | 2018-07-18 13:42:32 -0500 | [diff] [blame] | 49 | |
| 50 | popd >/dev/null |
| 51 | popd >/dev/null |
| 52 | |
| 53 | if has Linux $NODE_LABELS; then |
| 54 | sudo ldconfig |
| 55 | elif has FreeBSD10 $NODE_LABELS; then |
| 56 | sudo ldconfig -m |
| 57 | fi |