blob: 66ec27f02a30c1830fb4c8ee7b86dc89805e34d4 [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
Md Ashiqur Rahman8bd3b8a2018-09-01 23:43:51 +000011sudo rm -f /usr/local/lib{,64}/libndn-cxx*
12sudo rm -f /usr/local/lib{,64}/pkgconfig/libndn-cxx.pc
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -040013
Davide Pesavento9412d122018-01-02 21:52:09 -050014if [[ $JOB_NAME == *"code-coverage" ]]; then
15 COVERAGE="--with-coverage"
16elif [[ -z $DISABLE_ASAN ]]; then
17 ASAN="--with-sanitizer=address"
18fi
19if [[ -n $USE_OPENSSL_1_1 ]] && has OSX $NODE_LABELS; then
20 OPENSSL="--with-openssl=/usr/local/opt/openssl@1.1"
21fi
22
Davide Pesaventodfe9c6b2014-08-25 21:17:10 +020023# Cleanup
Davide Pesaventocdb5d8f2018-09-05 22:27:49 -040024sudo_preserve_env PATH -- ./waf --color=yes distclean
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -040025
Davide Pesavento0530b5b2016-11-07 03:23:58 +010026if [[ $JOB_NAME != *"code-coverage" && $JOB_NAME != *"limited-build" ]]; then
Davide Pesavento09348882016-09-17 02:39:44 +020027 # Configure/build static library in optimized mode with tests
Davide Pesavento9412d122018-01-02 21:52:09 -050028 ./waf --color=yes configure --enable-static --disable-shared --with-tests $OPENSSL
Davide Pesavento3cf90782017-08-10 01:21:20 -040029 ./waf --color=yes build -j${WAF_JOBS:-1}
Davide Pesaventodfe9c6b2014-08-25 21:17:10 +020030
Davide Pesavento09348882016-09-17 02:39:44 +020031 # Cleanup
Davide Pesaventocdb5d8f2018-09-05 22:27:49 -040032 sudo_preserve_env PATH -- ./waf --color=yes distclean
Davide Pesaventodfe9c6b2014-08-25 21:17:10 +020033
Davide Pesavento09348882016-09-17 02:39:44 +020034 # Configure/build static and shared library in optimized mode without tests
Davide Pesavento9412d122018-01-02 21:52:09 -050035 ./waf --color=yes configure --enable-static --enable-shared $OPENSSL
Davide Pesavento3cf90782017-08-10 01:21:20 -040036 ./waf --color=yes build -j${WAF_JOBS:-1}
Davide Pesaventodfe9c6b2014-08-25 21:17:10 +020037
Davide Pesavento09348882016-09-17 02:39:44 +020038 # Cleanup
Davide Pesaventocdb5d8f2018-09-05 22:27:49 -040039 sudo_preserve_env PATH -- ./waf --color=yes distclean
Davide Pesavento09348882016-09-17 02:39:44 +020040fi
Davide Pesaventodfe9c6b2014-08-25 21:17:10 +020041
Davide Pesavento09348882016-09-17 02:39:44 +020042# Configure/build shared library in debug mode with tests/examples and without precompiled headers
Davide Pesavento9412d122018-01-02 21:52:09 -050043./waf --color=yes configure --disable-static --enable-shared --debug --with-tests \
44 --with-examples --without-pch $ASAN $COVERAGE $OPENSSL
Davide Pesavento3cf90782017-08-10 01:21:20 -040045./waf --color=yes build -j${WAF_JOBS:-1}
Davide Pesaventodfe9c6b2014-08-25 21:17:10 +020046
Alexander Afanasyevb346ddb2015-06-03 00:52:03 -040047# (tests will be run against debug version)
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -040048
49# Install
Davide Pesaventocdb5d8f2018-09-05 22:27:49 -040050sudo_preserve_env PATH -- ./waf --color=yes install
Alexander Afanasyevb346ddb2015-06-03 00:52:03 -040051
52if has Linux $NODE_LABELS; then
53 sudo ldconfig
Alexander Afanasyevb346ddb2015-06-03 00:52:03 -040054fi