ci: expand Travis-CI build matrix and use two parallel build jobs

Change-Id: I7dbba5bcd63274daa9b0da2ee9d631a55c1eca9e
diff --git a/.jenkins.d/00-deps.sh b/.jenkins.d/00-deps.sh
index eb4e968..6448fbe 100755
--- a/.jenkins.d/00-deps.sh
+++ b/.jenkins.d/00-deps.sh
@@ -24,12 +24,12 @@
 
 if has Ubuntu $NODE_LABELS; then
     sudo apt-get -qq update
-    sudo apt-get -qq install build-essential pkg-config libboost-all-dev \
+    sudo apt-get -qy install build-essential pkg-config libboost-all-dev \
                              libcrypto++-dev libsqlite3-dev libssl-dev \
                              libpcap-dev
 
     if [[ $JOB_NAME == *"code-coverage" ]]; then
-        sudo apt-get -qq install lcov libgd-perl python-setuptools
+        sudo apt-get -qy install lcov libgd-perl python-setuptools
         sudo easy_install --upgrade gcovr
     fi
 fi
diff --git a/.jenkins.d/01-ndn-cxx.sh b/.jenkins.d/01-ndn-cxx.sh
index e25dd2a..7a42b5a 100755
--- a/.jenkins.d/01-ndn-cxx.sh
+++ b/.jenkins.d/01-ndn-cxx.sh
@@ -35,15 +35,16 @@
     sudo rm -Rf ndn-cxx-latest
 fi
 
-sudo rm -Rf /usr/local/include/ndn-cxx
+sudo rm -f /usr/local/bin/ndnsec*
+sudo rm -fr /usr/local/include/ndn-cxx
 sudo rm -f /usr/local/lib/libndn-cxx*
-sudo rm -f /usr/local/lib/pkgconfig/libndn-cxx*
+sudo rm -f /usr/local/lib/pkgconfig/libndn-cxx.pc
 
 pushd ndn-cxx >/dev/null
 
-./waf configure -j1 --color=yes --enable-shared --disable-static --without-osx-keychain
-./waf -j1 --color=yes
-sudo ./waf install -j1 --color=yes
+./waf configure --color=yes --enable-shared --disable-static --without-osx-keychain
+./waf build --color=yes -j${WAF_JOBS:-1}
+sudo ./waf install --color=yes
 
 popd >/dev/null
 popd >/dev/null
diff --git a/.jenkins.d/10-build.sh b/.jenkins.d/10-build.sh
index a9c3446..1c310a0 100755
--- a/.jenkins.d/10-build.sh
+++ b/.jenkins.d/10-build.sh
@@ -11,34 +11,34 @@
 git submodule update
 
 # Cleanup
-sudo ./waf -j1 --color=yes distclean
+sudo ./waf --color=yes distclean
 
 if [[ $JOB_NAME != *"code-coverage" && $JOB_NAME != *"limited-build" ]]; then
   # Configure/build in optimized mode with tests
-  ./waf -j1 --color=yes configure --with-tests
-  ./waf -j1 --color=yes build
+  ./waf --color=yes configure --with-tests
+  ./waf --color=yes build -j${WAF_JOBS:-1}
 
   # Cleanup
-  sudo ./waf -j1 --color=yes distclean
+  sudo ./waf --color=yes distclean
 
   # Configure/build in optimized mode without tests
-  ./waf -j1 --color=yes configure
-  ./waf -j1 --color=yes build
+  ./waf --color=yes configure
+  ./waf --color=yes build -j${WAF_JOBS:-1}
 
   # Cleanup
-  sudo ./waf -j1 --color=yes distclean
+  sudo ./waf --color=yes distclean
 fi
 
 # Configure/build in debug mode with tests and without precompiled headers
 if [[ $JOB_NAME == *"code-coverage" ]]; then
     COVERAGE="--with-coverage"
-elif ! has OSX-10.9 $NODE_LABELS && ! has OSX-10.11 $NODE_LABELS; then
+elif [[ -n $BUILD_WITH_ASAN || -z $TRAVIS ]]; then
     ASAN="--with-sanitizer=address"
 fi
-./waf -j1 --color=yes configure --debug --with-tests --without-pch $COVERAGE $ASAN
-./waf -j1 --color=yes build
+./waf --color=yes configure --debug --with-tests --without-pch $COVERAGE $ASAN
+./waf --color=yes build -j${WAF_JOBS:-1}
 
 # (tests will be run against debug version)
 
 # Install
