Update build flags, Jenkins scripts, and Travis configuration

Change-Id: I738e9a9cd21be6c94e1ae3f646c959cdb89ab6f0
diff --git a/.jenkins b/.jenkins
index 03d67b3..674d751 100755
--- a/.jenkins
+++ b/.jenkins
@@ -7,4 +7,4 @@
     [[ -f $file && -x $file ]] || continue
     echo "Run: $file"
     "$file"
-done
\ No newline at end of file
+done
diff --git a/.jenkins.d/00-deps.sh b/.jenkins.d/00-deps.sh
index 66dafb4..84c8ae1 100755
--- a/.jenkins.d/00-deps.sh
+++ b/.jenkins.d/00-deps.sh
@@ -28,7 +28,6 @@
                              libsqlite3-dev libssl-dev
 
     if [[ $JOB_NAME == *"code-coverage" ]]; then
-        sudo apt-get -qy install lcov libgd-perl python-setuptools
-        sudo easy_install --upgrade gcovr
+        sudo apt-get -qy install gcovr lcov libgd-perl
     fi
 fi
diff --git a/.jenkins.d/10-ndn-cxx.sh b/.jenkins.d/01-ndn-cxx.sh
similarity index 96%
rename from .jenkins.d/10-ndn-cxx.sh
rename to .jenkins.d/01-ndn-cxx.sh
index c9e2a63..29a41ea 100755
--- a/.jenkins.d/10-ndn-cxx.sh
+++ b/.jenkins.d/01-ndn-cxx.sh
@@ -44,7 +44,7 @@
 
 ./waf configure --color=yes --enable-shared --disable-static --without-osx-keychain
 ./waf build --color=yes -j${WAF_JOBS:-1}
-sudo env "PATH=$PATH" ./waf install --color=yes
+sudo_preserve_env PATH -- ./waf install --color=yes
 
 popd >/dev/null
 popd >/dev/null
diff --git a/.jenkins.d/10-build.sh b/.jenkins.d/10-build.sh
new file mode 100755
index 0000000..8907de1
--- /dev/null
+++ b/.jenkins.d/10-build.sh
@@ -0,0 +1,47 @@
+#!/usr/bin/env bash
+set -e
+
+JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+source "$JDIR"/util.sh
+
+set -x
+
+if [[ $JOB_NAME == *"code-coverage" ]]; then
+    COVERAGE="--with-coverage"
+elif [[ -z $DISABLE_ASAN ]]; then
+    ASAN="--with-sanitizer=address"
+fi
+
+# Cleanup
+sudo_preserve_env PATH -- ./waf --color=yes distclean
+
+if [[ $JOB_NAME != *"code-coverage" && $JOB_NAME != *"limited-build" ]]; then
+  # Configure/build in optimized mode with tests
+  ./waf --color=yes configure --with-tests
+  ./waf --color=yes build -j${WAF_JOBS:-1}
+
+  # Cleanup
+  sudo_preserve_env PATH -- ./waf --color=yes distclean
+
+  # Configure/build in optimized mode without tests
+  ./waf --color=yes configure
+  ./waf --color=yes build -j${WAF_JOBS:-1}
+
+  # Cleanup
+  sudo_preserve_env PATH -- ./waf --color=yes distclean
+fi
+
+# Configure/build in debug mode with tests
+./waf --color=yes configure --debug --with-tests $ASAN $COVERAGE
+./waf --color=yes build -j${WAF_JOBS:-1}
+
+# (tests will be run against debug version)
+
+# Install
+sudo_preserve_env PATH -- ./waf --color=yes install
+
+if has Linux $NODE_LABELS; then
+    sudo ldconfig
+elif has FreeBSD $NODE_LABELS; then
+    sudo ldconfig -a
+fi
diff --git a/.jenkins.d/20-build.sh b/.jenkins.d/20-build.sh
deleted file mode 100755
index d8d5be9..0000000
--- a/.jenkins.d/20-build.sh
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/env bash
-set -e
-
-JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
-source "$JDIR"/util.sh
-
-set -x
-
-git submodule init
-git submodule sync
-git submodule update
-
-# Cleanup
-sudo ./waf -j1 --color=yes distclean
-
-if [[ "$JOB_NAME" != *"limited-build" ]]; then
-  # Configure/build in optimized mode with tests
-  ./waf -j1 --color=yes configure --with-tests
-  ./waf -j1 --color=yes build
-
-  # Cleanup
-  sudo ./waf -j1 --color=yes distclean
-
-  # Configure/build in optimized mode without tests
-  ./waf -j1 --color=yes configure
-  ./waf -j1 --color=yes build
-
-  # Cleanup
-  sudo ./waf -j1 --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
-    ASAN="--with-sanitizer=address"
-fi
-./waf -j1 --color=yes configure --debug --with-tests $COVERAGE $ASAN
-./waf -j1 --color=yes build
-
-# (tests will be run against debug version)
-
-# Install
-sudo ./waf -j1 --color=yes install
-
-if has Linux $NODE_LABELS; then
-    sudo ldconfig
-elif has FreeBSD10 $NODE_LABELS; then
-    sudo ldconfig -m
-fi
diff --git a/.jenkins.d/30-tests.sh b/.jenkins.d/20-tests.sh
similarity index 94%
rename from .jenkins.d/30-tests.sh
rename to .jenkins.d/20-tests.sh
index fe7981d..b4d8ec9 100755
--- a/.jenkins.d/30-tests.sh
+++ b/.jenkins.d/20-tests.sh
@@ -35,5 +35,8 @@
 ASAN_OPTIONS+=":strip_path_prefix=${PWD}/"
 export ASAN_OPTIONS
 
