Alexander Afanasyev | 21034bf | 2014-09-02 18:31:53 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Shock Jiang | 2d8483c | 2014-10-30 10:15:37 -0700 | [diff] [blame] | 2 | set -e |
Alexander Afanasyev | 21034bf | 2014-09-02 18:31:53 -0700 | [diff] [blame] | 3 | |
Alexander Afanasyev | c7c9900 | 2015-10-09 17:27:30 -0700 | [diff] [blame] | 4 | JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) |
| 5 | source "$JDIR"/util.sh |
| 6 | |
Alexander Afanasyev | 984ca9d | 2016-12-19 13:09:14 -0800 | [diff] [blame] | 7 | set -x |
| 8 | |
| 9 | pushd "${CACHE_DIR:-/tmp}" >/dev/null |
Alexander Afanasyev | c7c9900 | 2015-10-09 17:27:30 -0700 | [diff] [blame] | 10 | |
Davide Pesavento | 9003483 | 2018-05-30 10:10:31 -0400 | [diff] [blame] | 11 | INSTALLED_VERSION= |
| 12 | if has OSX $NODE_LABELS; then |
| 13 | BOOST=$(brew ls --versions boost) |
| 14 | OLD_BOOST=$(cat boost.txt || :) |
| 15 | if [[ $OLD_BOOST != $BOOST ]]; then |
| 16 | echo "$BOOST" > boost.txt |
| 17 | INSTALLED_VERSION=NONE |
| 18 | fi |
| 19 | fi |
| 20 | |
| 21 | if [[ -z $INSTALLED_VERSION ]]; then |
| 22 | INSTALLED_VERSION=$(git -C ndn-cxx rev-parse HEAD 2>/dev/null || echo NONE) |
| 23 | fi |
Alexander Afanasyev | c7c9900 | 2015-10-09 17:27:30 -0700 | [diff] [blame] | 24 | |
| 25 | sudo rm -Rf ndn-cxx-latest |
| 26 | |
| 27 | git clone --depth 1 git://github.com/named-data/ndn-cxx ndn-cxx-latest |
| 28 | |
Davide Pesavento | 9003483 | 2018-05-30 10:10:31 -0400 | [diff] [blame] | 29 | LATEST_VERSION=$(git -C ndn-cxx-latest rev-parse HEAD 2>/dev/null || echo UNKNOWN) |
Alexander Afanasyev | c7c9900 | 2015-10-09 17:27:30 -0700 | [diff] [blame] | 30 | |
| 31 | if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then |
| 32 | sudo rm -Rf ndn-cxx |
| 33 | mv ndn-cxx-latest ndn-cxx |
Alexander Afanasyev | 21034bf | 2014-09-02 18:31:53 -0700 | [diff] [blame] | 34 | else |
Alexander Afanasyev | c7c9900 | 2015-10-09 17:27:30 -0700 | [diff] [blame] | 35 | sudo rm -Rf ndn-cxx-latest |
Alexander Afanasyev | 21034bf | 2014-09-02 18:31:53 -0700 | [diff] [blame] | 36 | fi |
| 37 | |
Davide Pesavento | 9003483 | 2018-05-30 10:10:31 -0400 | [diff] [blame] | 38 | sudo rm -f /usr/local/bin/ndnsec* |
| 39 | sudo rm -fr /usr/local/include/ndn-cxx |
Alexander Afanasyev | 21034bf | 2014-09-02 18:31:53 -0700 | [diff] [blame] | 40 | sudo rm -f /usr/local/lib/libndn-cxx* |
Davide Pesavento | 9003483 | 2018-05-30 10:10:31 -0400 | [diff] [blame] | 41 | sudo rm -f /usr/local/lib/pkgconfig/libndn-cxx.pc |
Alexander Afanasyev | 21034bf | 2014-09-02 18:31:53 -0700 | [diff] [blame] | 42 | |
Alexander Afanasyev | c7c9900 | 2015-10-09 17:27:30 -0700 | [diff] [blame] | 43 | pushd ndn-cxx >/dev/null |
Alexander Afanasyev | 21034bf | 2014-09-02 18:31:53 -0700 | [diff] [blame] | 44 | |
Davide Pesavento | 9003483 | 2018-05-30 10:10:31 -0400 | [diff] [blame] | 45 | ./waf configure --color=yes --enable-shared --disable-static --without-osx-keychain |
| 46 | ./waf build --color=yes -j${WAF_JOBS:-1} |
Davide Pesavento | 4a315b3 | 2018-11-24 14:32:19 -0500 | [diff] [blame] | 47 | sudo_preserve_env PATH -- ./waf install --color=yes |
Alexander Afanasyev | c7c9900 | 2015-10-09 17:27:30 -0700 | [diff] [blame] | 48 | |
| 49 | popd >/dev/null |
| 50 | popd >/dev/null |
| 51 | |
| 52 | if has Linux $NODE_LABELS; then |
| 53 | sudo ldconfig |
Davide Pesavento | 9003483 | 2018-05-30 10:10:31 -0400 | [diff] [blame] | 54 | elif has FreeBSD10 $NODE_LABELS; then |
| 55 | sudo ldconfig -m |
Alexander Afanasyev | c7c9900 | 2015-10-09 17:27:30 -0700 | [diff] [blame] | 56 | fi |