blob: 5c35e8100fa056ce6839b093f485b57f08959597 [file] [log] [blame]
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -04001#!/usr/bin/env bash
Davide Pesavento73e946e2022-08-06 16:44:54 -04002set -eo pipefail
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -04003
Davide Pesaventoab7300b2020-04-09 00:51:41 -04004if [[ -z $DISABLE_ASAN ]]; then
5 ASAN="--with-sanitizer=address"
6fi
Davide Pesavento80f35032024-02-26 00:55:03 -05007if [[ $ID == macos && ${VERSION_ID%%.*} -ge 12 && -z $GITHUB_ACTIONS ]]; then
Davide Pesaventof6625002022-07-31 17:15:02 -04008 KEYCHAIN="--without-osx-keychain"
9fi
Davide Pesavento2349e282020-03-24 14:28:03 -040010
Davide Pesavento73e946e2022-08-06 16:44:54 -040011set -x
12
Davide Pesavento0530b5b2016-11-07 03:23:58 +010013if [[ $JOB_NAME != *"code-coverage" && $JOB_NAME != *"limited-build" ]]; then
Davide Pesavento97242f72020-02-29 14:28:15 -050014 # Build static library in release mode with tests and without precompiled headers
15 ./waf --color=yes configure --enable-static --disable-shared --with-tests --without-pch
Davide Pesavento73e946e2022-08-06 16:44:54 -040016 ./waf --color=yes build
Davide Pesaventodfe9c6b2014-08-25 21:17:10 +020017
Davide Pesavento97242f72020-02-29 14:28:15 -050018 # Cleanup
Davide Pesaventod776a932020-03-20 18:42:36 -040019 ./waf --color=yes distclean
Davide Pesaventodfe9c6b2014-08-25 21:17:10 +020020
Davide Pesavento80f35032024-02-26 00:55:03 -050021 # Build shared library in release mode with examples and benchmarks
22 ./waf --color=yes configure --disable-static --enable-shared --with-examples --with-benchmarks
Davide Pesavento73e946e2022-08-06 16:44:54 -040023 ./waf --color=yes build
Davide Pesaventodfe9c6b2014-08-25 21:17:10 +020024
Davide Pesavento97242f72020-02-29 14:28:15 -050025 # Cleanup
Davide Pesaventod776a932020-03-20 18:42:36 -040026 ./waf --color=yes distclean
Davide Pesavento09348882016-09-17 02:39:44 +020027fi
Davide Pesaventodfe9c6b2014-08-25 21:17:10 +020028
Davide Pesavento80f35032024-02-26 00:55:03 -050029if [[ $JOB_NAME == *"code-coverage" ]]; then
30 # Build for coverage testing: enable instrumentation and unit tests only
31 ./waf --color=yes configure --debug --with-coverage --with-unit-tests --without-tools $KEYCHAIN
32 ./waf --color=yes build
33else
34 # Build shared library in debug mode with tests
35 ./waf --color=yes configure --disable-static --enable-shared --debug --with-tests $ASAN $KEYCHAIN
36 ./waf --color=yes build
37fi
Alexander Afanasyeva87e0a82014-10-21 14:09:19 -040038
39# Install
Davide Pesavento73e946e2022-08-06 16:44:54 -040040sudo ./waf --color=yes install
Alexander Afanasyevb346ddb2015-06-03 00:52:03 -040041
Davide Pesavento73e946e2022-08-06 16:44:54 -040042if [[ $ID_LIKE == *linux* ]]; then
Davide Pesavento4dc4b3c2024-02-05 20:05:54 -050043 if [[ $(uname -m) == x86_64 && -d /usr/lib64 ]]; then
44 sudo tee /etc/ld.so.conf.d/ndn.conf >/dev/null <<< /usr/local/lib64
45 fi
Alexander Afanasyevb346ddb2015-06-03 00:52:03 -040046 sudo ldconfig
Alexander Afanasyevb346ddb2015-06-03 00:52:03 -040047fi