build: (fixes #2459) Add ./waf --check-config option to reprint the summary
Add ./waf --check-config option to reprint the summary of optional features from the configuration
This commit is contained in:
@@ -136,6 +136,8 @@ us a note on ns-developers mailing list.</p>
|
||||
</ul>
|
||||
<h2>Changes to build system:</h2>
|
||||
<ul>
|
||||
<li> A new waf build option, --check-config, was added to allow users to print the current configuration summary, as appears at the end of ./waf configure. See bug 2459 for discussion.</li>
|
||||
<li> The configure summary is now sorted, to make it easier to check the status of optional features.</li>
|
||||
</ul>
|
||||
<h2>Changed behavior:</h2>
|
||||
This section is for behavioral changes to the models that were not due to a bug fix.
|
||||
|
||||
@@ -44,6 +44,7 @@ New user-visible features
|
||||
models.
|
||||
- (core) DES Metrics support, see the API docs for class DesMetrics.
|
||||
- (aodv) The node search radius is increased progressively (as per standard).
|
||||
+- (build system) New --check-config option to waf to reprint the summary of optional features which are configured.
|
||||
|
||||
Bugs fixed
|
||||
----------
|
||||
|
||||
@@ -392,7 +392,7 @@ builds that include the examples and tests, you will need to execute the
|
||||
following commands::
|
||||
|
||||
$ ./waf clean
|
||||
$ ./waf --build-profile=optimized --enable-examples --enable-tests configure
|
||||
$ ./waf configure --build-profile=optimized --enable-examples --enable-tests
|
||||
|
||||
This runs Waf out of the local directory (which is provided as a convenience
|
||||
for you). The first command to clean out the previous build is not
|
||||
@@ -453,29 +453,29 @@ output that looks similar to the following::
|
||||
Checking for program doxygen : /usr/local/bin/doxygen
|
||||
---- Summary of optional NS-3 features:
|
||||
Build profile : debug
|
||||
Build directory : build
|
||||
Python Bindings : enabled
|
||||
BRITE Integration : not enabled (BRITE not enabled (see option --with-brite))
|
||||
NS-3 Click Integration : not enabled (nsclick not enabled (see option --with-nsclick))
|
||||
GtkConfigStore : enabled
|
||||
XmlIo : enabled
|
||||
Threading Primitives : enabled
|
||||
Real Time Simulator : enabled (librt is not available)
|
||||
Build directory : build
|
||||
Build examples : enabled
|
||||
Build tests : enabled
|
||||
Emulated Net Device : enabled (<netpacket/packet.h> include not detected)
|
||||
File descriptor NetDevice : enabled
|
||||
Tap FdNetDevice : not enabled (needs linux/if_tun.h)
|
||||
Emulation FdNetDevice : not enabled (needs netpacket/packet.h)
|
||||
PlanetLab FdNetDevice : not enabled (PlanetLab operating system not detected (see option --force-planetlab))
|
||||
Network Simulation Cradle : not enabled (NSC not found (see option --with-nsc))
|
||||
File descriptor NetDevice : enabled
|
||||
GNU Scientific Library (GSL) : enabled
|
||||
GtkConfigStore : enabled
|
||||
MPI Support : enabled
|
||||
NS-3 Click Integration : not enabled (nsclick not enabled (see option --with-nsclick))
|
||||
NS-3 OpenFlow Integration : not enabled (Required boost libraries not found, missing: system, signals, filesystem)
|
||||
Network Simulation Cradle : not enabled (NSC not found (see option --with-nsc))
|
||||
PlanetLab FdNetDevice : not enabled (PlanetLab operating system not detected (see option --force-planetlab))
|
||||
PyViz visualizer : enabled
|
||||
Python Bindings : enabled
|
||||
Real Time Simulator : enabled (librt is not available)
|
||||
SQlite stats data output : enabled
|
||||
Tap Bridge : not enabled (<linux/if_tun.h> include not detected)
|
||||
PyViz visualizer : enabled
|
||||
Tap FdNetDevice : not enabled (needs linux/if_tun.h)
|
||||
Threading Primitives : enabled
|
||||
Use sudo to set suid bit : not enabled (option --enable-sudo not selected)
|
||||
Build tests : enabled
|
||||
Build examples : enabled
|
||||
GNU Scientific Library (GSL) : enabled
|
||||
XmlIo : enabled
|
||||
'configure' finished successfully (1.944s)
|
||||
|
||||
Note the last part of the above output. Some |ns3| options are not enabled by
|
||||
@@ -485,13 +485,15 @@ system. If this library were not found, the corresponding |ns3| feature
|
||||
would not be enabled and a message would be displayed. Note further that there is
|
||||
a feature to use the program ``sudo`` to set the suid bit of certain programs.
|
||||
This is not enabled by default and so this feature is reported as "not enabled."
|
||||
Finally, to reprint this summary of which optional features are enabled, use
|
||||
the ``--check-config`` option to waf.
|
||||
|
||||
Now go ahead and switch back to the debug build that includes the examples and tests.
|
||||
|
||||
::
|
||||
|
||||
$ ./waf clean
|
||||
$ ./waf --build-profile=debug --enable-examples --enable-tests configure
|
||||
$ ./waf configure --build-profile=debug --enable-examples --enable-tests
|
||||
|
||||
The build system is now configured and you can build the debug versions of
|
||||
the |ns3| programs by simply typing
|
||||
|
||||
71
wscript
71
wscript
@@ -146,6 +146,11 @@ def options(opt):
|
||||
opt.load('cflags')
|
||||
opt.load('gnu_dirs')
|
||||
|
||||
opt.add_option('--check-config',
|
||||
help=('Print the current configuration.'),
|
||||
action="store_true", default=False,
|
||||
dest="check_config")
|
||||
|
||||
opt.add_option('--cwd',
|
||||
help=('Set the working directory for a program.'),
|
||||
action="store", type="string", default=None,
|
||||
@@ -308,6 +313,29 @@ def _check_nonfatal(conf, *args, **kwargs):
|
||||
except conf.errors.ConfigurationError:
|
||||
return None
|
||||
|
||||
# Write a summary of optional features status
|
||||
def print_config(env, phase='configure'):
|
||||
if phase == 'configure':
|
||||
profile = get_build_profile(env)
|
||||
else:
|
||||
profile = get_build_profile()
|
||||
|
||||
print("---- Summary of optional NS-3 features:")
|
||||
print("%-30s: %s%s%s" % ("Build profile", Logs.colors('GREEN'),
|
||||
profile, Logs.colors('NORMAL')))
|
||||
bld = wutils.bld
|
||||
print("%-30s: %s%s%s" % ("Build directory", Logs.colors('GREEN'),
|
||||
Options.options.out, Logs.colors('NORMAL')))
|
||||
|
||||
|
||||
for (name, caption, was_enabled, reason_not_enabled) in sorted(env['NS3_OPTIONAL_FEATURES'], key=lambda s : s[1]):
|
||||
if was_enabled:
|
||||
status = 'enabled'
|
||||
color = 'GREEN'
|
||||
else:
|
||||
status = 'not enabled (%s)' % reason_not_enabled
|
||||
color = 'RED'
|
||||
print("%-30s: %s%s%s" % (caption, Logs.colors(color), status, Logs.colors('NORMAL')))
|
||||
|
||||
def configure(conf):
|
||||
conf.load('relocation', tooldir=['waf-tools'])
|
||||
@@ -597,24 +625,8 @@ def configure(conf):
|
||||
value = shlex.split(os.environ[envvar])
|
||||
conf.env.append_value(confvar, value)
|
||||
|
||||
# Write a summary of optional features status
|
||||
print("---- Summary of optional NS-3 features:")
|
||||
print("%-30s: %s%s%s" % ("Build profile", Logs.colors('GREEN'),
|
||||
Options.options.build_profile, Logs.colors('NORMAL')))
|
||||
bld = wutils.bld
|
||||
print("%-30s: %s%s%s" % ("Build directory", Logs.colors('GREEN'),
|
||||
Options.options.out, Logs.colors('NORMAL')))
|
||||
print_config(env)
|
||||
|
||||
|
||||
for (name, caption, was_enabled, reason_not_enabled) in sorted(conf.env['NS3_OPTIONAL_FEATURES'], key=lambda s : s[1]):
|
||||
if was_enabled:
|
||||
status = 'enabled'
|
||||
color = 'GREEN'
|
||||
else:
|
||||
status = 'not enabled (%s)' % reason_not_enabled
|
||||
color = 'RED'
|
||||
print("%-30s: %s%s%s" % (caption, Logs.colors(color), status, Logs.colors('NORMAL')))
|
||||
|
||||
|
||||
class SuidBuild_task(Task.Task):
|
||||
"""task that makes a binary Suid
|
||||
@@ -758,12 +770,9 @@ def _find_ns3_module(self, name):
|
||||
return obj
|
||||
raise KeyError(name)
|
||||
|
||||
|
||||
def build(bld):
|
||||
env = bld.env
|
||||
|
||||
if Options.options.check_profile:
|
||||
# Parse the waf lockfile generated by latest 'configure' operation
|
||||
# Parse the waf lockfile generated by latest 'configure' operation
|
||||
def get_build_profile(env=None):
|
||||
if env == None:
|
||||
lockfile = os.environ.get('WAFLOCK', '.lock-waf_%s_build' % sys.platform)
|
||||
profile = "not found"
|
||||
with open(lockfile, "r") as f:
|
||||
@@ -775,7 +784,21 @@ def build(bld):
|
||||
optkey,optval = x.split(':')
|
||||
if (optkey.lstrip() == '\'build_profile\''):
|
||||
profile = str(optval.lstrip()).replace("'","")
|
||||
print("Build profile: %s" % profile)
|
||||
else:
|
||||
profile = Options.options.build_profile
|
||||
return profile
|
||||
|
||||
def build(bld):
|
||||
env = bld.env
|
||||
|
||||
if Options.options.check_config:
|
||||
print_config(env, 'build')
|
||||
else:
|
||||
if Options.options.check_profile:
|
||||
profile = get_build_profile()
|
||||
print("Build profile: %s" % profile)
|
||||
|
||||
if Options.options.check_profile or Options.options.check_config:
|
||||
raise SystemExit(0)
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user