build+ci: support macOS on arm64

Refs: #5135
Change-Id: I86f1955366df12cfb8b3e6f9d5e9f202778cc211
diff --git a/.jenkins b/.jenkins
index 4456e3a..ee16e29 100755
--- a/.jenkins
+++ b/.jenkins
@@ -16,6 +16,11 @@
         # Emulate a subset of os-release(5)
         export ID=macos
         export VERSION_ID=$(sw_vers -productVersion)
+        if [[ -x /opt/homebrew/bin/brew ]]; then
+            eval "$(/opt/homebrew/bin/brew shellenv)"
+        elif [[ -x /usr/local/bin/brew ]]; then
+            eval "$(/usr/local/bin/brew shellenv)"
+        fi
         ;;
 esac
 
diff --git a/.waf-tools/boost.py b/.waf-tools/boost.py
index 4b2ede5..a6cdabe 100644
--- a/.waf-tools/boost.py
+++ b/.waf-tools/boost.py
@@ -54,8 +54,8 @@
 from waflib.Configure import conf
 from waflib.TaskGen import feature, after_method
 
-BOOST_LIBS = ['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib']
-BOOST_INCLUDES = ['/usr/include', '/usr/local/include', '/opt/local/include', '/sw/include']
+BOOST_LIBS = ['/usr/lib', '/usr/local/lib', '/opt/homebrew/lib', '/opt/local/lib', '/sw/lib', '/lib']
+BOOST_INCLUDES = ['/usr/include', '/usr/local/include', '/opt/homebrew/include', '/opt/local/include', '/sw/include']
 
 BOOST_VERSION_FILE = 'boost/version.hpp'
 BOOST_VERSION_CODE = '''
diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py
index 7c6d282..3ba2dc3 100644
--- a/.waf-tools/default-compiler-flags.py
+++ b/.waf-tools/default-compiler-flags.py
@@ -33,7 +33,7 @@
                       'The minimum supported clang version is 6.0.')
         conf.flags = ClangFlags()
     else:
-        warnmsg = '%s compiler is unsupported' % cxx
+        warnmsg = f'{cxx} compiler is unsupported'
         conf.flags = CompilerFlags()
 
     if errmsg:
@@ -200,7 +200,8 @@
         flags = super(ClangFlags, self).getGeneralFlags(conf)
         if Utils.unversioned_sys_platform() == 'darwin':
             # Bug #4296
-            flags['CXXFLAGS'] += [['-isystem', '/usr/local/include'], # for Homebrew
+            brewdir = '/opt/homebrew' if platform.machine() == 'arm64' else '/usr/local'
+            flags['CXXFLAGS'] += [['-isystem', f'{brewdir}/include'], # for Homebrew
                                   ['-isystem', '/opt/local/include']] # for MacPorts
         elif Utils.unversioned_sys_platform() == 'freebsd':
             # Bug #4790
diff --git a/COPYING.md b/COPYING.md
index 23f7b5d..2d8dce9 100644
--- a/COPYING.md
+++ b/COPYING.md
@@ -9,10 +9,10 @@
 - The Boost libraries are licensed under the
   [Boost Software License 1.0](https://www.boost.org/users/license.html)
 
-- CityHash is licensed under a
+- CityHash is licensed under the
   [MIT license](https://github.com/google/cityhash/blob/master/COPYING)
 
-- Libpcap is licensed under a
+- Libpcap is licensed under the
   [3-clause BSD license](https://github.com/the-tcpdump-group/libpcap/blob/master/LICENSE)
 
 - The WebSocket++ library is licensed under the terms of the
diff --git a/docs/INSTALL.rst b/docs/INSTALL.rst
index 789ecc6..468c346 100644
--- a/docs/INSTALL.rst
+++ b/docs/INSTALL.rst
@@ -7,23 +7,23 @@
 NFD is built against a continuous integration system and has been tested on the
 following platforms:
 
--  Ubuntu 18.04 (amd64, armhf, i386)
--  Ubuntu 20.04 (amd64)
--  Ubuntu 21.10 (amd64)
--  CentOS Stream 9
--  macOS 10.15
--  macOS 11 (Intel only)
+- Ubuntu 18.04
+- Ubuntu 20.04
+- Ubuntu 22.04
+- Debian 11
+- CentOS Stream 9
+- macOS 10.15
+- macOS 11
+- macOS 12
 
 NFD is known to work on the following platforms, although they are not officially
 supported:
 
--  Alpine >= 3.12
--  Debian >= 10
--  Fedora >= 29
--  Gentoo Linux
--  Raspberry Pi OS (formerly Raspbian) >= 2019-06-20
--  FreeBSD >= 12.0
--  macOS 10.14
+- Alpine >= 3.12
+- Fedora >= 29
+- Gentoo Linux
+- Raspberry Pi OS (formerly Raspbian) >= 2019-06-20
+- FreeBSD >= 12.0
 
 .. _Install NFD on Ubuntu Linux using the NDN PPA repository:
 
@@ -76,7 +76,7 @@
 
 The first step is to obtain the source code for NFD and its main dependency, the
 *ndn-cxx* library. If you do not want a development version of NFD, make sure you
-checkout the correct release tag (e.g., ``*-0.7.1``) from both repositories.
+checkout the correct release tag (e.g., ``*-0.8.0``) from both repositories.
 
 .. code-block:: sh
 
@@ -100,7 +100,7 @@
 
 On Linux, NFD needs the following dependencies to enable optional features:
 
-- On **Ubuntu**:
+- On **Debian** and **Ubuntu**:
 
   .. code-block:: sh
 
diff --git a/launchd/README.md b/launchd/README.md
index b04d55f..4cd53af 100644
--- a/launchd/README.md
+++ b/launchd/README.md
@@ -1,13 +1,12 @@
-Starting NFD on OSX >= 10.8
-===========================
+# Starting NFD on macOS
 
-OSX provides a standard way to start system daemons, monitor their health, and restart
-when they die.
+macOS provides a standard way to start system daemons, monitor their health, and restart
+them when they die.
 
-Initial setup
--------------
+## Initial setup
 
-Edit `net.named-data.nfd` correcting paths for `nfd` binary, configuration and log files.
+Edit `net.named-data.nfd.plist` as needed, adjusting the paths for the `nfd` binary,
+configuration, and log files.
 
     # Copy launchd.plist for NFD
     sudo cp net.named-data.nfd.plist /Library/LaunchDaemons/
@@ -58,8 +57,8 @@
 
 `HOME` directory for `nfd` should be created and configured with correct library's config file
 and contain proper NDN security credentials for signing Data packets.  This is necessary since
-default private key storage on OSX (`osx-keychain`) does not support non-interactive access,
-and file-based private key storage needs to be used:
+the default private key storage on macOS (`tpm-osxkeychain`) does not support non-interactive
+access, and file-based private key storage needs to be used:
 
     # Create HOME and generate self-signed NDN certificate for nfd
     sudo -s -- ' \
@@ -115,13 +114,10 @@
         /usr/local/etc/ndn/certs/localhost_daemons_nfd.ndncert; \
       '
 
-
-Enable auto-start
------------------
+## Enable auto-start
 
     sudo launchctl load -w /Library/LaunchDaemons/net.named-data.nfd.plist
 
-Disable auto-start
-------------------
+## Disable auto-start
 
     sudo launchctl unload -w /Library/LaunchDaemons/net.named-data.nfd.plist
diff --git a/tests/daemon/face/udp-factory.t.cpp b/tests/daemon/face/udp-factory.t.cpp
index c243ddc..5d9613e 100644
--- a/tests/daemon/face/udp-factory.t.cpp
+++ b/tests/daemon/face/udp-factory.t.cpp
@@ -423,17 +423,25 @@
   parseConfig(CONFIG1, false);
   auto udpMcastFaces = this->listUdp6McastFaces();
   BOOST_REQUIRE_EQUAL(udpMcastFaces.size(), netifsV6.size());
-  auto expectedAddr = boost::asio::ip::address_v6::from_string("ff02::1101");
-  expectedAddr.scope_id(netifsV6.front()->getIndex());
-  BOOST_CHECK_EQUAL(udpMcastFaces.front()->getRemoteUri(), FaceUri(udp::Endpoint(expectedAddr, 7011)));
+  auto uri = udpMcastFaces.front()->getRemoteUri();
+  BOOST_CHECK_EQUAL(uri.getScheme(), "udp6");
+  // check the address ignoring the scope id
+  auto addr = boost::asio::ip::address_v6::from_string(uri.getHost());
+  addr.scope_id(0);
+  BOOST_CHECK_EQUAL(addr, boost::asio::ip::address_v6::from_string("ff02::1101"));
+  BOOST_CHECK_EQUAL(uri.getPort(), "7011");
 
   parseConfig(CONFIG2, false);
   g_io.poll();
   udpMcastFaces = this->listUdp6McastFaces();
   BOOST_REQUIRE_EQUAL(udpMcastFaces.size(), netifsV6.size());
-  expectedAddr = boost::asio::ip::address_v6::from_string("ff02::1102");
-  expectedAddr.scope_id(netifsV6.front()->getIndex());
-  BOOST_CHECK_EQUAL(udpMcastFaces.front()->getRemoteUri(), FaceUri(udp::Endpoint(expectedAddr, 7012)));
+  uri = udpMcastFaces.front()->getRemoteUri();
+  BOOST_CHECK_EQUAL(uri.getScheme(), "udp6");
+  // check the address ignoring the scope id
+  addr = boost::asio::ip::address_v6::from_string(uri.getHost());
+  addr.scope_id(0);
+  BOOST_CHECK_EQUAL(addr, boost::asio::ip::address_v6::from_string("ff02::1102"));
+  BOOST_CHECK_EQUAL(uri.getPort(), "7012");
 }
 
 BOOST_FIXTURE_TEST_CASE(Whitelist, UdpFactoryMcastFixture)