build+ci: support macOS on arm64
Refs: #5135
Change-Id: Ifac57bf18dea805dc9eab06039806858bb3b6f20
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 47d9a6a..2854627 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -53,7 +53,7 @@
os: macos-11
runs-on: ${{ matrix.os }}
env:
- NODE_LABELS: OSX
+ NODE_LABELS: macos
WAF_JOBS: 3
steps:
- name: Set up Xcode
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index f27285b..19f1f82 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -26,7 +26,7 @@
run: |
case ${RUNNER_OS} in
Linux) export NODE_LABELS="Linux Ubuntu" ;;
- macOS) export NODE_LABELS="OSX" ;;
+ macOS) export NODE_LABELS="macos" ;;
esac
find .jenkins.d/ -type f -name '[1-9]*.sh' -exec chmod -x '{}' +
./.jenkins
diff --git a/.jenkins b/.jenkins
index da10d69..a9abf6d 100755
--- a/.jenkins
+++ b/.jenkins
@@ -4,6 +4,8 @@
if has Linux $NODE_LABELS; then
export PATH="${HOME}/.local/bin${PATH:+:}${PATH}"
+elif [[ -x /opt/homebrew/bin/brew ]]; then
+ eval "$(/opt/homebrew/bin/brew shellenv)"
fi
export CACHE_DIR=${CACHE_DIR:-/tmp}
export WAF_JOBS=${WAF_JOBS:-1}
diff --git a/.jenkins.d/00-deps.sh b/.jenkins.d/00-deps.sh
index d3b16f9..7f56844 100755
--- a/.jenkins.d/00-deps.sh
+++ b/.jenkins.d/00-deps.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -ex
-if has OSX $NODE_LABELS; then
+if has macos $NODE_LABELS; then
FORMULAE=(boost openssl pkg-config)
if [[ $JOB_NAME == *"Docs" ]]; then
FORMULAE+=(doxygen graphviz)
diff --git a/.jenkins.d/10-build.sh b/.jenkins.d/10-build.sh
index a4e6cd5..f703092 100755
--- a/.jenkins.d/10-build.sh
+++ b/.jenkins.d/10-build.sh
@@ -10,6 +10,9 @@
if [[ $JOB_NAME == *"code-coverage" ]]; then
COVERAGE="--with-coverage"
fi
+if has macos-12 $NODE_LABELS; then
+ KEYCHAIN="--without-osx-keychain"
+fi
if [[ -n $DISABLE_PCH ]]; then
PCH="--without-pch"
fi
@@ -31,7 +34,7 @@
fi
# 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 $PCH
+./waf --color=yes configure --disable-static --enable-shared --debug --with-tests --with-examples $ASAN $COVERAGE $KEYCHAIN $PCH
./waf --color=yes build -j$WAF_JOBS
# (tests will be run against the debug version)
diff --git a/.jenkins.d/20-tests.sh b/.jenkins.d/20-tests.sh
index d34fd88..abd520a 100755
--- a/.jenkins.d/20-tests.sh
+++ b/.jenkins.d/20-tests.sh
@@ -4,7 +4,7 @@
# Prepare environment
rm -rf ~/.ndn
-if has OSX $NODE_LABELS; then
+if has macos-10.15 $NODE_LABELS; then
security unlock-keychain -p named-data
fi
diff --git a/.jenkins.d/README.md b/.jenkins.d/README.md
index e8dbf37..d382757 100644
--- a/.jenkins.d/README.md
+++ b/.jenkins.d/README.md
@@ -1,6 +1,6 @@
-# CONTINUOUS INTEGRATION SCRIPTS
+# Continuous Integration Scripts
-## Environment Variables Used in Build Scripts
+## Environment Variables
- `NODE_LABELS`: space-separated list of platform properties. The included values are used by
the build scripts to select the proper behavior for different operating systems and versions.
@@ -9,9 +9,9 @@
Example values:
- - `[OS_TYPE]`: `Linux`, `OSX`
+ - `[OS_TYPE]`: `Linux`, `macos`
- `[DISTRO_TYPE]`: `Ubuntu`, `CentOS`
- - `[DISTRO_VERSION]`: `Ubuntu-16.04`, `Ubuntu-18.04`, `CentOS-8`, `OSX-10.14`, `OSX-10.15`
+ - `[DISTRO_VERSION]`: `ubuntu-20.04`, `ubuntu-22.04`, `centos-9`, `macos-10.15`, `macos-11`
- `JOB_NAME`: optional variable that defines the type of build job. Depending on the job type,
the build scripts can perform different tasks.
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 f086c17..78cf40d 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/.waf-tools/openssl.py b/.waf-tools/openssl.py
index 47bda66..51521c4 100644
--- a/.waf-tools/openssl.py
+++ b/.waf-tools/openssl.py
@@ -19,8 +19,11 @@
from waflib import Utils
from waflib.Configure import conf
-OPENSSL_DIR_OSX = ['/usr/local', '/opt/local', '/usr/local/opt/openssl']
OPENSSL_DIR = ['/usr', '/usr/local', '/opt/local', '/sw']
+OPENSSL_DIR_MACOS = ['/usr/local',
+ '/opt/homebrew/opt/openssl', # Homebrew on arm64
+ '/usr/local/opt/openssl', # Homebrew on x86_64
+ '/opt/local'] # MacPorts
def options(opt):
opt.add_option('--with-openssl', type='string', default=None, dest='openssl_dir',
@@ -43,7 +46,7 @@
openssl_dirs = OPENSSL_DIR
if Utils.unversioned_sys_platform() == 'darwin':
- openssl_dirs = OPENSSL_DIR_OSX
+ openssl_dirs = OPENSSL_DIR_MACOS
for dir in openssl_dirs:
file = self.__openssl_get_version_file(dir)
diff --git a/docs/INSTALL.rst b/docs/INSTALL.rst
index 0393475..45652ab 100644
--- a/docs/INSTALL.rst
+++ b/docs/INSTALL.rst
@@ -7,23 +7,23 @@
ndn-cxx 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
ndn-cxx 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
Prerequisites
-------------
@@ -31,13 +31,13 @@
Required
~~~~~~~~
-- GCC >= 7.4 or clang >= 6.0 (if you are on Linux or FreeBSD)
-- Xcode >= 11.3 or corresponding version of Command Line Tools (if you are on macOS)
-- Python >= 3.6
-- pkg-config
-- Boost >= 1.65.1
-- OpenSSL >= 1.1.1
-- SQLite 3.x
+- GCC >= 7.4 or clang >= 6.0 (if you are on Linux or FreeBSD)
+- Xcode >= 11.3 or corresponding version of Command Line Tools (if you are on macOS)
+- Python >= 3.6
+- pkg-config
+- Boost >= 1.65.1
+- OpenSSL >= 1.1.1
+- SQLite 3.x
To build ndn-cxx from source, one must first install a C++ compiler and all necessary
development tools and libraries:
@@ -83,10 +83,10 @@
To build tutorials, man pages, and API documentation the following additional dependencies
need to be installed:
-- doxygen
-- graphviz
-- sphinx >= 1.3
-- sphinxcontrib-doxylink
+- doxygen
+- graphviz
+- sphinx >= 1.3
+- sphinxcontrib-doxylink
The following lists the steps to install these prerequisites on various common platforms.