ci: update Travis configuration

 * Add testing on arm64, ppc64le, and s390x with select compiler versions
 * Allow disabling the headers check by setting DISABLE_HEADERS_CHECK
 * Drop all versions of gcc < 7 and clang < 5
 * Add clang 11 (development branch)
 * Reenable ASan on Linux with gcc 9 and clang 7, the upstream
   bugs have been fixed; ASan on clang 8 remains disabled
 * Drop Xcode 9.2 (macOS 10.12 is no longer supported)
 * Upgrade Xcode 11 to 11.3
 * Remove USE_OPENSSL_1_1 and always build with openssl 1.1.1,
   since that's the only version available on Homebrew now
 * Workaround issue with missing /usr/local/opt/openssl on macOS
 * Various cleanups

Change-Id: I90e7d61d176b60c1e6b90d2374a7a51dd1deabb3
diff --git a/.jenkins.d/00-deps.sh b/.jenkins.d/00-deps.sh
index ba85553..ae45ce5 100755
--- a/.jenkins.d/00-deps.sh
+++ b/.jenkins.d/00-deps.sh
@@ -7,13 +7,7 @@
 set -x
 
 if has OSX $NODE_LABELS; then
-    FORMULAE=(boost pkg-config)
-    if [[ -n $USE_OPENSSL_1_1 ]]; then
-        FORMULAE+=(openssl@1.1)
-    else
-        FORMULAE+=(openssl)
-    fi
-
+    FORMULAE=(boost openssl pkg-config)
     brew update
     if [[ -n $TRAVIS ]]; then
         # Travis images come with a large number of brew packages
diff --git a/.jenkins.d/10-build.sh b/.jenkins.d/10-build.sh
index 66ec27f..3d2e3bb 100755
--- a/.jenkins.d/10-build.sh
+++ b/.jenkins.d/10-build.sh
@@ -16,35 +16,31 @@
 elif [[ -z $DISABLE_ASAN ]]; then
     ASAN="--with-sanitizer=address"
 fi
-if [[ -n $USE_OPENSSL_1_1 ]] && has OSX $NODE_LABELS; then
-    OPENSSL="--with-openssl=/usr/local/opt/openssl@1.1"
-fi
 
 # Cleanup
 sudo_preserve_env PATH -- ./waf --color=yes distclean
 
 if [[ $JOB_NAME != *"code-coverage" && $JOB_NAME != *"limited-build" ]]; then
-  # Configure/build static library in optimized mode with tests
-  ./waf --color=yes configure --enable-static --disable-shared --with-tests $OPENSSL
-  ./waf --color=yes build -j${WAF_JOBS:-1}
+    # Build static library in release mode with tests and without precompiled headers
+    ./waf --color=yes configure --enable-static --disable-shared --with-tests --without-pch
+    ./waf --color=yes build -j${WAF_JOBS:-1}
 
-  # Cleanup
-  sudo_preserve_env PATH -- ./waf --color=yes distclean
+    # Cleanup
+    sudo_preserve_env PATH -- ./waf --color=yes distclean
 
-  # Configure/build static and shared library in optimized mode without tests
-  ./waf --color=yes configure --enable-static --enable-shared $OPENSSL
-  ./waf --color=yes build -j${WAF_JOBS:-1}
+    # Build static and shared library in release mode without tests
+    ./waf --color=yes configure --enable-static --enable-shared
+    ./waf --color=yes build -j${WAF_JOBS:-1}
 
-  # Cleanup
-  sudo_preserve_env PATH -- ./waf --color=yes distclean
+    # Cleanup
+    sudo_preserve_env PATH -- ./waf --color=yes distclean
 fi
 
-# Configure/build shared library in debug mode with tests/examples and without precompiled headers
-./waf --color=yes configure --disable-static --enable-shared --debug --with-tests \
-                            --with-examples --without-pch $ASAN $COVERAGE $OPENSSL
+# Build shared library in debug mode with tests and examples
+./waf --color=yes configure --disable-static --enable-shared --debug --with-tests --with-examples $ASAN $COVERAGE
 ./waf --color=yes build -j${WAF_JOBS:-1}
 
-# (tests will be run against debug version)
+# (tests will be run against the debug version)
 
 # Install
 sudo_preserve_env PATH -- ./waf --color=yes install
