blob: 4e0e1549d7dcffa258049e91dfefaf72a0518ab3 [file] [log] [blame]
Junxiao Shi439d9722015-03-20 15:08:44 -07001#!/usr/bin/env bash
Davide Pesaventod8398822020-03-29 18:46:19 -04002set -ex
Junxiao Shi439d9722015-03-20 15:08:44 -07003
Davide Pesaventod8398822020-03-29 18:46:19 -04004pushd "$CACHE_DIR" >/dev/null
Junxiao Shi439d9722015-03-20 15:08:44 -07005
Ashlesh Gawande70750cf2017-05-27 17:10:34 +00006INSTALLED_VERSION=
7if 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
14fi
15
16if [[ -z $INSTALLED_VERSION ]]; then
17 INSTALLED_VERSION=$(git -C ndn-cxx rev-parse HEAD 2>/dev/null || echo NONE)
18fi
Junxiao Shi439d9722015-03-20 15:08:44 -070019
Davide Pesaventod8398822020-03-29 18:46:19 -040020sudo rm -rf ndn-cxx-latest
Davide Pesaventofce39632020-03-31 23:16:55 -040021git clone --depth 1 https://github.com/named-data/ndn-cxx.git ndn-cxx-latest
Ashlesh Gawande70750cf2017-05-27 17:10:34 +000022LATEST_VERSION=$(git -C ndn-cxx-latest rev-parse HEAD 2>/dev/null || echo UNKNOWN)
Junxiao Shi439d9722015-03-20 15:08:44 -070023
24if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
Davide Pesaventod8398822020-03-29 18:46:19 -040025 sudo rm -rf ndn-cxx
Junxiao Shi439d9722015-03-20 15:08:44 -070026 mv ndn-cxx-latest ndn-cxx
27else
Davide Pesaventod8398822020-03-29 18:46:19 -040028 sudo rm -rf ndn-cxx-latest
Junxiao Shi439d9722015-03-20 15:08:44 -070029fi
30
Davide Pesavento5485ca92017-08-10 21:47:42 -040031sudo rm -f /usr/local/bin/ndnsec*
32sudo rm -fr /usr/local/include/ndn-cxx
Md Ashiqur Rahman25c37f12018-10-12 17:59:20 +000033sudo rm -f /usr/local/lib{,64}/libndn-cxx*
34sudo rm -f /usr/local/lib{,64}/pkgconfig/libndn-cxx.pc
Junxiao Shi439d9722015-03-20 15:08:44 -070035
36pushd ndn-cxx >/dev/null
37
Davide Pesaventod8398822020-03-29 18:46:19 -040038if has CentOS-8 $NODE_LABELS; then
Davide Pesaventod5c24472020-04-01 17:46:18 -040039 # https://bugzilla.redhat.com/show_bug.cgi?id=1721553
Davide Pesaventod8398822020-03-29 18:46:19 -040040 PCH="--without-pch"
41fi
42
Davide Pesaventob07d7a92020-05-13 23:30:07 -040043./waf --color=yes configure --disable-static --enable-shared --without-osx-keychain $PCH
Davide Pesaventoa1a9d702020-03-29 00:58:15 -040044./waf --color=yes build -j$WAF_JOBS
Davide Pesavento9fa6a782020-03-10 19:47:06 -040045sudo_preserve_env PATH -- ./waf --color=yes install
Junxiao Shi439d9722015-03-20 15:08:44 -070046
47popd >/dev/null
48popd >/dev/null
Joao Pereira4bd28fc2015-07-08 15:30:42 -040049
Davide Pesaventod8398822020-03-29 18:46:19 -040050if has CentOS-8 $NODE_LABELS; then
51 sudo tee /etc/ld.so.conf.d/ndn.conf >/dev/null <<< /usr/local/lib64
52fi
Joao Pereira4bd28fc2015-07-08 15:30:42 -040053if has Linux $NODE_LABELS; then
54 sudo ldconfig
Joao Pereira4bd28fc2015-07-08 15:30:42 -040055fi