Upgrade waf to 1.7.10 and fix included wscripts

This is a massive upgrade removing almost all pre-waf 1.6 script code. In addition, this does away with custom pkgconfig.py script for making .pc files and replaces it with waf's builtin mechanism.

Massive thanks to Alex Afanasyev for ideas and bugfixing, to Alina Quereilhac for bugfixing and testing, and to Tom Henderson for thorough testing.
This commit is contained in:
Vedran Miletić
2013-04-01 22:33:46 +02:00
parent df67c9c116
commit bbdb4231b3
49 changed files with 165 additions and 270 deletions

View File

@@ -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',

View File

@@ -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()

View File

@@ -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',

View File

@@ -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()

View File

@@ -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')

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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:

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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')

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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',

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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',

View File

@@ -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()

View File

@@ -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')

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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 = '.'

View File

@@ -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()

View File

@@ -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()

BIN
waf vendored

Binary file not shown.

View File

@@ -1,6 +1,4 @@
import Logs
import Options
import Utils
from waflib import Logs, Options, Utils
class CompilerTraits(object):

View File

@@ -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<dollar>\$\$)|(?P<subst>\$\{(?P<var>\w+)(?P<code>.*?)\})", re.M)

View File

@@ -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 = []

View File

@@ -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')

View File

@@ -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]

107
wscript
View File

@@ -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 <stdio.h>\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"""

View File

@@ -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)