diff --git a/.jenkins.d/40-standalone-header-compilation.sh b/.jenkins.d/40-headers-check.sh
similarity index 83%
rename from .jenkins.d/40-standalone-header-compilation.sh
rename to .jenkins.d/40-headers-check.sh
index cb600ee..1258646 100755
--- a/.jenkins.d/40-standalone-header-compilation.sh
+++ b/.jenkins.d/40-headers-check.sh
@@ -5,6 +5,11 @@
 # It's intentional not to use `set -e`, because this script wants to check all headers
 # (similar to running all test cases), instead of failing at the first error.
 
+if [[ -n $DISABLE_HEADERS_CHECK ]]; then
+  echo 'Skipping headers check.'
+  exit 0
+fi
+
 CXX=${CXX:-g++}
 STD=-std=c++14
 CXXFLAGS="-O2 -Wall -Wno-unused-const-variable -Wno-unused-local-typedef $(pkg-config --cflags libndn-cxx)"
@@ -15,14 +20,14 @@
 NCHECKED=0
 NERRORS=0
 while IFS= read -r -d '' H; do
-  echo "Verifying standalone header compilation for ${H#${INCLUDEDIR}/}"
+  echo "Checking header ${H#${INCLUDEDIR}/}"
   "$CXX" -xc++ $STD $CXXFLAGS -c -o /dev/null "$H"
   [[ $? -eq 0 ]] || ((NERRORS++))
   ((NCHECKED++))
 done < <(find "$INCLUDEDIR" -name '*.hpp' -type f -print0 2>/dev/null)
 
 if [[ $NCHECKED -eq 0 ]]; then
-  echo 'No header found. Is ndn-cxx installed?'
+  echo 'No headers found. Is ndn-cxx installed?'
   exit 1
 else
   echo "$NCHECKED headers checked."
diff --git a/.travis.yml b/.travis.yml
index 570bb0e..a240836 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,112 +1,111 @@
+version: ~> 1.0
 language: cpp
+os: linux
 dist: bionic
+
+arch:
+  - amd64
+  - arm64
+  - ppc64le
+  - s390x
+
 env:
   global:
     - JOB_NAME=limited-build
     - WAF_JOBS=2
+  jobs:
+    - COMPILER=g++-7
+    - COMPILER=g++-9
+    - COMPILER=clang++-6.0
+    - COMPILER=clang++-9
 
-matrix:
+jobs:
   include:
-    # Linux/gcc
-    # https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test/+packages
-    - os: linux
-      env: COMPILER=g++-5
-    - os: linux
-      env: COMPILER=g++-6
-    - os: linux
-      env: COMPILER=g++-7
-    - os: linux
-      env: COMPILER=g++-8
-    # disable AddressSanitizer with gcc 9 due to
-    # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90570
-    - os: linux
-      env: COMPILER=g++-9 DISABLE_ASAN=yes
+    # Linux
+    - env: COMPILER=g++-8
+    - env: COMPILER=clang++-5.0
+    - env: COMPILER=clang++-7
+    - env: COMPILER=clang++-8
+    - env: COMPILER=clang++-10
+    - env: COMPILER=clang++-11
 
-    # Linux/clang
-    # https://apt.llvm.org/
-    - os: linux
-      env: COMPILER=clang++-3.9
-    - os: linux
-      env: COMPILER=clang++-4.0
-    - os: linux
-      env: COMPILER=clang++-5.0
-    - os: linux
-      env: COMPILER=clang++-6.0
-    # disable AddressSanitizer with clang 7 and 8
-    # due to https://bugs.llvm.org/show_bug.cgi?id=40808
-    - os: linux
-      env: COMPILER=clang++-7 DISABLE_ASAN=yes
-    - os: linux
-      env: COMPILER=clang++-8 DISABLE_ASAN=yes
-    - os: linux
-      env: COMPILER=clang++-9
-    - os: linux
-      env: COMPILER=clang++-10
-
-    # macOS/clang
-    # https://docs.travis-ci.com/user/reference/osx/#macos-version
-    - os: osx
-      osx_image: xcode9.2
-      env: OSX_VERSION=10.12
+    # macOS
     - os: osx
       osx_image: xcode9.4
-      env: OSX_VERSION=10.13
+      env: # default compiler
     - os: osx
       osx_image: xcode10.1
-      env: OSX_VERSION=10.13
-    - os: osx
-      osx_image: xcode10.1
-      env: OSX_VERSION=10.13 USE_OPENSSL_1_1=yes
+      env: # default compiler
     - os: osx
       osx_image: xcode10.3
-      env: OSX_VERSION=10.14
+      env: # default compiler
     - os: osx