+export BOOST_TEST_BUILD_INFO=1
+export BOOST_TEST_COLOR_OUTPUT=1
+
 # Run unit tests
 ./build/unit-tests $(ut_log_args)
diff --git a/.jenkins.d/30-coverage.sh b/.jenkins.d/30-coverage.sh
new file mode 100755
index 0000000..a96e999
--- /dev/null
+++ b/.jenkins.d/30-coverage.sh
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+set -e
+
+JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+source "$JDIR"/util.sh
+
+set -x
+
+if [[ $JOB_NAME == *"code-coverage" ]]; then
+    gcovr --object-directory=build \
+          --output=build/coverage.xml \
+          --exclude="$PWD/tests" \
+          --root=. \
+          --xml
+
+    # Generate also a detailed HTML output, but using lcov (better results)
+    lcov --quiet \
+         --capture \
+         --directory . \
+         --no-external \
+         --rc lcov_branch_coverage=1 \
+         --output-file build/coverage-with-tests.info
+
+    lcov --quiet \
+         --remove build/coverage-with-tests.info "$PWD/tests/*" \
+         --rc lcov_branch_coverage=1 \
+         --output-file build/coverage.info
+
+    genhtml --branch-coverage \
+            --demangle-cpp \
+            --frames \
+            --legend \
+            --output-directory build/coverage \
+            --title "NDN-NAC unit tests" \
+            build/coverage.info
+fi
diff --git a/.jenkins.d/40-coverage.sh b/.jenkins.d/40-coverage.sh
deleted file mode 100755
index 7364c5a..0000000
--- a/.jenkins.d/40-coverage.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env bash
-set -e
-
-JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
-source "$JDIR"/util.sh
-
-set -x
-
-if [[ $JOB_NAME == *"code-coverage" ]]; then
-    gcovr --object-directory=build \
-          --output=build/coverage.xml \
-          --exclude="$PWD/(build|tests)" \
-          --root=. \
-          --xml
-fi
diff --git a/.jenkins.d/README.md b/.jenkins.d/README.md
index 39fa40b..5813349 100644
--- a/.jenkins.d/README.md
+++ b/.jenkins.d/README.md
@@ -27,7 +27,7 @@
   Possible values:
 
   * empty: default build process
