blob: 6844e930926cb0a81d082270e6d242513efafec0 [file] [log] [blame]
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -04001#!/usr/bin/env bash
Alexander Afanasyev33ce4c32014-10-24 11:19:45 -07002set -e
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -04003
Alexander Afanasyevb346ddb2015-06-03 00:52:03 -04004JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
5source "$JDIR"/util.sh
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -04006
Davide Pesavento09348882016-09-17 02:39:44 +02007set -x
8
Davide Pesavento71430482017-06-08 20:06:40 -04009sudo rm -f /usr/local/bin/ndnsec*
10sudo rm -fr /usr/local/include/ndn-cxx
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -040011sudo rm -f /usr/local/lib/libndn-cxx*
Davide Pesavento71430482017-06-08 20:06:40 -040012sudo rm -f /usr/local/lib/pkgconfig/libndn-cxx.pc
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -040013
Davide Pesaventodfe9c6b2014-08-25 21:17:10 +020014# Cleanup
Davide Pesavento3cf90782017-08-10 01:21:20 -040015sudo env "PATH=$PATH" ./waf --color=yes distclean
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -040016
Davide Pesavento0530b5b2016-11-07 03:23:58 +010017if [[ $JOB_NAME != *"code-coverage" && $JOB_NAME != *"limited-build" ]]; then
Davide Pesavento09348882016-09-17 02:39:44 +020018 # Configure/build static library in optimized mode with tests
Davide Pesavento3cf90782017-08-10 01:21:20 -040019 ./waf --color=yes configure --enable-static --disable-shared --with-tests
20 ./waf --color=yes build -j${WAF_JOBS:-1}
Davide Pesaventodfe9c6b2014-08-25 21:17:10 +020021
Davide Pesavento09348882016-09-17 02:39:44 +020022 # Cleanup
Davide Pesavento3cf90782017-08-10 01:21:20 -040023 sudo env "PATH=$PATH" ./waf --color=yes distclean
Davide Pesaventodfe9c6b2014-08-25 21:17:10 +020024
Davide Pesavento09348882016-09-17 02:39:44 +020025 # Configure/build static and shared library in optimized mode without tests
Davide Pesavento3cf90782017-08-10 01:21:20 -040026 ./waf --color=yes configure --enable-static --enable-shared
27 ./waf --color=yes build -j${WAF_JOBS:-1}
Davide Pesaventodfe9c6b2014-08-25 21:17:10 +020028
Davide Pesavento09348882016-09-17 02:39:44 +020029 # Cleanup
Davide Pesavento3cf90782017-08-10 01:21:20 -040030 sudo env "PATH=$PATH" ./waf --color=yes distclean
Davide Pesavento09348882016-09-17 02:39:44 +020031fi
Davide Pesaventodfe9c6b2014-08-25 21:17:10 +020032
Davide Pesavento09348882016-09-17 02:39:44 +020033# Configure/build shared library in debug mode with tests/examples and without precompiled headers
Davide Pesavento0530b5b2016-11-07 03:23:58 +010034if [[ $JOB_NAME == *"code-coverage" ]]; then
Alexander Afanasyevb346ddb2015-06-03 00:52:03 -040035 COVERAGE="--with-coverage"
Davide Pesavento71430482017-06-08 20:06:40 -040036elif [[ -n $BUILD_WITH_ASAN || -z $TRAVIS ]]; then
Davide Pesavento50e20022016-09-17 18:50:27 +020037 ASAN="--with-sanitizer=address"
Alexander Afanasyevb346ddb2015-06-03 00:52:03 -040038fi
Davide Pesavento3cf90782017-08-10 01:21:20 -040039./waf --color=yes configure --disable-static --enable-shared --debug --with-tests --with-examples --without-pch $COVERAGE $ASAN
40./waf --color=yes build -j${WAF_JOBS:-1}
Davide Pesaventodfe9c6b2014-08-25 21:17:10 +020041
Alexander Afanasyevb346ddb2015-06-03 00:52:03 -040042# (tests will be run against debug version)
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -040043
44# Install
Davide Pesavento3cf90782017-08-10 01:21:20 -040045sudo env "PATH=$PATH" ./waf --color=yes install
Alexander Afanasyevb346ddb2015-06-03 00:52:03 -040046
47if has Linux $NODE_LABELS; then
48 sudo ldconfig
49elif has FreeBSD $NODE_LABELS; then
50 sudo ldconfig -a
51fi