src/tap-bridge/wscript
author Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
Wed, 30 Mar 2011 17:21:11 +0100
changeset 6982 c383b48d0831
parent 6932 3b497f4f6ad9
child 7244 1a9428ead071
permissions -rw-r--r--
Make sure modular python bindings for emu and tap-bridge are not built on macosx
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']:
4186
f1d57182d491 tighten up configuration reqs for tap and emu
Craig Dowell <craigdo@ee.washington.edu>
parents: 4164
diff changeset
     7
        conf.env['ENABLE_TAP'] = conf.check(header_name='linux/if_tun.h',
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']:
c85cb9b073a0 comparing with http://code.nsnam.org/ns-3-dev
Craig Dowell <craigdo@ee.washington.edu>
parents: 4390
diff changeset
    18
        blddir = os.path.abspath(os.path.join(conf.blddir, conf.env.variant()))
c85cb9b073a0 comparing with http://code.nsnam.org/ns-3-dev
Craig Dowell <craigdo@ee.washington.edu>
parents: 4390
diff changeset
    19
        tapcreatordir = os.path.abspath(os.path.join(blddir, "src/devices/tap-bridge"))
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)
c85cb9b073a0 comparing with http://code.nsnam.org/ns-3-dev
Craig Dowell <craigdo@ee.washington.edu>
parents: 4390
diff changeset
    21
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    22
def build(bld):
6836
638bb8c62285 Fix some additional dependency issues
Tom Henderson <tomh@tomh.org>
parents: 6823
diff changeset
    23
    module = bld.create_ns3_module('tap-bridge', ['network', 'internet'])
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    24
    module.source = [
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    25
        ]
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    26
    headers = bld.new_task_gen('ns3header')
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    27
    headers.module = 'tap-bridge'
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    28
    headers.source = [
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
    29
        'doc/tap.h',
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    30
        ]
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    31
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
    32
    if not bld.env['ENABLE_TAP']:
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
    33
        return
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
    34
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
    35
    module.source.extend([
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
    36
            'model/tap-bridge.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
    37
            '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
    38
            'helper/tap-bridge-helper.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
    39
            ])
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
    40
    headers.source.extend([
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
    41
            'model/tap-bridge.h',
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
    42
            'helper/tap-bridge-helper.h',
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
    43
            ])
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    44
4190
b6734a5d920c work around to allow FreeBSD to run tap-bridge
Craig Dowell <craigdo@ee.washington.edu>
parents: 4186
diff changeset
    45
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
    46
    if not bld.env['PLATFORM'].startswith('freebsd'):
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
    47
        obj = bld.create_suid_program('tap-creator')
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
        obj.source = [
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-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
    50
            '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
    51
            ]
4163
8c48682b3d42 checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    52
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
    53
    if bld.env['ENABLE_EXAMPLES']:
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
        bld.add_subdirs('examples')
6932
3b497f4f6ad9 Add more modular bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6852
diff changeset
    55
3b497f4f6ad9 Add more modular bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6852
diff changeset
    56
    bld.ns3_python_bindings()