Alexander Afanasyev | a87e0a8 | 2014-10-21 14:09:19 -0400 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Davide Pesavento | 73e946e | 2022-08-06 16:44:54 -0400 | [diff] [blame] | 2 | set -eo pipefail |
Alexander Afanasyev | a87e0a8 | 2014-10-21 14:09:19 -0400 | [diff] [blame] | 3 | |
Davide Pesavento | ab7300b | 2020-04-09 00:51:41 -0400 | [diff] [blame] | 4 | if [[ -z $DISABLE_ASAN ]]; then |
| 5 | ASAN="--with-sanitizer=address" |
| 6 | fi |
| 7 | if [[ $JOB_NAME == *"code-coverage" ]]; then |
| 8 | COVERAGE="--with-coverage" |
| 9 | fi |
Davide Pesavento | 73e946e | 2022-08-06 16:44:54 -0400 | [diff] [blame] | 10 | if [[ $ID == macos && ${VERSION_ID%%.*} -ge 12 ]]; then |
Davide Pesavento | f662500 | 2022-07-31 17:15:02 -0400 | [diff] [blame] | 11 | KEYCHAIN="--without-osx-keychain" |
| 12 | fi |
Davide Pesavento | fbca611 | 2022-07-03 16:31:04 -0400 | [diff] [blame] | 13 | if [[ -n $DISABLE_PCH ]]; then |
Davide Pesavento | 2349e28 | 2020-03-24 14:28:03 -0400 | [diff] [blame] | 14 | PCH="--without-pch" |
| 15 | fi |
| 16 | |
Davide Pesavento | 73e946e | 2022-08-06 16:44:54 -0400 | [diff] [blame] | 17 | set -x |
| 18 | |
Davide Pesavento | 0530b5b | 2016-11-07 03:23:58 +0100 | [diff] [blame] | 19 | if [[ $JOB_NAME != *"code-coverage" && $JOB_NAME != *"limited-build" ]]; then |
Davide Pesavento | 97242f7 | 2020-02-29 14:28:15 -0500 | [diff] [blame] | 20 | # Build static library in release mode with tests and without precompiled headers |
| 21 | ./waf --color=yes configure --enable-static --disable-shared --with-tests --without-pch |
Davide Pesavento | 73e946e | 2022-08-06 16:44:54 -0400 | [diff] [blame] | 22 | ./waf --color=yes build |
Davide Pesavento | dfe9c6b | 2014-08-25 21:17:10 +0200 | [diff] [blame] | 23 | |
Davide Pesavento | 97242f7 | 2020-02-29 14:28:15 -0500 | [diff] [blame] | 24 | # Cleanup |
Davide Pesavento | d776a93 | 2020-03-20 18:42:36 -0400 | [diff] [blame] | 25 | ./waf --color=yes distclean |
Davide Pesavento | dfe9c6b | 2014-08-25 21:17:10 +0200 | [diff] [blame] | 26 | |
Davide Pesavento | 9a8e146 | 2023-12-03 16:33:34 -0500 | [diff] [blame^] | 27 | # Build static and shared library in release mode with examples |
| 28 | ./waf --color=yes configure --enable-static --enable-shared --with-examples $PCH |
Davide Pesavento | 73e946e | 2022-08-06 16:44:54 -0400 | [diff] [blame] | 29 | ./waf --color=yes build |
Davide Pesavento | dfe9c6b | 2014-08-25 21:17:10 +0200 | [diff] [blame] | 30 | |
Davide Pesavento | 97242f7 | 2020-02-29 14:28:15 -0500 | [diff] [blame] | 31 | # Cleanup |
Davide Pesavento | d776a93 | 2020-03-20 18:42:36 -0400 | [diff] [blame] | 32 | ./waf --color=yes distclean |
Davide Pesavento | 0934888 | 2016-09-17 02:39:44 +0200 | [diff] [blame] | 33 | fi |
Davide Pesavento | dfe9c6b | 2014-08-25 21:17:10 +0200 | [diff] [blame] | 34 | |
Davide Pesavento | 9a8e146 | 2023-12-03 16:33:34 -0500 | [diff] [blame^] | 35 | # Build shared library in debug mode with tests |
| 36 | ./waf --color=yes configure --disable-static --enable-shared --debug --with-tests $ASAN $COVERAGE $KEYCHAIN $PCH |
Davide Pesavento | 73e946e | 2022-08-06 16:44:54 -0400 | [diff] [blame] | 37 | ./waf --color=yes build |
Davide Pesavento | dfe9c6b | 2014-08-25 21:17:10 +0200 | [diff] [blame] | 38 | |
Davide Pesavento | 97242f7 | 2020-02-29 14:28:15 -0500 | [diff] [blame] | 39 | # (tests will be run against the debug version) |
Alexander Afanasyev | a87e0a8 | 2014-10-21 14:09:19 -0400 | [diff] [blame] | 40 | |
| 41 | # Install |
Davide Pesavento | 73e946e | 2022-08-06 16:44:54 -0400 | [diff] [blame] | 42 | sudo ./waf --color=yes install |
Alexander Afanasyev | b346ddb | 2015-06-03 00:52:03 -0400 | [diff] [blame] | 43 | |
Davide Pesavento | 73e946e | 2022-08-06 16:44:54 -0400 | [diff] [blame] | 44 | if [[ $ID_LIKE == *fedora* ]]; then |
Davide Pesavento | 2349e28 | 2020-03-24 14:28:03 -0400 | [diff] [blame] | 45 | sudo tee /etc/ld.so.conf.d/ndn.conf >/dev/null <<< /usr/local/lib64 |
| 46 | fi |
Davide Pesavento | 73e946e | 2022-08-06 16:44:54 -0400 | [diff] [blame] | 47 | if [[ $ID_LIKE == *linux* ]]; then |
Alexander Afanasyev | b346ddb | 2015-06-03 00:52:03 -0400 | [diff] [blame] | 48 | sudo ldconfig |
Alexander Afanasyev | b346ddb | 2015-06-03 00:52:03 -0400 | [diff] [blame] | 49 | fi |