Junxiao Shi | 439d972 | 2015-03-20 15:08:44 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Davide Pesavento | bd3642f | 2022-08-12 18:19:31 -0400 | [diff] [blame] | 2 | set -exo pipefail |
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= |
Davide Pesavento | bd3642f | 2022-08-12 18:19:31 -0400 | [diff] [blame] | 7 | if [[ $ID == macos ]]; then |
| 8 | BOOST=$(brew list --formula --versions boost) |
Ashlesh Gawande | 70750cf | 2017-05-27 17:10:34 +0000 | [diff] [blame] | 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 | bd3642f | 2022-08-12 18:19:31 -0400 | [diff] [blame] | 38 | ./waf --color=yes configure --without-osx-keychain |
| 39 | ./waf --color=yes build |
| 40 | sudo ./waf --color=yes install |
Junxiao Shi | 439d972 | 2015-03-20 15:08:44 -0700 | [diff] [blame] | 41 | |
| 42 | popd >/dev/null |
| 43 | popd >/dev/null |
Joao Pereira | 4bd28fc | 2015-07-08 15:30:42 -0400 | [diff] [blame] | 44 | |
Davide Pesavento | bd3642f | 2022-08-12 18:19:31 -0400 | [diff] [blame] | 45 | if [[ $ID_LIKE == *linux* ]]; then |
Davide Pesavento | 1df2cff | 2024-02-09 19:40:03 -0500 | [diff] [blame] | 46 | if [[ $(uname -m) == x86_64 && -d /usr/lib64 ]]; then |
| 47 | sudo tee /etc/ld.so.conf.d/ndn.conf >/dev/null <<< /usr/local/lib64 |
| 48 | fi |
Joao Pereira | 4bd28fc | 2015-07-08 15:30:42 -0400 | [diff] [blame] | 49 | sudo ldconfig |
Joao Pereira | 4bd28fc | 2015-07-08 15:30:42 -0400 | [diff] [blame] | 50 | fi |