-sudo ./waf -j1 --color=yes install
+sudo ./waf --color=yes install
diff --git a/.jenkins.d/README.md b/.jenkins.d/README.md
index 085e383..41812aa 100644
--- a/.jenkins.d/README.md
+++ b/.jenkins.d/README.md
@@ -32,3 +32,5 @@
 
 - `CACHE_DIR`: the variable defines a path to folder containing cached files from previous builds,
   e.g., a compiled version of ndn-cxx library.  If not set, `/tmp` is used.
+
+- `WAF_JOBS`: number of parallel build jobs used by waf, defaults to 1.
diff --git a/.travis.yml b/.travis.yml
index 508b081..f27e3a3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,26 +3,135 @@
 env:
   global:
     - JOB_NAME=limited-build
+    - WAF_JOBS=2
+
 matrix:
   include:
+    # Linux/gcc
     - os: linux
       dist: trusty
       env:
-        - CXX=g++
+        - CXX=g++-4.8
+        - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+        - BUILD_WITH_ASAN=yes
+    - os: linux
+      dist: trusty
+      addons:
+        apt:
+          sources: ubuntu-toolchain-r-test
+          packages: g++-4.9
+      env:
+        - CXX=g++-4.9
+        - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+        - BUILD_WITH_ASAN=yes
+    - os: linux
+      dist: trusty
+      addons:
+        apt:
+          sources: ubuntu-toolchain-r-test
+          packages: g++-5
+      env:
+        - CXX=g++-5
+        - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+        - BUILD_WITH_ASAN=yes
+    - os: linux
+      dist: trusty
+      addons:
+        apt:
+          sources: ubuntu-toolchain-r-test
+          packages: g++-6
+      env:
+        - CXX=g++-6
+        - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+        - BUILD_WITH_ASAN=yes
+    - os: linux
+      dist: trusty
+      addons:
+        apt:
+          sources: ubuntu-toolchain-r-test
+          packages: g++-7
+      env:
+        - CXX=g++-7
+        - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+        - BUILD_WITH_ASAN=yes
+
+    # Linux/clang
+    - os: linux
+      dist: trusty
+      addons:
+        apt:
+          packages: clang-3.5
+      env:
+        - CXX=clang++-3.5
+        - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+        - BUILD_WITH_ASAN=yes
+    - os: linux
+      dist: trusty
+      addons:
+        apt:
+          packages: clang-3.6
+      env:
+        - CXX=clang++-3.6
+        - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+        - BUILD_WITH_ASAN=yes
+    - os: linux
+      dist: trusty
+      addons:
+        apt:
+          sources:
+            - llvm-toolchain-precise-3.7
+            - ubuntu-toolchain-r-test
+          packages: clang-3.7
+      env:
+        - CXX=clang++-3.7
         - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
     - os: linux
       dist: trusty
+      addons:
+        apt:
+          sources:
+            - llvm-toolchain-precise-3.8
+            - ubuntu-toolchain-r-test
+          packages: clang-3.8
       env:
-        - CXX=clang++
+        - CXX=clang++-3.8
         - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+        - BUILD_WITH_ASAN=yes
+    - os: linux
+      dist: trusty
+      addons:
+        apt:
+          sources: llvm-toolchain-trusty-3.9
+          packages: clang-3.9
+      env:
+        - CXX=clang++-3.9
+        - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+    - os: linux
+      dist: trusty
+      addons:
+        apt:
+          sources: llvm-toolchain-trusty-4.0
+          packages: clang-4.0
+      env:
+        - CXX=clang++-4.0
+        - NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+        - BUILD_WITH_ASAN=yes
+
+    # macOS/clang
+    # https://docs.travis-ci.com/user/osx-ci-environment/#OS-X-Version
     - os: osx
-      osx_image: xcode8.2
+      osx_image: xcode7.3
       env:
-        - CXX=clang++
+        - NODE_LABELS="OSX OSX-10.11"
+        - BUILD_WITH_ASAN=yes
+    - os: osx
+      osx_image: xcode8.3
+      env:
         - NODE_LABELS="OSX OSX-10.12"
-notifications:
-  email:
-    on_success: always
-    on_failure: always
+        - BUILD_WITH_ASAN=yes
+
+before_script:
+  - ${CXX:-c++} --version
+
 script:
   - ./.jenkins