-  * `code-coverage` (Linux OS is assumed): debug build with tests and code coverage analysis
+  * `code-coverage` (Ubuntu Linux is assumed): debug build with tests and code coverage analysis
   * `limited-build`: only a single debug build with tests
 
 - `CACHE_DIR`: the variable defines a path to folder containing cached files from previous builds,
diff --git a/.jenkins.d/util.sh b/.jenkins.d/util.sh
index a89bc27..8ddc4ba 100644
--- a/.jenkins.d/util.sh
+++ b/.jenkins.d/util.sh
@@ -16,3 +16,22 @@
     set ${saved_xtrace}
     return ${ret}
 }
+
+sudo_preserve_env() {
+    local saved_xtrace
+    [[ $- == *x* ]] && saved_xtrace=-x || saved_xtrace=+x
+    set +x
+
+    local vars=()
+    while [[ $# -gt 0 ]]; do
+        local arg=$1
+        shift
+        case ${arg} in
+            --) break ;;
+            *)  vars+=("${arg}=${!arg}") ;;
+        esac
+    done
+
+    set ${saved_xtrace}
+    sudo env "${vars[@]}" "$@"
+}
diff --git a/.travis.yml b/.travis.yml
index 984e8ac..10ced08 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,5 @@
 language: cpp
 dist: xenial
-sudo: required
 env:
   global:
     - JOB_NAME=limited-build
@@ -22,12 +21,6 @@
     # Linux/clang
     # https://apt.llvm.org/
     - os: linux
-      env: COMPILER=clang++-3.5
-    - os: linux
-      env: COMPILER=clang++-3.6
-    - os: linux
-      env: COMPILER=clang++-3.7 DISABLE_ASAN=yes
-    - os: linux
       env: COMPILER=clang++-3.8
     - os: linux
       env: COMPILER=clang++-3.9
@@ -39,32 +32,26 @@
       env: COMPILER=clang++-6.0
     - os: linux
       env: COMPILER=clang++-7
+    - os: linux
+      env: COMPILER=clang++-8
 
     # macOS/clang
     # https://docs.travis-ci.com/user/reference/osx/#OS-X-Version
     - os: osx
-      osx_image: xcode7.3
-      env: OSX_VERSION=10.11
-    - os: osx
       osx_image: xcode8.3
       env: OSX_VERSION=10.12
     - os: osx
-      osx_image: xcode9.3
+      osx_image: xcode9.2
+      env: OSX_VERSION=10.12
+    - os: osx
+      osx_image: xcode9.4
+      env: OSX_VERSION=10.13
+    - os: osx
+      osx_image: xcode10.1
       env: OSX_VERSION=10.13
 
   allow_failures:
-    - env: COMPILER=g++-6
-    - env: COMPILER=g++-7
-    - env: COMPILER=g++-8
-    - env: COMPILER=clang++-3.5
-    - env: COMPILER=clang++-3.6
-    - env: COMPILER=clang++-3.7 DISABLE_ASAN=yes
-    - env: COMPILER=clang++-3.8
-    - env: COMPILER=clang++-3.9
-    - env: COMPILER=clang++-4.0
-    - env: COMPILER=clang++-5.0
-    - env: COMPILER=clang++-6.0
-    - env: COMPILER=clang++-7
+    - env: COMPILER=clang++-8
 
   fast_finish: true
 
@@ -78,8 +65,8 @@
       clang++-*)
         CLANG_VERSION=${COMPILER/clang++}
         if [[ ${CLANG_VERSION} != "-3."* ]]; then
-          wget -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/xenial/ llvm-toolchain-xenial${CLANG_VERSION/-7} main"
+          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/xenial/ llvm-toolchain-xenial${CLANG_VERSION/-8} main"
         fi
         travis_retry sudo apt-get -qq update
         travis_retry sudo apt-get -qy install "clang${CLANG_VERSION}"
