blob: 4e0e1549d7dcffa258049e91dfefaf72a0518ab3 [file] [log] [blame]
Alexander Afanasyevbc98fcf2014-08-16 23:18:50 -07001#!/usr/bin/env bash
Davide Pesaventof6be8e32020-04-30 16:06:03 -04002set -ex
Alexander Afanasyevbc98fcf2014-08-16 23:18:50 -07003
Davide Pesaventof6be8e32020-04-30 16:06:03 -04004pushd "$CACHE_DIR" >/dev/null
Alexander Afanasyev24ed83a2015-03-30 11:06:50 -07005
Ashlesh Gawande812af972017-04-21 09:26:37 -05006INSTALLED_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
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050016if [[ -z $INSTALLED_VERSION ]]; then
17 INSTALLED_VERSION=$(git -C ndn-cxx rev-parse HEAD 2>/dev/null || echo NONE)
18fi
Alexander Afanasyev24ed83a2015-03-30 11:06:50 -070019
Davide Pesaventof6be8e32020-04-30 16:06:03 -040020sudo rm -rf ndn-cxx-latest
21git clone --depth 1 https://github.com/named-data/ndn-cxx.git ndn-cxx-latest
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050022LATEST_VERSION=$(git -C ndn-cxx-latest rev-parse HEAD 2>/dev/null || echo UNKNOWN)
23
24if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
Davide Pesaventof6be8e32020-04-30 16:06:03 -040025 sudo rm -rf ndn-cxx
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050026 mv ndn-cxx-latest ndn-cxx
27else
Davide Pesaventof6be8e32020-04-30 16:06:03 -040028 sudo rm -rf ndn-cxx-latest
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050029fi
Nick Gordonb9c5cec2017-06-08 14:10:27 -050030
Davide Pesavento6a81b772017-08-20 18:43:46 -040031sudo rm -f /usr/local/bin/ndnsec*
32sudo rm -fr /usr/local/include/ndn-cxx
Davide Pesavento0b0eddd2019-03-19 14:42:15 -040033sudo rm -f /usr/local/lib{,64}/libndn-cxx*
34sudo rm -f /usr/local/lib{,64}/pkgconfig/libndn-cxx.pc
Alexander Afanasyevbc98fcf2014-08-16 23:18:50 -070035
Muktadir Chowdhuryf04f9892017-08-20 20:42:56 -050036pushd ndn-cxx >/dev/null
Alexander Afanasyevf9f39102015-12-01 17:43:40 -080037
Davide Pesaventof6be8e32020-04-30 16:06:03 -040038if has CentOS-8 $NODE_LABELS; then
39 # https://bugzilla.redhat.com/show_bug.cgi?id=1721553
40 PCH="--without-pch"
41fi
42
43./waf --color=yes configure --disable-static --enable-shared --without-osx-keychain $PCH
44./waf --color=yes build -j$WAF_JOBS
45sudo_preserve_env PATH -- ./waf --color=yes install
Alexander Afanasyev24ed83a2015-03-30 11:06:50 -070046
47popd >/dev/null
48popd >/dev/null
Alexander Afanasyevf9f39102015-12-01 17:43:40 -080049
Davide Pesaventof6be8e32020-04-30 16:06:03 -040050if has CentOS-8 $NODE_LABELS; then
51 sudo tee /etc/ld.so.conf.d/ndn.conf >/dev/null <<< /usr/local/lib64
52fi
Alexander Afanasyevf9f39102015-12-01 17:43:40 -080053if has Linux $NODE_LABELS; then
54 sudo ldconfig
Alexander Afanasyevf9f39102015-12-01 17:43:40 -080055fi