Ashlesh Gawande | 0b2897e | 2018-06-20 14:40:47 -0500 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Davide Pesavento | da1a4d3 | 2022-08-19 19:03:24 -0400 | [diff] [blame] | 2 | set -exo pipefail |
Ashlesh Gawande | 0b2897e | 2018-06-20 14:40:47 -0500 | [diff] [blame] | 3 | |
Davide Pesavento | 133067f | 2020-04-02 22:08:27 -0400 | [diff] [blame] | 4 | pushd "$CACHE_DIR" >/dev/null |
Ashlesh Gawande | 0b2897e | 2018-06-20 14:40:47 -0500 | [diff] [blame] | 5 | |
| 6 | INSTALLED_VERSION= |
Davide Pesavento | da1a4d3 | 2022-08-19 19:03:24 -0400 | [diff] [blame] | 7 | if [[ $ID == macos ]]; then |
| 8 | BOOST=$(brew list --formula --versions boost) |
Ashlesh Gawande | 0b2897e | 2018-06-20 14:40:47 -0500 | [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 |
| 19 | |
Davide Pesavento | 133067f | 2020-04-02 22:08:27 -0400 | [diff] [blame] | 20 | sudo rm -rf ndn-cxx-latest |
| 21 | git clone --depth 1 https://github.com/named-data/ndn-cxx.git ndn-cxx-latest |
Ashlesh Gawande | 0b2897e | 2018-06-20 14:40:47 -0500 | [diff] [blame] | 22 | LATEST_VERSION=$(git -C ndn-cxx-latest rev-parse HEAD 2>/dev/null || echo UNKNOWN) |
| 23 | |
| 24 | if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then |
Davide Pesavento | 133067f | 2020-04-02 22:08:27 -0400 | [diff] [blame] | 25 | sudo rm -rf ndn-cxx |
Ashlesh Gawande | 0b2897e | 2018-06-20 14:40:47 -0500 | [diff] [blame] | 26 | mv ndn-cxx-latest ndn-cxx |
| 27 | else |
Davide Pesavento | 133067f | 2020-04-02 22:08:27 -0400 | [diff] [blame] | 28 | sudo rm -rf ndn-cxx-latest |
Ashlesh Gawande | 0b2897e | 2018-06-20 14:40:47 -0500 | [diff] [blame] | 29 | fi |
| 30 | |
| 31 | sudo rm -f /usr/local/bin/ndnsec* |
| 32 | sudo rm -fr /usr/local/include/ndn-cxx |
Davide Pesavento | 1526fee | 2019-03-18 19:31:55 -0400 | [diff] [blame] | 33 | sudo rm -f /usr/local/lib{,64}/libndn-cxx* |
| 34 | sudo rm -f /usr/local/lib{,64}/pkgconfig/libndn-cxx.pc |
Ashlesh Gawande | 0b2897e | 2018-06-20 14:40:47 -0500 | [diff] [blame] | 35 | |
| 36 | pushd ndn-cxx >/dev/null |
| 37 | |
Davide Pesavento | 9fa6f8d | 2024-03-12 19:40:26 -0400 | [diff] [blame] | 38 | ./waf --color=yes configure |
Davide Pesavento | da1a4d3 | 2022-08-19 19:03:24 -0400 | [diff] [blame] | 39 | ./waf --color=yes build |
| 40 | sudo ./waf --color=yes install |
Ashlesh Gawande | 0b2897e | 2018-06-20 14:40:47 -0500 | [diff] [blame] | 41 | |
| 42 | popd >/dev/null |
| 43 | popd >/dev/null |
| 44 | |
Davide Pesavento | da1a4d3 | 2022-08-19 19:03:24 -0400 | [diff] [blame] | 45 | if [[ $ID_LIKE == *linux* ]]; then |
Davide Pesavento | 8d6192a | 2024-02-09 21:23:50 -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 |
Ashlesh Gawande | 0b2897e | 2018-06-20 14:40:47 -0500 | [diff] [blame] | 49 | sudo ldconfig |
Ashlesh Gawande | 0b2897e | 2018-06-20 14:40:47 -0500 | [diff] [blame] | 50 | fi |