-      osx_image: xcode10.3
-      env: OSX_VERSION=10.14 USE_OPENSSL_1_1=yes
-    - os: osx
-      osx_image: xcode11
-      env: OSX_VERSION=10.14
-    - os: osx
-      osx_image: xcode11
-      env: OSX_VERSION=10.14 USE_OPENSSL_1_1=yes
+      osx_image: xcode11.3
+      env: # default compiler
 
   allow_failures:
-    - env: COMPILER=clang++-10
+    - env: COMPILER=clang++-11
 
   fast_finish: true
 
-before_install: |
+before_install:
+  - |
+    : Adding apt repositories
     case ${COMPILER} in
-      g++-[567]|clang++-[3456].*)
-        ;;
-      g++-*)
+      g++-9)
+        # https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test/+packages
         travis_retry sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
         travis_retry sudo apt-get -qq update
         ;;
-      clang++-*)
+      clang++-1?)
+        # https://apt.llvm.org/
         LLVM_REPO=${COMPILER/clang++/llvm-toolchain-${TRAVIS_DIST}}
         travis_retry wget -nv -O - "https://apt.llvm.org/llvm-snapshot.gpg.key" | sudo apt-key add -
-        travis_retry sudo add-apt-repository -y "deb http://apt.llvm.org/${TRAVIS_DIST}/ ${LLVM_REPO%-10} main"
+        travis_retry sudo add-apt-repository -y "deb http://apt.llvm.org/${TRAVIS_DIST}/ ${LLVM_REPO%-11} main"
         travis_retry sudo apt-get -qq update
         ;;
     esac
 
 install:
-  - if [[ -n ${COMPILER} ]]; then travis_retry sudo apt-get -qy install "${COMPILER/clang++/clang}"; fi
+  - |
+    : Installing C++ compiler
+    if [[ -n ${COMPILER} ]]; then
+      travis_retry sudo apt-get -qy install ${COMPILER/clang++/clang}
+    fi
 
 before_script:
-  - if [[ ${TRAVIS_OS_NAME} == linux ]]; then export NODE_LABELS="Linux Ubuntu Ubuntu-18.04"; fi
-  - if [[ ${TRAVIS_OS_NAME} == osx ]]; then export NODE_LABELS="OSX OSX-${OSX_VERSION}"; fi
-  # do not waste time upgrading useless packages
-  - if [[ ${TRAVIS_OS_NAME} == osx ]]; then brew pin cgal gdal numpy postgis sfcgal || true; fi
-  - if [[ ${OSX_VERSION} == 10.12 ]]; then brew update; fi
-  # workaround for https://github.com/Homebrew/homebrew-core/issues/26358
-  - if [[ ${OSX_VERSION} == 10.12 ]]; then brew outdated python || brew upgrade python; fi
-  # workaround for https://github.com/travis-ci/travis-ci/issues/6688
-  - if [[ ${OSX_VERSION} == 10.12 ]]; then /usr/bin/yes | pip2 uninstall numpy || true; fi
-  - if [[ -n ${COMPILER} ]]; then export CXX=${COMPILER}; fi
+  - |
+    : Setting environment variables
+    case ${TRAVIS_OS_NAME} in
+      linux)  export NODE_LABELS="Linux Ubuntu Ubuntu-18.04" ;;
+      osx)    export NODE_LABELS="OSX OSX-$(sw_vers -productVersion | cut -d . -f -2)" ;;
+    esac
+    if [[ -n ${COMPILER} ]]; then
+      export CXX=${COMPILER}
+    fi
+  - |
+    : Enabling workarounds
+    case "${TRAVIS_CPU_ARCH},${COMPILER}" in
+      arm64,g++*)
+        # Avoid exceeding the per-job time limit
+        export DISABLE_HEADERS_CHECK=yes
+        ;;
+      ppc64le,g++-7)
+        # AddressSanitizer does not seem to be working
+        export DISABLE_ASAN=yes
+        ;;
+      *,clang++-8)
+        # https://bugs.llvm.org/show_bug.cgi?id=40808
+        export DISABLE_ASAN=yes
+        ;;
+    esac
+    if [[ ${TRAVIS_OS_NAME} == osx ]]; then
+      # Do not waste time upgrading useless packages
+      brew pin cgal gdal postgis sfcgal || true
+      # Ensure /usr/local/opt/openssl exists
+      brew reinstall openssl || true
+    fi
   - ${CXX:-c++} --version
-  - python --version
 
 script:
   - ./.jenkins