@@ -89,6 +76,11 @@
 before_script:
   - if [[ ${TRAVIS_OS_NAME} == linux ]]; then export NODE_LABELS="Linux Ubuntu Ubuntu-16.04"; fi
   - if [[ ${TRAVIS_OS_NAME} == osx ]]; then export NODE_LABELS="OSX OSX-${OSX_VERSION}"; fi
+  - if [[ ${TRAVIS_OS_NAME} == osx ]]; 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
   - ${CXX:-c++} --version
   - python --version
diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py
index e690290..6b53d3c 100644
--- a/.waf-tools/default-compiler-flags.py
+++ b/.waf-tools/default-compiler-flags.py
@@ -20,9 +20,9 @@
                       'The minimum supported gcc version is 5.3.0.')
         conf.flags = GccFlags()
     elif cxx == 'clang':
-        if ccver < (3, 5, 0):
+        if ccver < (3, 6, 0):
             errmsg = ('The version of clang you are using is too old.\n'
-                      'The minimum supported clang version is 3.5.0.')
+                      'The minimum supported clang version is 3.6.0.')
         conf.flags = ClangFlags()
     else:
         warnmsg = 'Note: %s compiler is unsupported' % cxx
@@ -186,15 +186,13 @@
         flags['CXXFLAGS'] += ['-fcolor-diagnostics',
                               '-Wextra-semi',
                               '-Wundefined-func-template',
-                              '-Wno-error=deprecated-register',
-                              '-Wno-error=infinite-recursion', # Bug #3358
-                              '-Wno-error=keyword-macro', # Bug #3235
-                              '-Wno-error=unneeded-internal-declaration', # Bug #1588
                               '-Wno-unused-local-typedef', # Bugs #2657 and #3209
                               ]
         version = self.getCompilerVersion(conf)
         if version < (3, 9, 0) or (Utils.unversioned_sys_platform() == 'darwin' and version < (8, 1, 0)):
             flags['CXXFLAGS'] += ['-Wno-unknown-pragmas']
+        if version < (6, 0, 0):
+            flags['CXXFLAGS'] += ['-Wno-missing-braces'] # Bug #4721
         return flags
 
     def getOptimizedFlags(self, conf):
@@ -207,4 +205,6 @@
         version = self.getCompilerVersion(conf)
         if version < (3, 9, 0) or (Utils.unversioned_sys_platform() == 'darwin' and version < (8, 1, 0)):
             flags['CXXFLAGS'] += ['-Wno-unknown-pragmas']
+        if version < (6, 0, 0):
+            flags['CXXFLAGS'] += ['-Wno-missing-braces'] # Bug #4721
         return flags
diff --git a/COPYING.md b/COPYING.md
index 9140750..760a0b4 100644
--- a/COPYING.md
+++ b/COPYING.md
@@ -6,11 +6,12 @@
 - ndn-cxx library is licensed under the terms of the GNU Lesser General Public License,
   version 3 or later.
 
