diff --git a/src/antenna/wscript b/src/antenna/wscript index 9128b416a..3f76ce862 100644 --- a/src/antenna/wscript +++ b/src/antenna/wscript @@ -21,7 +21,7 @@ def build(bld): 'test/test-parabolic-antenna.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'antenna' headers.source = [ 'model/angles.h', diff --git a/src/aodv/wscript b/src/aodv/wscript index 6209a5b26..f396298da 100644 --- a/src/aodv/wscript +++ b/src/aodv/wscript @@ -23,7 +23,7 @@ def build(bld): 'test/loopback.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'aodv' headers.source = [ 'model/aodv-id-cache.h', @@ -37,6 +37,6 @@ def build(bld): ] if bld.env['ENABLE_EXAMPLES']: - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/applications/wscript b/src/applications/wscript index 684d1ce90..c07a5b0b2 100644 --- a/src/applications/wscript +++ b/src/applications/wscript @@ -32,7 +32,7 @@ def build(bld): 'test/udp-client-server-test.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'applications' headers.source = [ 'model/bulk-send-application.h', diff --git a/src/bridge/wscript b/src/bridge/wscript index 8ff5e22af..d02ac7476 100644 --- a/src/bridge/wscript +++ b/src/bridge/wscript @@ -7,7 +7,7 @@ def build(bld): 'model/bridge-channel.cc', 'helper/bridge-helper.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'bridge' headers.source = [ 'model/bridge-net-device.h', @@ -16,6 +16,6 @@ def build(bld): ] if bld.env['ENABLE_EXAMPLES']: - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/brite/wscript b/src/brite/wscript index 7ecd31da7..b44cbc53b 100644 --- a/src/brite/wscript +++ b/src/brite/wscript @@ -1,6 +1,8 @@ ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- + import os -import Options + +from waflib import Options def options(opt): @@ -89,7 +91,7 @@ def build(bld): if bld.env['BRITE'] and bld.env['DL']: module.uselib = 'BRITE DL' - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'brite' headers.source = [ ] @@ -100,4 +102,4 @@ def build(bld): module_test.source.append('test/brite-test-topology.cc') if bld.env['ENABLE_EXAMPLES'] and bld.env['ENABLE_BRITE']: - bld.add_subdirs('examples') + bld.recurse('examples') diff --git a/src/buildings/wscript b/src/buildings/wscript index e6d512deb..e92077028 100644 --- a/src/buildings/wscript +++ b/src/buildings/wscript @@ -25,7 +25,7 @@ def build(bld): 'test/buildings-shadowing-test.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'buildings' headers.source = [ 'model/building.h', @@ -42,7 +42,7 @@ def build(bld): ] if (bld.env['ENABLE_EXAMPLES']): - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/click/wscript b/src/click/wscript index ee95b0718..4a51d7c6a 100644 --- a/src/click/wscript +++ b/src/click/wscript @@ -1,7 +1,8 @@ ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- import os -import Options + +from waflib import Options def options(opt): @@ -107,7 +108,7 @@ def build(bld): module.use.extend(['NSCLICK', 'DL']) module_test.use.extend(['NSCLICK', 'DL']) - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'click' headers.source = [ 'model/ipv4-click-routing.h', @@ -116,6 +117,6 @@ def build(bld): ] if bld.env['ENABLE_EXAMPLES']: - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/config-store/wscript b/src/config-store/wscript index 7e614c2cb..8e167c7ee 100644 --- a/src/config-store/wscript +++ b/src/config-store/wscript @@ -11,25 +11,29 @@ def options(opt): def configure(conf): if Options.options.disable_gtk: - conf.env['ENABLE_GTK_CONFIG_STORE'] = False + conf.env['ENABLE_GTK2'] = False conf.report_optional_feature("GtkConfigStore", "GtkConfigStore", - conf.env['ENABLE_GTK_CONFIG_STORE'], + conf.env['ENABLE_GTK2'], "--disable-gtk option given") else: - have_gtk = conf.pkg_check_modules('GTK_CONFIG_STORE', 'gtk+-2.0 >= 2.12', mandatory=False) - conf.env['ENABLE_GTK_CONFIG_STORE'] = have_gtk + have_gtk2 = conf.check_cfg(package='gtk+-2.0', atleast_version='2.12', + args=['--cflags', '--libs'], uselib_store='GTK2', + mandatory=False) + + conf.env['ENABLE_GTK2'] = have_gtk2 conf.report_optional_feature("GtkConfigStore", "GtkConfigStore", - conf.env['ENABLE_GTK_CONFIG_STORE'], + conf.env['ENABLE_GTK2'], "library 'gtk+-2.0 >= 2.12' not found") - have_libxml2 = conf.pkg_check_modules('LIBXML2', 'libxml-2.0 >= 2.6', mandatory=False) - if have_libxml2: - conf.define('HAVE_LIBXML2', 1) + have_libxml2 = conf.check_cfg(package='libxml-2.0', atleast_version='2.7', + args=['--cflags', '--libs'], uselib_store='LIBXML2', + mandatory=False) conf.env['ENABLE_LIBXML2'] = have_libxml2 conf.report_optional_feature("XmlIo", "XmlIo", conf.env['ENABLE_LIBXML2'], "library 'libxml-2.0 >= 2.7' not found") + conf.write_config_header('ns3/config-store-config.h', top=True) @@ -45,27 +49,27 @@ def build(bld): 'model/raw-text-config.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'config-store' headers.source = [ 'model/file-config.h', 'model/config-store.h', ] - if bld.env['ENABLE_GTK_CONFIG_STORE']: + if bld.env['ENABLE_GTK2']: headers.source.append ('model/gtk-config-store.h') module.source.extend (['model/gtk-config-store.cc', 'model/model-node-creator.cc', 'model/model-typeid-creator.cc', 'model/display-functions.cc', ]) - module.use.append('GTK_CONFIG_STORE') + module.use.append('GTK2') if bld.env['ENABLE_LIBXML2']: module.source.append ('model/xml-config.cc') module.use.append('LIBXML2') if bld.env['ENABLE_EXAMPLES']: - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/core/wscript b/src/core/wscript index 07874e51a..d7f00e39e 100644 --- a/src/core/wscript +++ b/src/core/wscript @@ -1,8 +1,7 @@ ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- import sys -import Options - +from waflib import Options import wutils def options(opt): @@ -49,7 +48,7 @@ def configure(conf): conf.check_nonfatal(header_name='signal.h', define_name='HAVE_SIGNAL_H') # Check for POSIX threads - test_env = conf.env.copy() + test_env = conf.env.derive() if Options.platform != 'darwin' and Options.platform != 'cygwin': test_env.append_value('LINKFLAGS', '-pthread') test_env.append_value('CXXFLAGS', '-pthread') @@ -173,7 +172,7 @@ def build(bld): 'test/watchdog-test-suite.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'core' headers.source = [ 'model/nstime.h', @@ -309,7 +308,7 @@ def build(bld): core_test.source.extend(['test/rng-test-suite.cc']) if (bld.env['ENABLE_EXAMPLES']): - bld.add_subdirs('examples') + bld.recurse('examples') pymod = bld.ns3_python_bindings() if pymod is not None: diff --git a/src/create-module.py b/src/create-module.py index 9ba53f981..120aa8089 100755 --- a/src/create-module.py +++ b/src/create-module.py @@ -24,7 +24,7 @@ def build(bld): 'test/%(MODULE)s-test-suite.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = %(MODULE)r headers.source = [ 'model/%(MODULE)s.h', @@ -32,7 +32,7 @@ def build(bld): ] if bld.env.ENABLE_EXAMPLES: - bld.add_subdirs('examples') + bld.recurse('examples') # bld.ns3_python_bindings() diff --git a/src/csma-layout/wscript b/src/csma-layout/wscript index a7c7a5c6d..8a7f4d89e 100644 --- a/src/csma-layout/wscript +++ b/src/csma-layout/wscript @@ -5,14 +5,14 @@ def build(bld): obj.source = [ 'model/csma-star-helper.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'csma-layout' headers.source = [ 'model/csma-star-helper.h', ] if bld.env['ENABLE_EXAMPLES']: - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/csma/wscript b/src/csma/wscript index 3b6294c21..b365af31e 100644 --- a/src/csma/wscript +++ b/src/csma/wscript @@ -8,7 +8,7 @@ def build(bld): 'model/csma-channel.cc', 'helper/csma-helper.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'csma' headers.source = [ 'model/backoff.h', @@ -18,6 +18,6 @@ def build(bld): ] if bld.env['ENABLE_EXAMPLES']: - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/dsdv/wscript b/src/dsdv/wscript index 9790a83cd..cd701d365 100644 --- a/src/dsdv/wscript +++ b/src/dsdv/wscript @@ -16,7 +16,7 @@ def build(bld): 'test/dsdv-testcase.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'dsdv' headers.source = [ 'model/dsdv-rtable.h', @@ -26,6 +26,6 @@ def build(bld): 'helper/dsdv-helper.h', ] if (bld.env['ENABLE_EXAMPLES']): - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/dsr/wscript b/src/dsr/wscript index 26e4f80be..e6b6433dc 100644 --- a/src/dsr/wscript +++ b/src/dsr/wscript @@ -24,7 +24,7 @@ def build(bld): 'test/dsr-test-suite.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'dsr' headers.source = [ 'model/dsr-routing.h', @@ -43,6 +43,6 @@ def build(bld): ] if (bld.env['ENABLE_EXAMPLES']): - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/emu/wscript b/src/emu/wscript index 02b77beec..33b015183 100644 --- a/src/emu/wscript +++ b/src/emu/wscript @@ -36,7 +36,7 @@ def build(bld): 'helper/emu-helper.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'emu' headers.source = [ 'model/emu-net-device.h', @@ -52,6 +52,6 @@ def build(bld): module.env.append_value("DEFINES", "EMU_SOCK_CREATOR=\"%s\"" % (creator.target,)) if bld.env['ENABLE_EXAMPLES']: - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/energy/wscript b/src/energy/wscript index db582dcc3..12ac28897 100644 --- a/src/energy/wscript +++ b/src/energy/wscript @@ -25,7 +25,7 @@ def build(bld): 'test/li-ion-energy-source-test.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'energy' headers.source = [ 'model/wifi-radio-energy-model.h', @@ -44,6 +44,6 @@ def build(bld): ] if (bld.env['ENABLE_EXAMPLES']): - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/fd-net-device/wscript b/src/fd-net-device/wscript index cedaea0ac..5c5ea64c9 100644 --- a/src/fd-net-device/wscript +++ b/src/fd-net-device/wscript @@ -99,7 +99,7 @@ def build(bld): 'helper/creator-utils.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'fd-net-device' headers.source = [ 'model/fd-net-device.h', @@ -165,7 +165,7 @@ def build(bld): "PLANETLAB_TAP_CREATOR=\"%s\"" % (creator.target,)) if bld.env['ENABLE_EXAMPLES']: - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/flow-monitor/wscript b/src/flow-monitor/wscript index 13fcabded..a8abfd77a 100644 --- a/src/flow-monitor/wscript +++ b/src/flow-monitor/wscript @@ -17,7 +17,7 @@ def build(bld): 'test/histogram-test-suite.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'flow-monitor' headers.source = ["model/%s" % s for s in [ 'flow-monitor.h', @@ -30,6 +30,6 @@ def build(bld): headers.source.append("helper/flow-monitor-helper.h") if bld.env['ENABLE_EXAMPLES']: - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/internet/wscript b/src/internet/wscript index ea90beeb5..efe9ad15b 100644 --- a/src/internet/wscript +++ b/src/internet/wscript @@ -2,10 +2,8 @@ import os import sys -import Options -import Logs -import Utils -import Task +from waflib import Options, Logs, Utils, Task + # Required NSC version NSC_RELEASE_NAME = "nsc-0.5.3" @@ -211,7 +209,7 @@ def build(bld): 'test/ipv6-address-helper-test-suite.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'internet' headers.source = [ 'model/udp-header.h', @@ -295,7 +293,7 @@ def build(bld): internet_test.use.append('DL') if (bld.env['ENABLE_EXAMPLES']): - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/lte/wscript b/src/lte/wscript index 7b6a46065..3ef116536 100644 --- a/src/lte/wscript +++ b/src/lte/wscript @@ -114,7 +114,7 @@ def build(bld): 'test/lte-test-mimo.cc' ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'lte' headers.source = [ 'model/lte-common.h', @@ -190,6 +190,6 @@ def build(bld): ] if (bld.env['ENABLE_EXAMPLES']): - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/mesh/wscript b/src/mesh/wscript index 79011c8e5..267a7f387 100644 --- a/src/mesh/wscript +++ b/src/mesh/wscript @@ -53,7 +53,7 @@ def build(bld): 'test/flame/regression.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'mesh' headers.source = [ 'model/mesh-information-element.h', @@ -90,6 +90,6 @@ def build(bld): ] if bld.env['ENABLE_EXAMPLES']: - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/mobility/wscript b/src/mobility/wscript index c90a81efc..1fd153173 100644 --- a/src/mobility/wscript +++ b/src/mobility/wscript @@ -31,7 +31,7 @@ def build(bld): 'test/waypoint-mobility-model-test.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'mobility' headers.source = [ 'model/box.h', @@ -55,6 +55,6 @@ def build(bld): ] if (bld.env['ENABLE_EXAMPLES']): - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/mpi/wscript b/src/mpi/wscript index d3b2edcd2..3ff0b416a 100644 --- a/src/mpi/wscript +++ b/src/mpi/wscript @@ -1,7 +1,8 @@ ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- import sys import subprocess -import Options + +from waflib import Options from waflib.Errors import WafError def configure(conf): @@ -39,7 +40,7 @@ def build(bld): 'model/mpi-receiver.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'mpi' headers.source = [ 'model/distributed-simulator-impl.h', @@ -51,6 +52,6 @@ def build(bld): sim.use.append('MPI') if bld.env['ENABLE_EXAMPLES']: - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/netanim/wscript b/src/netanim/wscript index 17fd5c494..b0495e8c7 100644 --- a/src/netanim/wscript +++ b/src/netanim/wscript @@ -18,7 +18,7 @@ def build (bld) : 'test/netanim-test.cc', ] - headers = bld.new_task_gen (features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'netanim' headers.source = [ 'model/animation-interface.h', @@ -26,5 +26,5 @@ def build (bld) : ] if (bld.env['ENABLE_EXAMPLES']) : - bld.add_subdirs ('examples') + bld.recurse('examples') diff --git a/src/network/wscript b/src/network/wscript index 1e14fa402..5eb1b130f 100644 --- a/src/network/wscript +++ b/src/network/wscript @@ -72,7 +72,7 @@ def build(bld): 'test/sequence-number-test-suite.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'network' headers.source = [ 'model/address.h', @@ -136,6 +136,6 @@ def build(bld): ] if (bld.env['ENABLE_EXAMPLES']): - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/nix-vector-routing/wscript b/src/nix-vector-routing/wscript index 660631a2f..6fa417c5c 100644 --- a/src/nix-vector-routing/wscript +++ b/src/nix-vector-routing/wscript @@ -8,7 +8,7 @@ def build(bld): 'helper/ipv4-nix-vector-helper.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'nix-vector-routing' headers.source = [ 'model/ipv4-nix-vector-routing.h', @@ -16,6 +16,6 @@ def build(bld): ] if bld.env['ENABLE_EXAMPLES']: - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/olsr/wscript b/src/olsr/wscript index ed2c4811e..e99c2d3f5 100644 --- a/src/olsr/wscript +++ b/src/olsr/wscript @@ -20,7 +20,7 @@ def build(bld): 'test/tc-regression-test.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'olsr' headers.source = [ 'model/olsr-routing-protocol.h', @@ -32,6 +32,6 @@ def build(bld): if bld.env['ENABLE_EXAMPLES']: - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/point-to-point-layout/wscript b/src/point-to-point-layout/wscript index d29d04ec6..7073f4075 100644 --- a/src/point-to-point-layout/wscript +++ b/src/point-to-point-layout/wscript @@ -9,7 +9,7 @@ def build(bld): 'model/point-to-point-star.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'point-to-point-layout' headers.source = [ 'model/point-to-point-dumbbell.h', diff --git a/src/point-to-point/wscript b/src/point-to-point/wscript index f3b4ba8e6..7fbf40ad2 100644 --- a/src/point-to-point/wscript +++ b/src/point-to-point/wscript @@ -16,7 +16,7 @@ def build(bld): 'test/point-to-point-test.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'point-to-point' headers.source = [ 'model/point-to-point-net-device.h', @@ -27,6 +27,6 @@ def build(bld): ] if (bld.env['ENABLE_EXAMPLES']): - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/propagation/wscript b/src/propagation/wscript index 26871c3f0..c8652be6e 100644 --- a/src/propagation/wscript +++ b/src/propagation/wscript @@ -24,7 +24,7 @@ def build(bld): 'test/itu-r-1411-nlos-over-rooftop-test-suite.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'propagation' headers.source = [ 'model/propagation-delay-model.h', @@ -41,6 +41,6 @@ def build(bld): ] if (bld.env['ENABLE_EXAMPLES']): - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/spectrum/wscript b/src/spectrum/wscript index 2848a1071..b65e23e4b 100644 --- a/src/spectrum/wscript +++ b/src/spectrum/wscript @@ -41,7 +41,7 @@ def build(bld): 'test/spectrum-ideal-phy-test.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'spectrum' headers.source = [ 'model/spectrum-model.h', @@ -76,7 +76,7 @@ def build(bld): ] if (bld.env['ENABLE_EXAMPLES']): - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/stats/wscript b/src/stats/wscript index fde1e10bf..5bc00c8af 100644 --- a/src/stats/wscript +++ b/src/stats/wscript @@ -1,13 +1,14 @@ ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- def configure(conf): - conf.env['SQLITE_STATS'] = conf.check_nonfatal(lib='sqlite3', define_name='SQLITE3', uselib_store='SQLITE3') - if not conf.env['SQLITE_STATS']: - conf.env['SQLITE_STATS'] = conf.pkg_check_modules('SQLITE3', 'sqlite3', mandatory=False) - conf.report_optional_feature("SqliteDataOutput", "SQlite stats data output", - conf.env['SQLITE_STATS'], - "library 'sqlite3' not found") + have_sqlite3 = conf.check_cfg(package='sqlite3', uselib_store='SQLITE3', + args=['--cflags', '--libs'], + mandatory=False) + conf.env['SQLITE_STATS'] = have_sqlite3 + conf.report_optional_feature("SqliteDataOutput", "SQlite stats data output", + conf.env['SQLITE_STATS'], + "library 'sqlite3' not found") def build(bld): obj = bld.create_ns3_module('stats', ['network']) @@ -25,7 +26,7 @@ def build(bld): 'test/basic-data-calculators-test-suite.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'stats' headers.source = [ 'model/data-calculator.h', diff --git a/src/tap-bridge/wscript b/src/tap-bridge/wscript index 376adffed..00a0d04c4 100644 --- a/src/tap-bridge/wscript +++ b/src/tap-bridge/wscript @@ -34,7 +34,7 @@ def build(bld): 'model/tap-encode-decode.cc', 'helper/tap-bridge-helper.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'tap-bridge' headers.source = [ 'model/tap-bridge.h', @@ -52,6 +52,6 @@ def build(bld): module.env.append_value("DEFINES", "TAP_CREATOR=\"%s\"" % (tap_creator.target,)) if bld.env['ENABLE_EXAMPLES']: - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/test/wscript b/src/test/wscript index a53a87983..2629b43be 100644 --- a/src/test/wscript +++ b/src/test/wscript @@ -16,7 +16,7 @@ def build(bld): return test = bld.create_ns3_module('test', ['internet', 'mobility', 'applications', 'csma', 'bridge', 'config-store', 'tools', 'point-to-point', 'csma-layout', 'flow-monitor', 'wifi']) - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'test' test_test = bld.create_ns3_module_test_library('test') diff --git a/src/tools/wscript b/src/tools/wscript index dc901b264..4f77ae00e 100644 --- a/src/tools/wscript +++ b/src/tools/wscript @@ -15,7 +15,7 @@ def build(bld): 'test/event-garbage-collector-test-suite.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'tools' headers.source = [ 'model/average.h', @@ -25,6 +25,6 @@ def build(bld): ] if (bld.env['ENABLE_EXAMPLES']): - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/topology-read/wscript b/src/topology-read/wscript index 8e69e8651..d550e7f38 100644 --- a/src/topology-read/wscript +++ b/src/topology-read/wscript @@ -15,7 +15,7 @@ def build(bld): 'test/rocketfuel-topology-reader-test-suite.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'topology-read' headers.source = [ 'model/topology-reader.h', @@ -26,6 +26,6 @@ def build(bld): ] if bld.env['ENABLE_EXAMPLES']: - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/uan/wscript b/src/uan/wscript index d72cabf8d..9e0d7890e 100644 --- a/src/uan/wscript +++ b/src/uan/wscript @@ -34,7 +34,7 @@ def build(bld): 'test/uan-test.cc', 'test/uan-energy-model-test.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'uan' headers.source = [ 'model/uan-channel.h', @@ -64,6 +64,6 @@ def build(bld): ] if (bld.env['ENABLE_EXAMPLES']): - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/virtual-net-device/wscript b/src/virtual-net-device/wscript index 954d80b23..e3272ec38 100644 --- a/src/virtual-net-device/wscript +++ b/src/virtual-net-device/wscript @@ -6,13 +6,13 @@ def build(bld): module.source = [ 'model/virtual-net-device.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'virtual-net-device' headers.source = [ 'model/virtual-net-device.h', ] if bld.env['ENABLE_EXAMPLES']: - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/visualizer/wscript b/src/visualizer/wscript index 67e77e18a..618380064 100644 --- a/src/visualizer/wscript +++ b/src/visualizer/wscript @@ -1,5 +1,5 @@ ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- -import Options +from waflib import Options required_python_modules = [ 'gtk', @@ -38,7 +38,7 @@ def configure(conf): def build(bld): module = bld.create_ns3_module('visualizer', ['internet', 'wifi', 'point-to-point']) - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'visualizer' # Don't do anything more for this module if Python was explicitly @@ -61,7 +61,7 @@ def build(bld): 'model/dummy-file-for-static-builds.cc', ] - module.features.append('pyembed') + module.features += ' pyembed' #module.env.append_value('CXXFLAGS', module.env['shlib_CXXFLAGS']) #module.includes = '.' diff --git a/src/wifi/wscript b/src/wifi/wscript index 762791105..9bfb41f47 100644 --- a/src/wifi/wscript +++ b/src/wifi/wscript @@ -76,7 +76,7 @@ def build(bld): 'test/wifi-test.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'wifi' headers.source = [ 'model/wifi-information-element.h', @@ -146,7 +146,7 @@ def build(bld): obj_test.use.extend(['GSL', 'GSLCBLAS', 'M']) if (bld.env['ENABLE_EXAMPLES']): - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/src/wimax/wscript b/src/wimax/wscript index ffc08e54c..159803c90 100644 --- a/src/wimax/wscript +++ b/src/wimax/wscript @@ -63,7 +63,7 @@ def build(bld): 'test/wimax-fragmentation-test.cc', ] - headers = bld.new_task_gen(features=['ns3header']) + headers = bld(features='ns3header') headers.module = 'wimax' headers.source = [ 'model/wimax-channel.h', @@ -113,6 +113,6 @@ def build(bld): ] if bld.env['ENABLE_EXAMPLES']: - bld.add_subdirs('examples') + bld.recurse('examples') bld.ns3_python_bindings() diff --git a/waf b/waf index e1e34d431..b4bf4cf4e 100755 Binary files a/waf and b/waf differ diff --git a/waf-tools/cflags.py b/waf-tools/cflags.py index cf9c93c46..2e956954b 100644 --- a/waf-tools/cflags.py +++ b/waf-tools/cflags.py @@ -1,6 +1,4 @@ -import Logs -import Options -import Utils +from waflib import Logs, Options, Utils class CompilerTraits(object): diff --git a/waf-tools/command.py b/waf-tools/command.py index 9066e0abb..9f2c0c5a2 100644 --- a/waf-tools/command.py +++ b/waf-tools/command.py @@ -1,18 +1,15 @@ -import TaskGen# import feature, taskgen_method, before_method, task_gen -import Node, Task, Utils, Build +import re import subprocess -import Options + +# import feature, taskgen_method, before_method, task_gen +from waflib import TaskGen, Node, Task, Utils, Build, Options, Logs, Task +debug = Logs.debug +error = Logs.error import shellcmd #shellcmd.subprocess = pproc # the WAF version of the subprocess module is supposedly less buggy - -from Logs import debug, error shellcmd.debug = debug -import Task - -import re - arg_rx = re.compile(r"(?P\$\$)|(?P\$\{(?P\w+)(?P.*?)\})", re.M) diff --git a/waf-tools/misc.py b/waf-tools/misc.py index e8620fb14..71b5fa62c 100644 --- a/waf-tools/misc.py +++ b/waf-tools/misc.py @@ -322,9 +322,6 @@ use command_is_external=True''') % (self.command,) if self.cwd is None: cwd = None - else: - assert isinstance(cwd, CmdDirArg) - self.cwd.find_node(self.path) args = [] inputs = [] diff --git a/waf-tools/pkgconfig.py b/waf-tools/pkgconfig.py deleted file mode 100644 index bc7572772..000000000 --- a/waf-tools/pkgconfig.py +++ /dev/null @@ -1,78 +0,0 @@ -# -*- mode: python; encoding: utf-8 -*- -# Gustavo Carneiro (gjamc) 2008 - -import Options -import Configure -import subprocess -import config_c -import sys - -def configure(conf): - pkg_config = conf.find_program('pkg-config', var='PKG_CONFIG') - if not pkg_config: return - -@Configure.conf -def pkg_check_modules(conf, uselib_name, expression, mandatory=True): - pkg_config = conf.env['PKG_CONFIG'] - if not pkg_config: - if mandatory: - conf.fatal("pkg-config is not available") - else: - return False - - if Options.options.verbose: - extra_msg = ' (%s)' % expression - else: - extra_msg = '' - - conf.start_msg('Checking for pkg-config flags for %s%s' % (uselib_name, extra_msg)) - - argv = [pkg_config, '--cflags', '--libs', expression] - cmd = subprocess.Popen(argv, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - out, err = cmd.communicate() - retval = cmd.wait() - - conf.to_log('%r: %r (exit code %i)\n%s' % (argv, out, retval, err)) - - if retval != 0: - conf.end_msg(False) - sys.stderr.write(err) - else: - if Options.options.verbose: - conf.end_msg(out) - else: - conf.end_msg(True) - - if retval == 0: - conf.parse_flags(out, uselib_name, conf.env) - conf.env[uselib_name] = True - return True - - else: - - conf.env[uselib_name] = False - if mandatory: - raise Configure.ConfigurationError('pkg-config check failed') - else: - return False - -@Configure.conf -def pkg_check_module_variable(conf, module, variable): - pkg_config = conf.env['PKG_CONFIG'] - if not pkg_config: - conf.fatal("pkg-config is not available") - - argv = [pkg_config, '--variable', variable, module] - cmd = subprocess.Popen(argv, stdout=subprocess.PIPE) - out, dummy = cmd.communicate() - retval = cmd.wait() - out = out.rstrip() # strip the trailing newline - - msg_checking = ("Checking for pkg-config variable %r in %s" % (variable, module,)) - conf.check_message_custom(msg_checking, '', out) - conf.log.write('%r: %r (exit code %i)\n' % (argv, out, retval)) - - if retval == 0: - return out - else: - raise Configure.ConfigurationError('pkg-config check failed') diff --git a/waf-tools/relocation.py b/waf-tools/relocation.py index ab8dd3615..ebbf6e4b0 100644 --- a/waf-tools/relocation.py +++ b/waf-tools/relocation.py @@ -64,7 +64,7 @@ def uid(self): try: return self.uid_ except AttributeError: - # this is not a real hot zone, but we want to avoid surprizes here + # this is not a real hot zone, but we want to avoid surprises here m = Utils.md5() up = m.update up(self.__class__.__name__.encode()) @@ -80,6 +80,6 @@ def apply_incpaths(self): lst = self.to_incnodes(self.to_list(getattr(self, 'includes', [])) + self.env['INCLUDES']) self.includes_nodes = lst bld = self.bld - self.env['INCPATHS'] = [x.is_child_of(bld.srcnode) and x.path_from(bld.srcnode) or x.abspath() for x in lst] + self.env['INCPATHS'] = [x.is_child_of(bld.srcnode) and x.path_from(bld.bldnode) or x.abspath() for x in lst] diff --git a/wscript b/wscript index 4968c3b9b..f1ff7aa00 100644 --- a/wscript +++ b/wscript @@ -8,25 +8,20 @@ import optparse import os.path import re import shlex +import subprocess import textwrap +from utils import read_config_file + + # WAF modules -import subprocess -import Options - -import Logs -import TaskGen - -import Task - -import Utils -import Build -import Configure -import Scripting - +from waflib import Utils, Scripting, Configure, Build, Options, TaskGen, Context, Task, Logs, Errors from waflib.Errors import WafError -from utils import read_config_file + +# local modules +import wutils + # By default, all modules will be enabled, examples will be disabled, # and tests will be disabled. @@ -52,9 +47,6 @@ cflags.profiles = { } cflags.default_profile = 'debug' -# local modules -import wutils - Configure.autoconfig = 0 # the following two variables are used by the target "waf dist" @@ -214,9 +206,9 @@ def options(opt): dest='doxygen_no_build') # options provided in subdirectories - opt.sub_options('src') - opt.sub_options('bindings/python') - opt.sub_options('src/internet') + opt.recurse('src') + opt.recurse('bindings/python') + opt.recurse('src/internet') def _check_compilation_flag(conf, flag, mode='cxx', linkflags=None): @@ -240,7 +232,7 @@ def _check_compilation_flag(conf, flag, mode='cxx', linkflags=None): flag_str = flag_str[:28] + "..." conf.start_msg('Checking for compilation %s support' % (flag_str,)) - env = conf.env.copy() + env = conf.env.derive() if mode == 'cc': mode = 'c' @@ -259,7 +251,7 @@ def _check_compilation_flag(conf, flag, mode='cxx', linkflags=None): retval = conf.run_c_code(code='#include \nint main() { return 0; }\n', env=env, compile_filename=fname, features=[mode, mode+'program'], execute=False) - except Configure.ConfigurationError: + except Errors.ConfigurationError: ok = False else: ok = (retval == 0) @@ -286,7 +278,7 @@ def _check_nonfatal(conf, *args, **kwargs): return None def configure(conf): - conf.check_tool("relocation", ["waf-tools"]) + conf.load('relocation', tooldir=['waf-tools']) # attach some extra methods conf.check_nonfatal = types.MethodType(_check_nonfatal, conf) @@ -295,15 +287,11 @@ def configure(conf): conf.check_optional_feature = types.MethodType(check_optional_feature, conf) conf.env['NS3_OPTIONAL_FEATURES'] = [] - conf.check_tool('compiler_c') - conf.check_tool('compiler_cxx') - conf.check_tool('cflags', ['waf-tools']) - try: - conf.check_tool('pkgconfig', ['waf-tools']) - except Configure.ConfigurationError: - pass - conf.check_tool('command', ['waf-tools']) - conf.check_tool('gnu_dirs') + conf.load('compiler_c') + conf.load('compiler_cxx') + conf.load('cflags', tooldir=['waf-tools']) + conf.load('command', tooldir=['waf-tools']) + conf.load('gnu_dirs') env = conf.env @@ -376,9 +364,9 @@ def configure(conf): conf.env['MODULES_NOT_BUILT'] = [] - conf.sub_config('bindings/python') + conf.recurse('bindings/python') - conf.sub_config('src') + conf.recurse('src') # Set the list of enabled modules. if Options.options.enable_modules: @@ -410,7 +398,7 @@ def configure(conf): if not conf.env['NS3_ENABLED_MODULES']: raise WafError('Exiting because the ' + not_built + ' module can not be built and it was the only one enabled.') - conf.sub_config('src/mpi') + conf.recurse('src/mpi') # for suid bits try: @@ -488,19 +476,18 @@ def configure(conf): # These flags are used for the implicitly dependent modules. if env['ENABLE_STATIC_NS3']: if sys.platform == 'darwin': - env.STATICLIB_MARKER = '-Wl,-all_load' + env.STLIB_MARKER = '-Wl,-all_load' else: - env.STATICLIB_MARKER = '-Wl,--whole-archive,-Bstatic' + env.STLIB_MARKER = '-Wl,--whole-archive,-Bstatic' env.SHLIB_MARKER = '-Wl,-Bdynamic,--no-whole-archive' - have_gsl = conf.pkg_check_modules('GSL', 'gsl', mandatory=False) - conf.env['ENABLE_GSL'] = have_gsl + have_gsl = conf.check_cfg(package='gsl', args=['--cflags', '--libs'], + uselib_store='GSL', mandatory=False) + conf.env['ENABLE_GSL'] = have_gsl conf.report_optional_feature("GSL", "GNU Scientific Library (GSL)", conf.env['ENABLE_GSL'], "GSL not found") - if have_gsl: - conf.env.append_value('DEFINES', "ENABLE_GSL") # for compiling C code, copy over the CXX* flags conf.env.append_value('CCFLAGS', conf.env['CXXFLAGS']) @@ -543,7 +530,7 @@ def configure(conf): print "%-30s: %s%s%s" % (caption, Logs.colors_lst[color], status, Logs.colors_lst['NORMAL']) -class SuidBuild_task(Task.TaskBase): +class SuidBuild_task(Task.Task): """task that makes a binary Suid """ after = 'link' @@ -555,7 +542,7 @@ class SuidBuild_task(Task.TaskBase): except ValueError, ex: raise WafError(str(ex)) program_node = program_obj.path.find_or_declare(program_obj.target) - self.filename = program_node.abspath() + self.filename = program_node.get_bld().abspath() def run(self): @@ -580,7 +567,7 @@ class SuidBuild_task(Task.TaskBase): def create_suid_program(bld, name): grp = bld.current_group bld.add_group() # this to make sure no two sudo tasks run at the same time - program = bld.new_task_gen(features=['cxx', 'cxxprogram']) + program = bld(features='cxx cxxprogram') program.is_ns3_program = True program.module_deps = list() program.name = name @@ -594,7 +581,7 @@ def create_suid_program(bld, name): return program def create_ns3_program(bld, name, dependencies=('core',)): - program = bld.new_task_gen(features=['cxx', 'cxxprogram']) + program = bld(features='cxx cxxprogram') program.is_ns3_program = True program.name = name @@ -607,7 +594,7 @@ def create_ns3_program(bld, name, dependencies=('core',)): if sys.platform == 'darwin': program.env.STLIB_MARKER = '-Wl,-all_load' else: - program.env.STLIB_MARKER = '-Wl,--whole-archive,-Bstatic' + program.env.STLIB_MARKER = '-Wl,-Bstatic,--whole-archive' program.env.SHLIB_MARKER = '-Wl,-Bdynamic,--no-whole-archive' else: if program.env.DEST_BINFMT == 'elf': @@ -628,8 +615,7 @@ def add_examples_programs(bld): if dir.startswith('.') or dir == 'CVS': continue if os.path.isdir(os.path.join('examples', dir)): - bld.add_subdirs(os.path.join('examples', dir)) - + bld.recurse(os.path.join('examples', dir)) def add_scratch_programs(bld): all_modules = [mod[len("ns3-"):] for mod in bld.env['NS3_ENABLED_MODULES']] @@ -652,7 +638,6 @@ def add_scratch_programs(bld): obj.name = obj.target obj.install_path = None - def _get_all_task_gen(self): for group in self.groups: for taskgen in group: @@ -699,7 +684,7 @@ def build(bld): wutils.bld = bld if Options.options.no_task_lines: - import Runner + from waflib import Runner def null_printout(s): pass Runner.printout = null_printout @@ -717,7 +702,7 @@ def build(bld): _cleandocs() # process subfolders from here - bld.add_subdirs('src') + bld.recurse('src') # If modules have been enabled, then set lists of enabled modules # and enabled module test libraries. @@ -784,7 +769,7 @@ def build(bld): # launch directory. launch_dir = os.path.abspath(Context.launch_dir) object_relative_path = os.path.join( - wutils.relpath(obj.path.abspath(), launch_dir), + wutils.relpath(obj.path.get_bld().abspath(), launch_dir), object_name) bld.env.append_value('NS3_RUNNABLE_PROGRAMS', object_relative_path) @@ -825,11 +810,11 @@ def build(bld): if script_runnable: bld.env.append_value('NS3_RUNNABLE_SCRIPTS', script) - bld.add_subdirs('bindings/python') + bld.recurse('bindings/python') # Process this subfolder here after the lists of enabled modules # and module test libraries have been set. - bld.add_subdirs('utils') + bld.recurse('utils') # Set this so that the lists will be printed at the end of this # build command. @@ -943,7 +928,6 @@ def shutdown(ctx): -from waflib import Context, Build class CheckContext(Context.Context): """run the equivalent of the old ns-3 unit tests using test.py""" cmd = 'check' @@ -961,7 +945,7 @@ class CheckContext(Context.Context): class print_introspected_doxygen_task(Task.TaskBase): - after = 'cc cxx link' + after = 'cxx link' color = 'BLUE' def __init__(self, bld): @@ -985,7 +969,7 @@ class print_introspected_doxygen_task(Task.TaskBase): # --enable-modules=xxx pass else: - prog = program_obj.path.find_or_declare(ccroot.get_target_name(program_obj)).abspath(env) + prog = program_obj.path.find_or_declare(ccroot.get_target_name(program_obj)).get_bld().abspath(env) # Create a header file with the introspected information. doxygen_out = open(os.path.join('doc', 'introspected-doxygen.h'), 'w') @@ -1000,7 +984,7 @@ class print_introspected_doxygen_task(Task.TaskBase): text_out.close() class run_python_unit_tests_task(Task.TaskBase): - after = 'cc cxx link' + after = 'cxx link' color = 'BLUE' def __init__(self, bld): @@ -1039,7 +1023,6 @@ def check_shell(bld): raise WafError(msg) -from waflib import Context, Build class Ns3ShellContext(Context.Context): """run a shell with an environment suitably modified to run locally built programs""" cmd = 'shell' @@ -1085,7 +1068,7 @@ def _doxygen(bld): raise SystemExit(1) return - prog = program_obj.path.find_or_declare(program_obj.target).abspath() + prog = program_obj.path.find_or_declare(program_obj.target).get_bld().abspath() if not os.path.exists(prog): Logs.error("print-introspected-doxygen has not been built yet." @@ -1112,8 +1095,6 @@ def _doxygen(bld): raise SystemExit(1) -from waflib import Context, Build - def _getVersion(): """update the ns3_version.js file, when building documentation""" @@ -1133,7 +1114,6 @@ class Ns3DoxygenContext(Context.Context): bld.execute() _doxygen(bld) -from waflib import Context, Build class Ns3SphinxContext(Context.Context): """build the Sphinx documentation: manual, tutorial, models""" @@ -1154,7 +1134,6 @@ class Ns3SphinxContext(Context.Context): self.sphinx_build(os.path.join("doc", sphinxdir)) -from waflib import Context, Build class Ns3DocContext(Context.Context): """build all the documentation: doxygen, manual, tutorial, models""" diff --git a/wutils.py b/wutils.py index 64229b6e3..56029885c 100644 --- a/wutils.py +++ b/wutils.py @@ -1,16 +1,12 @@ import os import os.path +import re import sys import subprocess import shlex # WAF modules -import Options -import Utils -import Logs -import TaskGen -import Build -import re +from waflib import Options, Utils, Logs, TaskGen, Build, Context from waflib.Errors import WafError # these are set from the main wscript file @@ -47,7 +43,7 @@ else: return os.path.curdir return os.path.join(*rel_list) -from waflib import Context + def find_program(program_name, env): launch_dir = os.path.abspath(Context.launch_dir) #top_dir = os.path.abspath(Options.cwd_launch)