Junxiao Shi | 439d972 | 2015-03-20 15:08:44 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Davide Pesavento | d839882 | 2020-03-29 18:46:19 -0400 | [diff] [blame] | 2 | set -ex |
Junxiao Shi | 439d972 | 2015-03-20 15:08:44 -0700 | [diff] [blame] | 3 | |
Davide Pesavento | d839882 | 2020-03-29 18:46:19 -0400 | [diff] [blame] | 4 | pushd "$CACHE_DIR" >/dev/null |
Junxiao Shi | 439d972 | 2015-03-20 15:08:44 -0700 | [diff] [blame] | 5 | |
Ashlesh Gawande | 70750cf | 2017-05-27 17:10:34 +0000 | [diff] [blame] | 6 | INSTALLED_VERSION= |
| 7 | if has OSX $NODE_LABELS; then |
| 8 | BOOST=$(brew ls --versions boost) |
| 9 | OLD_BOOST=$(cat boost.txt || :) |
| 10 | if [[ $OLD_BOOST != $BOOST ]]; then |
| 11 | echo "$BOOST" > boost.txt |
| 12 | INSTALLED_VERSION=NONE |
| 13 | fi |
| 14 | fi |
| 15 | |
| 16 | if [[ -z $INSTALLED_VERSION ]]; then |
| 17 | INSTALLED_VERSION=$(git -C ndn-cxx rev-parse HEAD 2>/dev/null || echo NONE) |
| 18 | fi |
Junxiao Shi | 439d972 | 2015-03-20 15:08:44 -0700 | [diff] [blame] | 19 | |
Davide Pesavento | d839882 | 2020-03-29 18:46:19 -0400 | [diff] [blame] | 20 | sudo rm -rf ndn-cxx-latest |
Davide Pesavento | fce3963 | 2020-03-31 23:16:55 -0400 | [diff] [blame] | 21 | git clone --depth 1 https://github.com/named-data/ndn-cxx.git ndn-cxx-latest |
Ashlesh Gawande | 70750cf | 2017-05-27 17:10:34 +0000 | [diff] [blame] | 22 | LATEST_VERSION=$(git -C ndn-cxx-latest rev-parse HEAD 2>/dev/null || echo UNKNOWN) |
Junxiao Shi | 439d972 | 2015-03-20 15:08:44 -0700 | [diff] [blame] | 23 | |
| 24 | if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then |
Davide Pesavento | d839882 | 2020-03-29 18:46:19 -0400 | [diff] [blame] | 25 | sudo rm -rf ndn-cxx |
Junxiao Shi | 439d972 | 2015-03-20 15:08:44 -0700 | [diff] [blame] | 26 | mv ndn-cxx-latest ndn-cxx |
| 27 | else |
Davide Pesavento | d839882 | 2020-03-29 18:46:19 -0400 | [diff] [blame] | 28 | sudo rm -rf ndn-cxx-latest |
Junxiao Shi | 439d972 | 2015-03-20 15:08:44 -0700 | [diff] [blame] | 29 | fi |
| 30 | |
Davide Pesavento | 5485ca9 | 2017-08-10 21:47:42 -0400 | [diff] [blame] | 31 | sudo rm -f /usr/local/bin/ndnsec* |
| 32 | sudo rm -fr /usr/local/include/ndn-cxx |
Md Ashiqur Rahman | 25c37f1 | 2018-10-12 17:59:20 +0000 | [diff] [blame] | 33 | sudo rm -f /usr/local/lib{,64}/libndn-cxx* |
| 34 | sudo rm -f /usr/local/lib{,64}/pkgconfig/libndn-cxx.pc |
Junxiao Shi | 439d972 | 2015-03-20 15:08:44 -0700 | [diff] [blame] | 35 | |
| 36 | pushd ndn-cxx >/dev/null |
| 37 | |
Davide Pesavento | d5c2447 | 2020-04-01 17:46:18 -0400 | [diff] [blame^] | 38 | if has Linux $NODE_LABELS && [[ $CXX != clang* && -z $DISABLE_ASAN ]]; then |
| 39 | # https://stackoverflow.com/a/47022141 |
| 40 | ASAN="--with-sanitizer=address" |
| 41 | fi |
Davide Pesavento | d839882 | 2020-03-29 18:46:19 -0400 | [diff] [blame] | 42 | if has CentOS-8 $NODE_LABELS; then |
Davide Pesavento | d5c2447 | 2020-04-01 17:46:18 -0400 | [diff] [blame^] | 43 | # https://bugzilla.redhat.com/show_bug.cgi?id=1721553 |
Davide Pesavento | d839882 | 2020-03-29 18:46:19 -0400 | [diff] [blame] | 44 | PCH="--without-pch" |
| 45 | fi |
| 46 | |
Davide Pesavento | d5c2447 | 2020-04-01 17:46:18 -0400 | [diff] [blame^] | 47 | ./waf --color=yes configure --disable-static --enable-shared --without-osx-keychain $ASAN $PCH |
Davide Pesavento | a1a9d70 | 2020-03-29 00:58:15 -0400 | [diff] [blame] | 48 | ./waf --color=yes build -j$WAF_JOBS |
Davide Pesavento | 9fa6a78 | 2020-03-10 19:47:06 -0400 | [diff] [blame] | 49 | sudo_preserve_env PATH -- ./waf --color=yes install |
Junxiao Shi | 439d972 | 2015-03-20 15:08:44 -0700 | [diff] [blame] | 50 | |
| 51 | popd >/dev/null |
| 52 | popd >/dev/null |
Joao Pereira | 4bd28fc | 2015-07-08 15:30:42 -0400 | [diff] [blame] | 53 | |
Davide Pesavento | d839882 | 2020-03-29 18:46:19 -0400 | [diff] [blame] | 54 | if has CentOS-8 $NODE_LABELS; then |
| 55 | sudo tee /etc/ld.so.conf.d/ndn.conf >/dev/null <<< /usr/local/lib64 |
| 56 | fi |
Joao Pereira | 4bd28fc | 2015-07-08 15:30:42 -0400 | [diff] [blame] | 57 | if has Linux $NODE_LABELS; then |
| 58 | sudo ldconfig |
Joao Pereira | 4bd28fc | 2015-07-08 15:30:42 -0400 | [diff] [blame] | 59 | fi |