src/tap-bridge/wscript
author Vedran Miletić <rivanvx@gmail.com>
Mon, 01 Apr 2013 22:33:46 +0200
changeset 9277 0f87d1cb030c
parent 7694 ae1974f9365b
child 10825 798057a32954
permissions -rw-r--r--
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.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     2
5975
c85cb9b073a0 comparing with http://code.nsnam.org/ns-3-dev
Craig Dowell <craigdo@ee.washington.edu>
parents: 4390
diff changeset
     3
import os.path
c85cb9b073a0 comparing with http://code.nsnam.org/ns-3-dev
Craig Dowell <craigdo@ee.washington.edu>
parents: 4390
diff changeset
     4
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     5
def configure(conf):
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     6
    if conf.env['ENABLE_THREADING']:
7494
d93f5e8e0a59 waf-1.6: Mac OSX and other fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7487
diff changeset
     7
        conf.env['ENABLE_TAP'] = conf.check_nonfatal(header_name='linux/if_tun.h',
4186
f1d57182d491 tighten up configuration reqs for tap and emu
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
     8
                                            define_name='HAVE_IF_TUN_H')
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     9
        conf.report_optional_feature("TapBridge", "Tap Bridge",
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    10
                                     conf.env['ENABLE_TAP'],
4186
f1d57182d491 tighten up configuration reqs for tap and emu
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
    11
                                     "<linux/if_tun.h> include not detected")
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    12
    else:
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    13
        conf.report_optional_feature("TapBridge", "Tap Bridge",
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    14
                                     False,
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    15
                                     "needs threading support which is not available")
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    16
5975
c85cb9b073a0 comparing with http://code.nsnam.org/ns-3-dev
Craig Dowell <craigdo@ee.washington.edu>
parents: 4390
diff changeset
    17
    if conf.env['ENABLE_TAP']:
7487
82cd20da9650 Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7294
diff changeset
    18
        blddir = os.path.abspath(os.path.join(conf.bldnode.abspath(), conf.variant))
7244
1a9428ead071 fixed paths to tap-creator and emu-sock-creator broken after modules move.
Andrey Mazo <mazo@iitp.ru>
parents: 6982
diff changeset
    19
        tapcreatordir = os.path.abspath(os.path.join(blddir, "src/tap-bridge"))
5975
c85cb9b073a0 comparing with http://code.nsnam.org/ns-3-dev
Craig Dowell <craigdo@ee.washington.edu>
parents: 4390
diff changeset
    20
        conf.env.append_value('NS3_EXECUTABLE_PATH', tapcreatordir)
7294
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    21
    else:
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    22
        # Add this module to the list of modules that won't be built
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    23
        # if they are enabled.
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    24
        conf.env['MODULES_NOT_BUILT'].append('tap-bridge')
5975
c85cb9b073a0 comparing with http://code.nsnam.org/ns-3-dev
Craig Dowell <craigdo@ee.washington.edu>
parents: 4390
diff changeset
    25
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    26
def build(bld):
7294
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    27
    # Don't do anything for this module if tap-bridge's not enabled.
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    28
    if not bld.env['ENABLE_TAP']:
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    29
        return
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    30
6836
638bb8c62285 Fix some additional dependency issues
Tom Henderson <tomh@tomh.org>
parents: 6823
diff changeset
    31
    module = bld.create_ns3_module('tap-bridge', ['network', 'internet'])
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    32
    module.source = [
7294
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    33
        'model/tap-bridge.cc',
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    34
        'model/tap-encode-decode.cc',
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    35
        'helper/tap-bridge-helper.cc',
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    36
        ]
9277
0f87d1cb030c Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents: 7694
diff changeset
    37
    headers = bld(features='ns3header')
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    38
    headers.module = 'tap-bridge'
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    39
    headers.source = [
7294
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    40
        'model/tap-bridge.h',
1ebf059e9ebc Make openflow and tap-bridge modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 7244
diff changeset
    41
        'helper/tap-bridge-helper.h',
6848
1f453ad50ef3 Converts csma, emu, tap-bridge, point-to-point, wifi and wimax modules into modular format
Lalith Suresh <suresh.lalith@gmail.com>
parents: 6836
diff changeset
    42
        'doc/tap.h',
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    43
        ]
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    44
6982
c383b48d0831 Make sure modular python bindings for emu and tap-bridge are not built on macosx
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6932
diff changeset
    45
    if not bld.env['PLATFORM'].startswith('freebsd'):
7694
ae1974f9365b Make sure the call tap-creator with the new program name
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    46
        tap_creator = bld.create_suid_program('tap-creator')
ae1974f9365b Make sure the call tap-creator with the new program name
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    47
        tap_creator.source = [
6982
c383b48d0831 Make sure modular python bindings for emu and tap-bridge are not built on macosx
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6932
diff changeset
    48
            'model/tap-creator.cc',
c383b48d0831 Make sure modular python bindings for emu and tap-bridge are not built on macosx
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6932
diff changeset
    49
            'model/tap-encode-decode.cc',
c383b48d0831 Make sure modular python bindings for emu and tap-bridge are not built on macosx
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6932
diff changeset
    50
            ]
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    51
7694
ae1974f9365b Make sure the call tap-creator with the new program name
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    52
    module.env.append_value("DEFINES", "TAP_CREATOR=\"%s\"" % (tap_creator.target,))
ae1974f9365b Make sure the call tap-creator with the new program name
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    53
6848
1f453ad50ef3 Converts csma, emu, tap-bridge, point-to-point, wifi and wimax modules into modular format
Lalith Suresh <suresh.lalith@gmail.com>
parents: 6836
diff changeset
    54
    if bld.env['ENABLE_EXAMPLES']:
9277
0f87d1cb030c Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents: 7694
diff changeset
    55
        bld.recurse('examples')
6932
3b497f4f6ad9 Add more modular bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6852
diff changeset
    56
3b497f4f6ad9 Add more modular bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6852
diff changeset
    57
    bld.ns3_python_bindings()