build: update waf to version 2.0.6

Major cleanup of all build scripts

Change-Id: I6904f034d40adc66366fdf08749900ffb31c68d9
This commit is contained in:
Davide Pesavento
2018-03-03 18:43:53 -05:00
parent cdf7845986
commit 0064c1dd91
18 changed files with 424 additions and 485 deletions
+30 -9
View File
@@ -1,9 +1,30 @@
.DS*
.waf-1*
.waf3-*
.lock*
*.pyc
*.pyo
build/
VERSION
unit-tests.conf
# Emacs
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
.\#*
# Visual Studio Code
.vscode/
# macOS
.DS_Store
.AppleDouble
.LSOverride
._*
# Waf build system
/build/
.waf-*-*/
.waf3-*-*/
.lock-waf*
# Compiled python code
__pycache__/
*.py[cod]
# Other
/unit-tests.conf
/VERSION
+4 -4
View File
@@ -1,15 +1,15 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
from waflib import TaskGen, Logs
from waflib import TaskGen
def options(opt):
opt.add_option('--with-coverage', action='store_true', default=False, dest='with_coverage',
help='''Set compiler flags for gcc to enable code coverage information''')
opt.add_option('--with-coverage', action='store_true', default=False,
help='Add compiler flags to enable code coverage information')
def configure(conf):
if conf.options.with_coverage:
if not conf.options.debug:
conf.fatal("Code coverage flags require debug mode compilation (add --debug)")
conf.fatal('Code coverage flags require debug mode compilation (add --debug)')
conf.check_cxx(cxxflags=['-fprofile-arcs', '-ftest-coverage', '-fPIC'],
linkflags=['-fprofile-arcs'], uselib_store='GCOV', mandatory=True)
+22 -20
View File
@@ -1,16 +1,17 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
from waflib import Logs, Configure, Utils
from waflib import Configure, Logs, Utils
def options(opt):
opt.add_option('--debug', '--with-debug', action='store_true', default=False, dest='debug',
help='''Compile in debugging mode with minimal optimizations (-O0 or -Og)''')
opt.add_option('--debug', '--with-debug', action='store_true', default=False,
help='Compile in debugging mode with minimal optimizations (-O0 or -Og)')
def configure(conf):
conf.start_msg('Checking C++ compiler version')
cxx = conf.env['CXX_NAME'] # CXX_NAME is the generic name of the compiler
ccver = tuple(int(i) for i in conf.env['CC_VERSION'])
cxx = conf.env.CXX_NAME # generic name of the compiler
ccver = tuple(int(i) for i in conf.env.CC_VERSION)
ccverstr = '.'.join(conf.env.CC_VERSION)
errmsg = ''
warnmsg = ''
if cxx == 'gcc':
@@ -28,13 +29,13 @@ def configure(conf):
conf.flags = CompilerFlags()
if errmsg:
conf.end_msg('.'.join(conf.env['CC_VERSION']), color='RED')
conf.end_msg(ccverstr, color='RED')
conf.fatal(errmsg)
elif warnmsg:
conf.end_msg('.'.join(conf.env['CC_VERSION']), color='YELLOW')
conf.end_msg(ccverstr, color='YELLOW')
Logs.warn(warnmsg)
else:
conf.end_msg('.'.join(conf.env['CC_VERSION']))
conf.end_msg(ccverstr)
conf.areCustomCxxflagsPresent = (len(conf.env.CXXFLAGS) > 0)
@@ -53,10 +54,10 @@ def check_compiler_flags(conf):
extraFlags = conf.flags.getDebugFlags(conf)
if conf.areCustomCxxflagsPresent:
missingFlags = [x for x in extraFlags['CXXFLAGS'] if x not in conf.env.CXXFLAGS]
if len(missingFlags) > 0:
Logs.warn("Selected debug mode, but CXXFLAGS is set to a custom value '%s'"
% " ".join(conf.env.CXXFLAGS))
Logs.warn("Default flags '%s' are not activated" % " ".join(missingFlags))
if missingFlags:
Logs.warn('Selected debug mode, but CXXFLAGS is set to a custom value "%s"'
% ' '.join(conf.env.CXXFLAGS))
Logs.warn('Default flags "%s" will not be used' % ' '.join(missingFlags))
else:
extraFlags = conf.flags.getOptimizedFlags(conf)
@@ -106,6 +107,9 @@ def add_supported_linkflags(self, linkflags):
class CompilerFlags(object):
def getCompilerVersion(self, conf):
return tuple(int(i) for i in conf.env.CC_VERSION)
def getGeneralFlags(self, conf):
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are always needed"""
return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': []}
@@ -160,16 +164,14 @@ class GccBasicFlags(CompilerFlags):
class GccFlags(GccBasicFlags):
def getDebugFlags(self, conf):
flags = super(GccFlags, self).getDebugFlags(conf)
version = tuple(int(i) for i in conf.env['CC_VERSION'])
if version < (5, 1, 0):
if self.getCompilerVersion(conf) < (5, 1, 0):
flags['CXXFLAGS'] += ['-Wno-missing-field-initializers']
flags['CXXFLAGS'] += ['-fdiagnostics-color'] # gcc >= 4.9
return flags
def getOptimizedFlags(self, conf):
flags = super(GccFlags, self).getOptimizedFlags(conf)
version = tuple(int(i) for i in conf.env['CC_VERSION'])
if version < (5, 1, 0):
if self.getCompilerVersion(conf) < (5, 1, 0):
flags['CXXFLAGS'] += ['-Wno-missing-field-initializers']
flags['CXXFLAGS'] += ['-fdiagnostics-color'] # gcc >= 4.9
return flags
@@ -177,8 +179,8 @@ class GccFlags(GccBasicFlags):
class ClangFlags(GccBasicFlags):
def getGeneralFlags(self, conf):
flags = super(ClangFlags, self).getGeneralFlags(conf)
version = tuple(int(i) for i in conf.env['CC_VERSION'])
if Utils.unversioned_sys_platform() == 'darwin' and version >= (9, 0, 0): # Bug #4296
if Utils.unversioned_sys_platform() == 'darwin' and self.getCompilerVersion(conf) >= (9, 0, 0):
# Bug #4296
flags['CXXFLAGS'] += [['-isystem', '/usr/local/include'], # for Homebrew
['-isystem', '/opt/local/include']] # for MacPorts
return flags
@@ -194,7 +196,7 @@ class ClangFlags(GccBasicFlags):
'-Wno-error=unneeded-internal-declaration', # Bug #1588
'-Wno-unused-local-typedef', # Bugs #2657 and #3209
]
version = tuple(int(i) for i in conf.env['CC_VERSION'])
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']
return flags
@@ -206,7 +208,7 @@ class ClangFlags(GccBasicFlags):
'-Wundefined-func-template',
'-Wno-unused-local-typedef', # Bugs #2657 and #3209
]
version = tuple(int(i) for i in conf.env['CC_VERSION'])
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']
return flags
+5 -5
View File
@@ -4,10 +4,10 @@ from waflib import Options, Logs
from waflib.Configure import conf
def addDependencyOptions(self, opt, name, extraHelp=''):
opt.add_option('--with-%s' % name, type='string', default=None,
dest='with_%s' % name,
opt.add_option('--with-%s' % name, metavar='PATH',
help='Path to %s, e.g., /usr/local %s' % (name, extraHelp))
setattr(Options.OptionsContext, "addDependencyOptions", addDependencyOptions)
setattr(Options.OptionsContext, 'addDependencyOptions', addDependencyOptions)
@conf
def checkDependency(self, name, **kw):
@@ -18,8 +18,8 @@ def checkDependency(self, name, **kw):
kw['mandatory'] = kw.get('mandatory', True)
if root:
isOk = self.check_cxx(includes="%s/include" % root,
libpath="%s/lib" % root,
isOk = self.check_cxx(includes='%s/include' % root,
libpath='%s/lib' % root,
**kw)
else:
isOk = self.check_cxx(**kw)
+5 -10
View File
@@ -52,7 +52,7 @@ Note that precompiled header must have multiple inclusion guards. If the guards
"""
import os
from waflib import Task, TaskGen, Logs, Utils
from waflib import Task, TaskGen, Utils
from waflib.Tools import c_preproc, cxx
@@ -67,11 +67,6 @@ def options(opt):
def configure(conf):
if (conf.options.with_pch and conf.env['COMPILER_CXX'] in PCH_COMPILER_OPTIONS.keys()):
if Utils.unversioned_sys_platform() == "darwin" and conf.env['CXX_NAME'] == 'clang':
version = tuple(int(i) for i in conf.env['CC_VERSION'])
if version < (6, 1, 0):
# Issue #2804
return
conf.env.WITH_PCH = True
flags = PCH_COMPILER_OPTIONS[conf.env['COMPILER_CXX']]
conf.env.CXXPCH_F = flags[0]
@@ -95,8 +90,8 @@ def apply_pch(self):
if getattr(self, 'name', None):
try:
task = self.bld.pch_tasks[self.name]
self.bld.fatal("Duplicated 'pch' task with name %r" % self.name)
task = self.bld.pch_tasks["%s.%s" % (self.name, self.idx)]
self.bld.fatal("Duplicated 'pch' task with name %r" % "%s.%s" % (self.name, self.idx))
except KeyError:
pass
@@ -109,7 +104,7 @@ def apply_pch(self):
self.pch_task = task
if getattr(self, 'name', None):
self.bld.pch_tasks[self.name] = task
self.bld.pch_tasks["%s.%s" % (self.name, self.idx)] = task
@TaskGen.feature('cxx')
@TaskGen.after_method('process_source', 'propagate_uselib_vars')
@@ -134,7 +129,7 @@ def add_pch(self):
x.env.append_value('CXXFLAGS', self.env['CXXPCH_F'] + [pch.target])
class gchx(Task.Task):
run_str = '${CXX} ${ARCH_ST:ARCH} ${CXXFLAGS} ${CPPFLAGS} ${CXXPCH_FLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${CXXPCH_F:SRC} ${CXX_SRC_F}${SRC[0].abspath()} ${CXX_TGT_F}${TGT[0].abspath()}'
run_str = '${CXX} ${ARCH_ST:ARCH} ${CXXFLAGS} ${CXXPCH_FLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${CXXPCH_F:SRC} ${CXX_SRC_F}${SRC[0].abspath()} ${CXX_TGT_F}${TGT[0].abspath()} ${CPPFLAGS}'
scan = c_preproc.scan
color = 'BLUE'
ext_out=['.h']
+5 -4
View File
@@ -1,6 +1,6 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
#
# Copyright (c) 2014, Regents of the University of California
# Copyright (c) 2014-2018, Regents of the University of California
#
# GPL 3.0 license, see the COPYING.md file for more information
@@ -15,8 +15,9 @@ BOOST_ASIO_HAS_LOCAL_SOCKETS_CHECK = '''
def addUnixOptions(self, opt):
opt.add_option('--force-unix-socket', action='store_true', default=False,
dest='force_unix_socket', help='''Forcefully enable Unix sockets support''')
setattr(Options.OptionsContext, "addUnixOptions", addUnixOptions)
help='Forcefully enable Unix sockets support')
setattr(Options.OptionsContext, 'addUnixOptions', addUnixOptions)
def configure(conf):
def boost_asio_has_local_sockets():
@@ -26,4 +27,4 @@ def configure(conf):
if conf.options.force_unix_socket or boost_asio_has_local_sockets():
conf.define('HAVE_UNIX_SOCKETS', 1)
conf.env['HAVE_UNIX_SOCKETS'] = True
conf.env.HAVE_UNIX_SOCKETS = True
+12 -15
View File
@@ -6,7 +6,8 @@ import re
def addWebsocketOptions(self, opt):
opt.add_option('--without-websocket', action='store_false', default=True,
dest='with_websocket', help='Disable WebSocket face support')
setattr(Options.OptionsContext, "addWebsocketOptions", addWebsocketOptions)
setattr(Options.OptionsContext, 'addWebsocketOptions', addWebsocketOptions)
@Configure.conf
def checkWebsocket(self, **kw):
@@ -15,7 +16,7 @@ def checkWebsocket(self, **kw):
isMandatory = kw.get('mandatory', True)
self.start_msg('Checking for WebSocket includes')
self.start_msg('Checking for WebSocket++ includes')
try:
websocketDir = self.path.find_dir('websocketpp/websocketpp')
@@ -24,40 +25,36 @@ def checkWebsocket(self, **kw):
versionFile = websocketDir.find_node('version.hpp')
if not websocketDir:
raise Errors.WafError('Corrupted: WebSocket version file not found')
raise Errors.WafError('WebSocket++ version file not found')
try:
txt = versionFile.read()
except (OSError, IOError):
raise Errors.WafError('Corrupted: cannot read WebSocket version file')
raise Errors.WafError('Cannot read WebSocket++ version file')
version = [None, None, None]
# Looking for the following:
# static int const major_version = 0;
# static int const minor_version = 7;
# static int const patch_version = 0;
version = [None, None, None]
majorVersion = re.compile('^static int const major_version = (\\d+);$', re.M)
version[0] = majorVersion.search(txt)
minorVersion = re.compile('^static int const minor_version = (\\d+);$', re.M)
version[1] = minorVersion.search(txt)
patchVersion = re.compile('^static int const patch_version = (\\d+);$', re.M)
version[2] = patchVersion.search(txt)
if not version[0] or not version[1] or not version[2]:
raise Errors.WafError('Corrupted: cannot detect websocket version')
raise Errors.WafError('Cannot detect WebSocket++ version')
self.env['WEBSOCKET_VERSION'] = [i.group(1) for i in version]
self.env.WEBSOCKET_VERSION = [i.group(1) for i in version]
# todo: version checking, if necessary
self.end_msg('.'.join(self.env['WEBSOCKET_VERSION']))
self.end_msg('.'.join(self.env.WEBSOCKET_VERSION))
self.env['INCLUDES_WEBSOCKET'] = websocketDir.parent.abspath()
self.env['HAVE_WEBSOCKET'] = True
self.env.INCLUDES_WEBSOCKET = websocketDir.parent.abspath()
self.env.HAVE_WEBSOCKET = True
self.define('HAVE_WEBSOCKET', 1)
self.define('_WEBSOCKETPP_CPP11_STL_', 1)
@@ -71,6 +68,6 @@ def checkWebsocket(self, **kw):
Logs.warn(' curl -L https://github.com/zaphoyd/websocketpp/archive/0.7.0.tar.gz > websocket.tar.gz')
Logs.warn(' tar zxf websocket.tar.gz -C websocketpp/ --strip 1')
Logs.warn('Alternatively, WebSocket support can be disabled with --without-websocket')
self.fatal("The configuration failed")
self.fatal('The configuration failed')
else:
self.end_msg(str(error))
View File
+69 -149
View File
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# NFD - Named Data Networking Forwarding Daemon documentation build configuration file, created by
# sphinx-quickstart on Sun Apr 6 19:58:22 2014.
# NFD documentation build configuration file, created by
# sphinx-quickstart on Wed Mar 7 19:23:56 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
@@ -21,10 +21,12 @@ import sys
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('.'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
@@ -46,149 +48,79 @@ def addExtensionIfExists(extension):
addExtensionIfExists('sphinxcontrib.doxylink')
if os.getenv('GOOGLE_ANALYTICS', None):
addExtensionIfExists('sphinxcontrib.googleanalytics')
# sphinxcontrib.googleanalytics is currently not working with the latest version of Sphinx
# if os.getenv('GOOGLE_ANALYTICS', None):
# addExtensionIfExists('sphinxcontrib.googleanalytics')
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'NFD - Named Data Networking Forwarding Daemon'
copyright = u'2014-%d, Named Data Networking Project' % datetime.date.today().year
author = u'Named Data Networking Project'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
# version = u''
# The full version, including alpha/beta/rc tags.
# release = u''
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = []
# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
# html_theme = 'default'
#
# html_theme = 'alabaster'
html_theme = 'named_data_theme'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
#
# html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
html_theme_path = ['./']
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
html_theme_path = ['.']
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#html_extra_path = []
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
html_file_suffix = ".html"
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'nfd-docs'
@@ -197,80 +129,68 @@ htmlhelp_basename = 'nfd-docs'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'nfd-docs.tex', u'NFD - Named Data Networking Forwarding Daemon Documentation',
u'Named Data Networking Project', 'manual'),
('index', 'nfd-docs.tex', u'NFD - Named Data Networking Forwarding Daemon Documentation',
u'Named Data Networking Project', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('manpages/nfd', 'nfd', u'Named Data Networking Forwarding Daemon', None, 1),
('manpages/nfdc', 'nfdc', u'interact with NFD management', None, 1),
('manpages/nfdc-status', 'nfdc-status', u'show NFD status', None, 1),
('manpages/nfdc-face', 'nfdc-face', u'show and manipulate NFD faces', None, 1),
('manpages/nfdc-route', 'nfdc-route', u'show and manipulate NFD routes', None, 1),
('manpages/nfdc-cs', 'nfdc-cs', u'show and manipulate NFD Content Store', None, 1),
('manpages/nfdc-strategy', 'nfdc-strategy', u'show and manipulate NFD strategy choices', None, 1),
('manpages/nfd-status', 'nfd-status', u'comprehensive report of NFD status', None, 1),
('manpages/nfd-status-http-server', 'nfd-status-http-server',
u'NFD status HTTP server', None, 1),
('manpages/ndn-autoconfig-server', 'ndn-autoconfig-server',
u'NDN auto-configuration server', None, 1),
('manpages/ndn-autoconfig', 'ndn-autoconfig',
u'NDN auto-configuration client', None, 1),
('manpages/ndn-autoconfig.conf', 'ndn-autoconfig.conf',
u'NDN auto-configuration client configuration file', None, 5),
('manpages/nfd-autoreg', 'nfd-autoreg', u'NFD Auto-registration Server', None, 1),
('manpages/nfd-asf-strategy', 'nfd-asf-strategy', u'NFD ASF Strategy', None, 7),
('manpages/nfd', 'nfd', u'Named Data Networking Forwarding Daemon', '', 1),
('manpages/nfdc', 'nfdc', u'Interact with NFD management', '', 1),
('manpages/nfdc-status', 'nfdc-status', u'Show NFD status', '', 1),
('manpages/nfdc-face', 'nfdc-face', u'Show and manipulate NFD faces', '', 1),
('manpages/nfdc-route', 'nfdc-route', u'Show and manipulate NFD routes', '', 1),
('manpages/nfdc-cs', 'nfdc-cs', u'Show and manipulate NFD Content Store', '', 1),
('manpages/nfdc-strategy', 'nfdc-strategy', u'Show and manipulate NFD strategy choices', '', 1),
('manpages/nfd-status', 'nfd-status', u'Comprehensive report of NFD status', '', 1),
('manpages/nfd-status-http-server', 'nfd-status-http-server', u'NFD status HTTP server', '', 1),
('manpages/ndn-autoconfig-server', 'ndn-autoconfig-server', u'NDN auto-configuration server', '', 1),
('manpages/ndn-autoconfig', 'ndn-autoconfig', u'NDN auto-configuration client', '', 1),
('manpages/ndn-autoconfig.conf', 'ndn-autoconfig.conf', u'NDN auto-configuration client configuration file', '', 5),
('manpages/nfd-autoreg', 'nfd-autoreg', u'NFD auto-registration server', '', 1),
('manpages/nfd-asf-strategy', 'nfd-asf-strategy', u'NFD ASF strategy', '', 7),
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = []
doxylink = {
'nfd' : ('NFD.tag', 'doxygen/'),
'nfd' : ('NFD.tag', 'doxygen/'),
}
if os.getenv('GOOGLE_ANALYTICS', None):
googleanalytics_id = os.environ['GOOGLE_ANALYTICS']
googleanalytics_enabled = True
redmine_project_url = "https://redmine.named-data.net/"
redmine_project_url = 'https://redmine.named-data.net/'
+2 -3
View File
@@ -2,9 +2,8 @@ NFD - Named Data Networking Forwarding Daemon
=============================================
NFD is a network forwarder that implements and evolves together with the Named Data
Networking (NDN) `protocol <https://named-data.net/doc/ndn-tlv/>`__. After the initial
release, NFD will become a core component of the `NDN Platform
<https://named-data.net/codebase/platform/>`__ and will follow the same release cycle.
Networking (NDN) `protocol <https://named-data.net/doc/ndn-tlv/>`__. NFD is a core
component of the `NDN Platform <https://named-data.net/codebase/platform/>`__.
NFD Documentation
-----------------
+3 -3
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Copyright (c) 2014-2018, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -24,13 +24,13 @@
*/
#include "core/manager-base.hpp"
#include "manager-common-fixture.hpp"
#include "tests/manager-common-fixture.hpp"
#include <ndn-cxx/mgmt/nfd/control-command.hpp>
#include <ndn-cxx/security/key-chain.hpp>
#include <ndn-cxx/security/pib/identity.hpp>
#include <ndn-cxx/security/pib/key.hpp>
#include <ndn-cxx/security/pib/pib.hpp>
#include <ndn-cxx/mgmt/nfd/control-command.hpp>
namespace nfd {
namespace tests {
+1 -1
View File
@@ -26,8 +26,8 @@
#include "face/generic-link-service.hpp"
#include "face/face.hpp"
#include "test-common.hpp"
#include "dummy-transport.hpp"
#include "tests/test-common.hpp"
#include <ndn-cxx/lp/empty-value.hpp>
#include <ndn-cxx/lp/prefix-announcement.hpp>
+15 -24
View File
@@ -1,7 +1,6 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
"""
Copyright (c) 2014-2016, Regents of the University of California,
Copyright (c) 2014-2018, Regents of the University of California,
Arizona Board of Regents,
Colorado State University,
University Pierre & Marie Curie, Sorbonne University,
@@ -30,29 +29,21 @@ def build(bld):
for module, name in {"cs-benchmark": "CS Benchmark",
"pit-fib-benchmark": "PIT & FIB Benchmark"}.items():
# main
bld(target='unit-tests-%s-main' % module,
name='unit-tests-%s-main' % module,
features='cxx',
source='../main.cpp',
use='BOOST',
defines=['BOOST_TEST_MODULE=%s' % name]
)
bld.objects(target='other-tests-%s-main' % module,
source='../main.cpp',
use='BOOST',
defines=['BOOST_TEST_MODULE=%s' % name])
# module
bld.program(target='../../%s' % module,
features='cxx cxxprogram',
source=bld.path.ant_glob(['%s*.cpp' % module]),
use='daemon-objects unit-tests-base unit-tests-%s-main' % module,
includes='.',
install_path=None,
defines=['UNIT_TEST_CONFIG_PATH=\"%s/tmp-files/\"' % bld.bldnode]
)
bld.program(name=module,
target='../../%s' % module,
source=bld.path.ant_glob('%s*.cpp' % module),
use='daemon-objects unit-tests-base other-tests-%s-main' % module,
defines=['UNIT_TEST_CONFIG_PATH="%s"' % bld.bldnode.make_node('tmp-files')],
install_path=None)
# face-benchmark does not rely on Boost.Test
bld.program(target='../../face-benchmark',
features='cxx cxxprogram',
source=bld.path.ant_glob(['face-benchmark*.cpp']),
bld.program(name='face-benchmark',
target='../../face-benchmark',
source=bld.path.ant_glob('face-benchmark*.cpp'),
use='daemon-objects',
includes='.',
install_path=None
)
install_path=None)
+2 -1
View File
@@ -24,9 +24,10 @@
*/
#include "rib/rib-manager.hpp"
#include "manager-common-fixture.hpp"
#include "core/fib-max-depth.hpp"
#include "tests/manager-common-fixture.hpp"
#include <ndn-cxx/lp/tags.hpp>
#include <ndn-cxx/mgmt/nfd/face-event-notification.hpp>
#include <ndn-cxx/mgmt/nfd/face-status.hpp>
+35 -42
View File
@@ -1,7 +1,6 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
"""
Copyright (c) 2014-2016, Regents of the University of California,
Copyright (c) 2014-2018, Regents of the University of California,
Arizona Board of Regents,
Colorado State University,
University Pierre & Marie Curie, Sorbonne University,
@@ -28,55 +27,49 @@ top = '..'
def build(bld):
# Unit tests
if bld.env['WITH_TESTS']:
if bld.env.WITH_TESTS:
config_path = 'UNIT_TEST_CONFIG_PATH="%s"' % bld.bldnode.make_node('tmp-files')
# common test modules
unit_test_base = bld(
# common test objects
bld.objects(
target='unit-tests-base',
name='unit-tests-base',
features='cxx pch',
source=bld.path.ant_glob(['*.cpp'], excl='main.cpp'),
features='pch',
source=bld.path.ant_glob('*.cpp', excl='main.cpp'),
use='core-objects',
headers='../core/common.hpp boost-test.hpp',
defines='UNIT_TEST_CONFIG_PATH=\"%s/tmp-files/\"' % bld.bldnode,
)
defines=[config_path])
for module, name in {"core": "Core Tests",
"daemon": "Daemon Tests",
"rib": "RIB Tests",
"tools": "Tools Tests"}.items():
# main()
bld(target='unit-tests-%s-main' % module,
name='unit-tests-%s-main' % module,
features='cxx',
use='BOOST',
source='main.cpp',
defines=['BOOST_TEST_MODULE=%s' % name]
)
# main() for the module
bld.objects(target='unit-tests-%s-main' % module,
source='main.cpp',
use='BOOST',
defines=['BOOST_TEST_MODULE=%s' % name])
node = bld.path.find_dir(module)
src = node.ant_glob('**/*.cpp', excl=['face/*ethernet*.cpp',
'face/pcap*.cpp',
'face/unix*.cpp',
'face/websocket*.cpp'])
if bld.env.HAVE_LIBPCAP:
src += node.ant_glob('face/*ethernet*.cpp')
src += node.ant_glob('face/pcap*.cpp')
if bld.env.HAVE_UNIX_SOCKETS:
src += node.ant_glob('face/unix*.cpp')
if bld.env.HAVE_WEBSOCKET:
src += node.ant_glob('face/websocket*.cpp')
# unit-tests-%module
unit_tests = bld.program(
target='../unit-tests-%s' % module,
features='cxx cxxprogram',
source=bld.path.ant_glob(['%s/**/*.cpp' % module],
excl=['%s/**/ethernet*.cpp' % module,
'%s/**/unix*.cpp' % module,
'%s/**/websocket*.cpp' % module]),
use='%s-objects unit-tests-base unit-tests-%s-main' % (module, module),
includes='.',
install_path=None,
defines='UNIT_TEST_CONFIG_PATH=\"%s/tmp-files/\"' % bld.bldnode,
)
bld.program(name='unit-tests-%s' % module,
target='../unit-tests-%s' % module,
source=src,
use='%s-objects unit-tests-base unit-tests-%s-main' % (module, module),
defines=[config_path],
install_path=None)
if bld.env['HAVE_LIBPCAP']:
unit_tests.source += bld.path.ant_glob('%s/**/ethernet*.cpp' % module)
if bld.env['HAVE_UNIX_SOCKETS']:
unit_tests.source += bld.path.ant_glob('%s/**/unix*.cpp' % module)
if bld.env['HAVE_WEBSOCKET']:
unit_tests.source += bld.path.ant_glob('%s/**/websocket*.cpp' % module)
# Other tests (e.g., stress tests that can be enabled even if unit tests are disabled)
if bld.env['WITH_TESTS'] or bld.env['WITH_OTHER_TESTS']:
bld.recurse("other")
# Other tests (e.g., stress tests and benchmarks that can be enabled even if unit tests are disabled)
if bld.env.WITH_TESTS or bld.env.WITH_OTHER_TESTS:
bld.recurse('other')
+57 -28
View File
@@ -1,59 +1,88 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
"""
Copyright (c) 2014-2018, Regents of the University of California,
Arizona Board of Regents,
Colorado State University,
University Pierre & Marie Curie, Sorbonne University,
Washington University in St. Louis,
Beijing Institute of Technology,
The University of Memphis.
from waflib import Utils, Context
This file is part of NFD (Named Data Networking Forwarding Daemon).
See AUTHORS.md for complete list of NFD authors and contributors.
NFD is free software: you can redistribute it and/or modify it under the terms
of the GNU General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.
NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
"""
top = '..'
from waflib import Context, Utils
def build(bld):
TOOLS_DEPENDENCY = 'core-objects NDN_CXX BOOST LIBRESOLV'
commonDeps = 'core-objects NDN_CXX BOOST LIBRESOLV'
# Single object tools:
# tools/example-tool.cpp is a self-contained tool with a main() function
# and is built as build/bin/example-tool.
# These tools cannot be unit-tested.
for i in bld.path.ant_glob(['*.cpp']):
name = str(i)[:-len('.cpp')]
bld.program(target='../bin/%s' % name,
source=[i],
use=TOOLS_DEPENDENCY)
for tool in bld.path.ant_glob('*.cpp'):
name = tool.change_ext('').path_from(bld.path.get_bld())
bld.program(name=name,
target='../bin/%s' % name,
source=[tool],
use=commonDeps)
# Sub-directory tools:
# tools/example-tool/**/*.cpp is compiled and linked into build/bin/example-tool.
# tools/example-tool/main.cpp must exist and must contain the main() function.
# All other objects are collected into 'tools-objects' and can be unit-tested.
testableObjects = []
for name in bld.path.ant_glob(['*'], dir=True, src=False):
mainFile = bld.path.find_node(['%s/main.cpp' % name])
for subdir in bld.path.ant_glob('*', dir=True, src=False):
mainFile = subdir.find_node('main.cpp')
if mainFile is None:
continue # not a C++ tool
srcFiles = bld.path.ant_glob(['%s/**/*.cpp' % name], excl=['%s/main.cpp' % name])
name = subdir.path_from(bld.path)
srcFiles = subdir.ant_glob('**/*.cpp', excl=['main.cpp'])
srcObjects = ''
if srcFiles:
srcObjects = 'tools-%s-objects' % name
bld.objects(target=srcObjects,
source=srcFiles,
use=TOOLS_DEPENDENCY,
includes='%s' % name)
use=commonDeps,
includes=name)
testableObjects.append(srcObjects)
else:
srcObjects = ''
bld.program(target='../bin/%s' % name,
bld.program(name=name,
target='../bin/%s' % name,
source=[mainFile],
use=TOOLS_DEPENDENCY + ' ' + srcObjects,
includes='%s' % name)
use=commonDeps + ' ' + srcObjects,
includes=name)
bld(target='tools-objects',
export_includes='.',
use=testableObjects)
bld.objects(target='tools-objects',
source=[],
export_includes='.',
use=testableObjects)
scripts = bld.path.ant_glob(['*.sh', '*.py'])
bld(features='subst',
name='scripts',
target=['../bin/%s' % node.change_ext('') for node in scripts],
source=scripts,
install_path='${BINDIR}',
chmod=Utils.O755,
VERSION=Context.g_module.VERSION)
# Scripts
for script in bld.path.ant_glob(['*.sh', '*.py']):
name = script.change_ext('').path_from(bld.path.get_bld())
bld(features='subst',
name=name,
target='../bin/%s' % name,
source=[script],
install_path='${BINDIR}',
chmod=Utils.O755,
VERSION=Context.g_module.VERSION)
bld.install_files('${DATAROOTDIR}/ndn',
bld.path.ant_glob('nfd-status-http-server-files/*'))
Vendored
+11 -10
View File
File diff suppressed because one or more lines are too long
+146 -157
View File
@@ -1,7 +1,6 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
"""
Copyright (c) 2014-2017, Regents of the University of California,
Copyright (c) 2014-2018, Regents of the University of California,
Arizona Board of Regents,
Colorado State University,
University Pierre & Marie Curie, Sorbonne University,
@@ -24,14 +23,14 @@ You should have received a copy of the GNU General Public License along with
NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
"""
VERSION = "0.6.1"
APPNAME = "nfd"
BUGREPORT = "https://redmine.named-data.net/projects/nfd"
URL = "https://named-data.net/doc/NFD/"
GIT_TAG_PREFIX = "NFD-"
from waflib import Context, Logs, Utils
import os, subprocess
from waflib import Logs, Utils, Context
import os
VERSION = '0.6.1'
APPNAME = 'nfd'
BUGREPORT = 'https://redmine.named-data.net/projects/nfd'
URL = 'https://named-data.net/doc/NFD/'
GIT_TAG_PREFIX = 'NFD-'
def options(opt):
opt.load(['compiler_cxx', 'gnu_dirs'])
@@ -47,21 +46,44 @@ def options(opt):
opt.addDependencyOptions(nfdopt, 'libpcap')
nfdopt.add_option('--without-libpcap', action='store_true', default=False,
dest='without_libpcap',
help='''Disable libpcap (Ethernet face support will be disabled)''')
help='Disable libpcap (Ethernet face support will be disabled)')
opt.addDependencyOptions(nfdopt, 'librt', '(optional)')
opt.addDependencyOptions(nfdopt, 'libresolv', '(optional)')
opt.addDependencyOptions(nfdopt, 'librt')
opt.addDependencyOptions(nfdopt, 'libresolv')
nfdopt.add_option('--with-tests', action='store_true', default=False,
dest='with_tests', help='''Build unit tests''')
help='Build unit tests')
nfdopt.add_option('--with-other-tests', action='store_true', default=False,
dest='with_other_tests', help='''Build other tests''')
help='Build other tests')
nfdopt.add_option('--with-custom-logger', type='string', default=None,
dest='with_custom_logger',
help='''Path to custom-logger.hpp and custom-logger-factory.hpp '''
'''implementing Logger and LoggerFactory interfaces''')
nfdopt.add_option('--with-custom-logger', metavar='PATH',
help='Path to custom-logger.hpp and custom-logger-factory.hpp '
'implementing Logger and LoggerFactory interfaces')
PRIVILEGE_CHECK_CODE = '''
#include <unistd.h>
#include <grp.h>
#include <pwd.h>
int main()
{
sysconf(_SC_GETGR_R_SIZE_MAX);
char buffer[100];
group grp;
group* grpRes;
getgrnam_r("nogroup", &grp, buffer, 100, &grpRes);
passwd pwd;
passwd* pwdRes;
getpwnam_r("nobody", &pwd, buffer, 100, &pwdRes);
int ret = setegid(grp.gr_gid);
ret = seteuid(pwd.pw_uid);
(void)(ret);
getegid();
geteuid();
}
'''
def configure(conf):
conf.load(['compiler_cxx', 'gnu_dirs',
@@ -80,41 +102,17 @@ def configure(conf):
conf.checkDependency(name='libresolv', lib='resolv', mandatory=False)
if not conf.check_cxx(msg='Checking if privilege drop/elevation is supported', mandatory=False,
define_name='HAVE_PRIVILEGE_DROP_AND_ELEVATE', fragment='''
#include <unistd.h>
#include <pwd.h>
#include <grp.h>
int
main(int, char**)
{
char buffer[100];
::sysconf(_SC_GETGR_R_SIZE_MAX);
group grp;
group* grpRes;
getgrnam_r("nogroup", &grp, buffer, 100, &grpRes);
passwd pwd;
passwd* pwdRes;
getpwnam_r("nobody", &pwd, buffer, 100, &pwdRes);
int ret = setegid(grp.gr_gid);
ret = seteuid(pwd.pw_uid);
(void)(ret);
getegid();
geteuid();
return 0;
}
'''):
define_name='HAVE_PRIVILEGE_DROP_AND_ELEVATE', fragment=PRIVILEGE_CHECK_CODE):
Logs.warn('Dropping privileges is not supported on this platform')
conf.check_cxx(header_name='valgrind/valgrind.h', define_name='HAVE_VALGRIND', mandatory=False)
if conf.options.with_tests:
conf.env['WITH_TESTS'] = 1
conf.env.WITH_TESTS = True
conf.define('WITH_TESTS', 1)
if conf.options.with_other_tests:
conf.env['WITH_OTHER_TESTS'] = 1
conf.env.WITH_OTHER_TESTS = True
conf.define('WITH_OTHER_TESTS', 1)
boost_libs = 'system chrono program_options thread log log_setup'
@@ -123,12 +121,11 @@ main(int, char**)
conf.check_boost(lib=boost_libs, mt=True)
if conf.env.BOOST_VERSION_NUMBER < 105400:
Logs.error("Minimum required boost version is 1.54.0")
Logs.error("Please upgrade your distribution or install custom boost libraries" +
" (https://redmine.named-data.net/projects/nfd/wiki/Boost_FAQ)")
return
conf.fatal('Minimum required Boost version is 1.54.0\n'
'Please upgrade your distribution or manually install a newer version of Boost'
' (https://redmine.named-data.net/projects/nfd/wiki/Boost_FAQ)')
if conf.env['CXX_NAME'] == 'clang' and conf.env.BOOST_VERSION_NUMBER < 105800:
if conf.env.CXX_NAME == 'clang' and conf.env.BOOST_VERSION_NUMBER < 105800:
conf.define('BOOST_ASIO_HAS_STD_ARRAY', 1) # Workaround for https://redmine.named-data.net/issues/3360#note-14
conf.define('BOOST_ASIO_HAS_STD_CHRONO', 1) # Solution documented at https://redmine.named-data.net/issues/3588#note-10
@@ -137,41 +134,41 @@ main(int, char**)
if not conf.options.without_libpcap:
conf.check_asio_pcap_support()
if conf.env['HAVE_ASIO_PCAP_SUPPORT']:
if conf.env.HAVE_ASIO_PCAP_SUPPORT:
conf.checkDependency(name='libpcap', lib='pcap', mandatory=True,
errmsg='not found, but required for Ethernet face support. '
'Specify --without-libpcap to disable Ethernet face support.')
else:
Logs.warn('Warning: Ethernet face is not supported on this platform with Boost libraries version 1.56. '
'See https://redmine.named-data.net/issues/1877 for more details')
if conf.env['HAVE_LIBPCAP']:
conf.check_cxx(function_name='pcap_set_immediate_mode', header_name='pcap/pcap.h',
cxxflags='-Wno-error', use='LIBPCAP', mandatory=False)
if conf.env.HAVE_LIBPCAP:
conf.check_cxx(msg='Checking if libpcap supports pcap_set_immediate_mode', mandatory=False,
define_name='HAVE_PCAP_SET_IMMEDIATE_MODE', use='LIBPCAP',
fragment='''#include <pcap/pcap.h>
int main() { pcap_t* p; pcap_set_immediate_mode(p, 1); }''')
if conf.options.with_custom_logger:
conf.define('HAVE_CUSTOM_LOGGER', 1)
conf.env['INCLUDES_CUSTOM_LOGGER'] = [conf.options.with_custom_logger]
conf.env['HAVE_CUSTOM_LOGGER'] = 1
conf.env.HAVE_CUSTOM_LOGGER = True
conf.env.INCLUDES_CUSTOM_LOGGER = [conf.options.with_custom_logger]
conf.check_compiler_flags()
# Loading "late" to prevent tests from being compiled with profiling flags
conf.load('coverage')
conf.load('sanitizers')
conf.define('DEFAULT_CONFIG_FILE', '%s/ndn/nfd.conf' % conf.env['SYSCONFDIR'])
conf.define('DEFAULT_CONFIG_FILE', '%s/ndn/nfd.conf' % conf.env.SYSCONFDIR)
# disable assertions in release builds
if not conf.options.debug:
conf.define('NDEBUG', 1)
conf.write_config_header('core/config.hpp')
def build(bld):
version(bld)
bld(features="subst",
name='version',
bld(features='subst',
name='version.hpp',
source='core/version.hpp.in',
target='core/version.hpp',
install_path=None,
@@ -184,79 +181,74 @@ def build(bld):
VERSION_MINOR=VERSION_SPLIT[1],
VERSION_PATCH=VERSION_SPLIT[2])
core = bld(
core = bld.objects(
target='core-objects',
name='core-objects',
features='cxx pch',
source=bld.path.ant_glob(['core/**/*.cpp'],
excl=['core/logger*.cpp']),
use='version NDN_CXX BOOST LIBRT',
includes='. core',
features='pch',
source=bld.path.ant_glob('core/**/*.cpp', excl=['core/logger*.cpp']),
use='version.hpp NDN_CXX BOOST LIBRT',
includes='.',
export_includes='.',
headers='core/common.hpp')
if bld.env['HAVE_CUSTOM_LOGGER']:
core.use += " CUSTOM_LOGGER"
if bld.env.HAVE_CUSTOM_LOGGER:
core.use += ' CUSTOM_LOGGER'
else:
core.source += bld.path.ant_glob(['core/logger*.cpp'])
core.source += bld.path.ant_glob('core/logger*.cpp')
nfd_objects = bld(
nfd_objects = bld.objects(
target='daemon-objects',
name='daemon-objects',
features='cxx',
source=bld.path.ant_glob(['daemon/**/*.cpp'],
source=bld.path.ant_glob('daemon/**/*.cpp',
excl=['daemon/face/*ethernet*.cpp',
'daemon/face/*pcap*.cpp',
'daemon/face/unix-*.cpp',
'daemon/face/websocket-*.cpp',
'daemon/face/pcap*.cpp',
'daemon/face/unix*.cpp',
'daemon/face/websocket*.cpp',
'daemon/main.cpp']),
use='core-objects WEBSOCKET',
use='core-objects',
includes='daemon',
export_includes='daemon')
if bld.env['HAVE_LIBPCAP']:
if bld.env.HAVE_LIBPCAP:
nfd_objects.source += bld.path.ant_glob('daemon/face/*ethernet*.cpp')
nfd_objects.source += bld.path.ant_glob('daemon/face/*pcap*.cpp')
nfd_objects.source += bld.path.ant_glob('daemon/face/pcap*.cpp')
nfd_objects.use += ' LIBPCAP'
if bld.env['HAVE_UNIX_SOCKETS']:
nfd_objects.source += bld.path.ant_glob('daemon/face/unix-*.cpp')
if bld.env.HAVE_UNIX_SOCKETS:
nfd_objects.source += bld.path.ant_glob('daemon/face/unix*.cpp')
if bld.env['HAVE_WEBSOCKET']:
nfd_objects.source += bld.path.ant_glob('daemon/face/websocket-*.cpp')
if bld.env.HAVE_WEBSOCKET:
nfd_objects.source += bld.path.ant_glob('daemon/face/websocket*.cpp')
nfd_objects.use += ' WEBSOCKET'
if bld.env['WITH_OTHER_TESTS']:
if bld.env.WITH_OTHER_TESTS:
nfd_objects.source += bld.path.ant_glob('tests/other/fw/*.cpp')
rib_objects = bld(
target='rib-objects',
name='rib-objects',
features='cxx',
source=bld.path.ant_glob(['rib/**/*.cpp']),
use='core-objects')
bld.objects(target='rib-objects',
source=bld.path.ant_glob('rib/**/*.cpp'),
use='core-objects')
bld(target='bin/nfd',
features='cxx cxxprogram',
source='daemon/main.cpp',
use='daemon-objects rib-objects')
bld.program(name='nfd',
target='bin/nfd',
source='daemon/main.cpp',
use='daemon-objects rib-objects')
bld.recurse("tools")
bld.recurse("tests")
bld.recurse('tools')
bld.recurse('tests')
bld(features="subst",
bld(features='subst',
source='nfd.conf.sample.in',
target='nfd.conf.sample',
install_path="${SYSCONFDIR}/ndn",
IF_HAVE_LIBPCAP="" if bld.env['HAVE_LIBPCAP'] else "; ",
IF_HAVE_WEBSOCKET="" if bld.env['HAVE_WEBSOCKET'] else "; ")
install_path='${SYSCONFDIR}/ndn',
IF_HAVE_LIBPCAP='' if bld.env.HAVE_LIBPCAP else '; ',
IF_HAVE_WEBSOCKET='' if bld.env.HAVE_WEBSOCKET else '; ')
if bld.env['SPHINX_BUILD']:
bld(features="sphinx",
builder="man",
outdir="docs/manpages",
config="docs/conf.py",
if bld.env.SPHINX_BUILD:
bld(features='sphinx',
name='manpages',
builder='man',
config='docs/conf.py',
outdir='docs/manpages',
source=bld.path.ant_glob('docs/manpages/**/*.rst'),
install_path="${MANDIR}/",
install_path='${MANDIR}',
VERSION=VERSION)
bld.symlink_as('${MANDIR}/man1/nfdc-channel.1', 'nfdc-face.1')
bld.symlink_as('${MANDIR}/man1/nfdc-fib.1', 'nfdc-route.1')
@@ -265,7 +257,7 @@ def build(bld):
bld.symlink_as('${MANDIR}/man1/nfdc-set-strategy.1', 'nfdc-strategy.1')
bld.symlink_as('${MANDIR}/man1/nfdc-unset-strategy.1', 'nfdc-strategy.1')
bld.install_files("${SYSCONFDIR}/ndn", "autoconfig.conf.sample")
bld.install_files('${SYSCONFDIR}/ndn', 'autoconfig.conf.sample')
def docs(bld):
from waflib import Options
@@ -275,85 +267,82 @@ def doxygen(bld):
version(bld)
if not bld.env.DOXYGEN:
Logs.error("ERROR: cannot build documentation (`doxygen' is not found in $PATH)")
else:
bld(features="subst",
name="doxygen-conf",
source=["docs/doxygen.conf.in",
"docs/named_data_theme/named_data_footer-with-analytics.html.in"],
target=["docs/doxygen.conf",
"docs/named_data_theme/named_data_footer-with-analytics.html"],
VERSION=VERSION,
HTML_FOOTER="../build/docs/named_data_theme/named_data_footer-with-analytics.html" \
if os.getenv('GOOGLE_ANALYTICS', None) \
else "../docs/named_data_theme/named_data_footer.html",
GOOGLE_ANALYTICS=os.getenv('GOOGLE_ANALYTICS', ""))
bld.fatal('Cannot build documentation ("doxygen" not found in PATH)')
bld(features="doxygen",
doxyfile='docs/doxygen.conf',
use="doxygen-conf")
bld(features='subst',
name='doxygen.conf',
source=['docs/doxygen.conf.in',
'docs/named_data_theme/named_data_footer-with-analytics.html.in'],
target=['docs/doxygen.conf',
'docs/named_data_theme/named_data_footer-with-analytics.html'],
VERSION=VERSION,
HTML_FOOTER='../build/docs/named_data_theme/named_data_footer-with-analytics.html' \
if os.getenv('GOOGLE_ANALYTICS', None) \
else '../docs/named_data_theme/named_data_footer.html',
GOOGLE_ANALYTICS=os.getenv('GOOGLE_ANALYTICS', ''))
bld(features='doxygen',
doxyfile='docs/doxygen.conf',
use='doxygen.conf')
def sphinx(bld):
version(bld)
if not bld.env.SPHINX_BUILD:
bld.fatal("ERROR: cannot build documentation (`sphinx-build' is not found in $PATH)")
else:
bld(features="sphinx",
outdir="docs",
source=bld.path.ant_glob('docs/**/*.rst'),
config="docs/conf.py",
VERSION=VERSION)
bld.fatal('Cannot build documentation ("sphinx-build" not found in PATH)')
bld(features='sphinx',
config='docs/conf.py',
outdir='docs',
source=bld.path.ant_glob('docs/**/*.rst'),
VERSION=VERSION)
def version(ctx):
# don't execute more than once
if getattr(Context.g_module, 'VERSION_BASE', None):
return
Context.g_module.VERSION_BASE = Context.g_module.VERSION
Context.g_module.VERSION_SPLIT = [v for v in VERSION_BASE.split('.')]
Context.g_module.VERSION_SPLIT = VERSION_BASE.split('.')
didGetVersion = False
# first, try to get a version string from git
gotVersionFromGit = False
try:
cmd = ['git', 'describe', '--always', '--match', '%s*' % GIT_TAG_PREFIX]
p = Utils.subprocess.Popen(cmd, stdout=Utils.subprocess.PIPE,
stderr=None, stdin=None)
out = str(p.communicate()[0].strip())
didGetVersion = (p.returncode == 0 and out != "")
if didGetVersion:
out = subprocess.check_output(cmd, universal_newlines=True).strip()
if out:
gotVersionFromGit = True
if out.startswith(GIT_TAG_PREFIX):
Context.g_module.VERSION = out[len(GIT_TAG_PREFIX):]
Context.g_module.VERSION = out.lstrip(GIT_TAG_PREFIX)
else:
Context.g_module.VERSION = "%s-commit-%s" % (Context.g_module.VERSION_BASE, out)
except OSError:
# no tags matched
Context.g_module.VERSION = '%s-commit-%s' % (VERSION_BASE, out)
except subprocess.CalledProcessError:
pass
versionFile = ctx.path.find_node('VERSION')
if not didGetVersion and versionFile is not None:
if not gotVersionFromGit and versionFile is not None:
try:
Context.g_module.VERSION = versionFile.read()
return
except (OSError, IOError):
except EnvironmentError:
pass
# version was obtained from git, update VERSION file if necessary
if versionFile is not None:
try:
version = versionFile.read()
if version == Context.g_module.VERSION:
return # no need to update
except (OSError, IOError):
Logs.warn("VERSION file exists, but not readable")
if versionFile.read() == Context.g_module.VERSION:
# already up-to-date
return
except EnvironmentError as e:
Logs.warn('%s exists but is not readable (%s)' % (versionFile, e.strerror))
else:
versionFile = ctx.path.make_node('VERSION')
if versionFile is None:
return
try:
versionFile.write(Context.g_module.VERSION)
except (OSError, IOError):
Logs.warn("VERSION file is not writeable")
except EnvironmentError as e:
Logs.warn('%s is not writable (%s)' % (versionFile, e.strerror))
def dist(ctx):
version(ctx)