-- The Boost libraries are licensed under the terms of the
-  [Boost Software License, Version 1.0](https://www.boost.org/users/license.html)
+- The Boost libraries are licensed under the
+  [Boost Software License 1.0](https://www.boost.org/users/license.html)
 
 - The waf build system is licensed under the terms of the
-  [BSD license](https://github.com/named-data/ndn-cxx/blob/master/waf)
+  [BSD license](https://github.com/named-data/name-based-access-control/blob/new/waf)
+
 
 The LGPL and GPL licenses are provided below in this file.  For more information
 about these licenses, see https://www.gnu.org/licenses/
diff --git a/wscript b/wscript
index 2010b7f..708d7d9 100644
--- a/wscript
+++ b/wscript
@@ -5,21 +5,25 @@
 
 VERSION = '0.1.0'
 APPNAME = 'ndn-nac'
-PACKAGE_BUGREPORT = "http://redmine.named-data.net/projects/nac"
-GIT_TAG_PREFIX = "nac-"
+PACKAGE_BUGREPORT = 'https://redmine.named-data.net/projects/nac'
+GIT_TAG_PREFIX = 'nac-'
 
 def options(opt):
-    opt.load(['compiler_c', 'compiler_cxx', 'gnu_dirs'])
-    opt.load(['boost', 'default-compiler-flags', 'sanitizers', 'coverage', 'sphinx_build', 'doxygen'],
+    opt.load(['compiler_cxx', 'gnu_dirs'])
+    opt.load(['default-compiler-flags', 'boost',
+              'coverage', 'sanitizers',
+              'doxygen', 'sphinx_build'],
              tooldir=['.waf-tools'])
 
-    opt = opt.add_option_group("NDN-NAC Options")
+    opt = opt.add_option_group('NDN-NAC Options')
 
-    opt.add_option('--with-tests', action='store_true', default=False, dest='with_tests',
-                   help='''Build unit tests''')
+    opt.add_option('--with-tests', action='store_true', default=False,
+                   help='Build unit tests')
 
 def configure(conf):
-    conf.load(['compiler_c', 'compiler_cxx', 'gnu_dirs', 'boost', 'default-compiler-flags', 'sphinx_build', 'doxygen'])
+    conf.load(['compiler_cxx', 'gnu_dirs',
+               'default-compiler-flags', 'boost',
+               'doxygen', 'sphinx_build'])
 
     conf.env['WITH_TESTS'] = conf.options.with_tests
 
@@ -70,13 +74,13 @@
         VERSION_PATCH=VERSION_SPLIT[2])
 
     bld.shlib(
-        target="ndn-nac",
-        name="libndn-nac",
+        target='ndn-nac',
+        name='libndn-nac',
         vnum=VERSION_BASE,
         cnum=VERSION_BASE,
-        source =  bld.path.ant_glob(['src/**/*.cpp']),
-        use = 'BOOST NDN_CXX',
-        includes = ['src', '.'],
+        source=bld.path.ant_glob('src/**/*.cpp'),
+        use='BOOST NDN_CXX',
+        includes=['src', '.'],
         export_includes=['src', '.'])
 
     # Unit tests
@@ -87,23 +91,23 @@
     bld.recurse('examples')
 
     bld.install_files(
-        dest = "%s/ndn-nac" % bld.env['INCLUDEDIR'],
+        dest = '%s/ndn-nac' % bld.env['INCLUDEDIR'],
         files = bld.path.ant_glob(['src/**/*.hpp', 'src/**/*.h', 'common.hpp']),
-        cwd = bld.path.find_dir("src"),
+        cwd = bld.path.find_dir('src'),
         relative_trick = True)
 
     bld.install_files(
-        dest = "%s/ndn-nac" % bld.env['INCLUDEDIR'],
+        dest = '%s/ndn-nac' % bld.env['INCLUDEDIR'],
         files = bld.path.get_bld().ant_glob(['src/**/*.hpp', 'common.hpp', 'config.hpp']),
-        cwd = bld.path.get_bld().find_dir("src"),
-        relative_trick = False )
+        cwd = bld.path.get_bld().find_dir('src'),
+        relative_trick = False)
 
-    bld(features = "subst",
+    bld(features='subst',
         source='libndn-nac.pc.in',
         target='libndn-nac.pc',
         install_path = '${LIBDIR}/pkgconfig',
         PREFIX       = bld.env['PREFIX'],
-        INCLUDEDIR   = "%s/ndn-nac" % bld.env['INCLUDEDIR'],
+        INCLUDEDIR   = '%s/ndn-nac' % bld.env['INCLUDEDIR'],
         VERSION      = VERSION)
 
 def docs(bld):