src/internet-stack/wscript
author Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
Mon, 29 Dec 2008 13:28:54 +0000
changeset 4064 10222f483860
parent 3977 4daeb41d7fc1
child 4065 f18c257dd25e
permissions -rw-r--r--
Upgrade to new WAF, work in progress
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
537
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
     1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
3579
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
     2
import os
3664
e10e48cbce9c bug 322: download nsc from released location if in 'release' mode.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3651
diff changeset
     3
import urllib
3579
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
     4
4064
10222f483860 Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3977
diff changeset
     5
import Options
10222f483860 Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3977
diff changeset
     6
import Logs
10222f483860 Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3977
diff changeset
     7
import Utils
10222f483860 Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3977
diff changeset
     8
import Task
10222f483860 Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3977
diff changeset
     9
3579
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    10
# Mercurial repository of the network simulation cradle
3664
e10e48cbce9c bug 322: download nsc from released location if in 'release' mode.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3651
diff changeset
    11
NSC_REPO = "https://secure.wand.net.nz/mercurial/nsc"
e10e48cbce9c bug 322: download nsc from released location if in 'release' mode.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3651
diff changeset
    12
NSC_RELEASE_URL = "http://research.wand.net.nz/software/nsc"
3876
81d31a09aae6 Depend on nsc 0.5.0. This is required so the interface is the same for an NSC
Sam Jansen <sam.jansen@gmail.com>
parents: 3820
diff changeset
    13
NSC_RELEASE_NAME = "nsc-0.5.0"
3628
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
    14
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
    15
# directory that contains network simulation cradle source
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
    16
# note, this path is relative to the project root
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
    17
NSC_DIR = "nsc"
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
    18
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
    19
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
    20
def set_options(opt):
3637
a6d8bf62a61d For better consistency, option --nsc becomes --enable-nsc, --python-disable becomes --disable-python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3635
diff changeset
    21
    opt.add_option('--enable-nsc',
3628
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
    22
                   help=('Enable Network Simulation Cradle to allow the use real-world network stacks'),
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
    23
                   action="store_true", default=False,
3637
a6d8bf62a61d For better consistency, option --nsc becomes --enable-nsc, --python-disable becomes --disable-python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3635
diff changeset
    24
                   dest='enable_nsc')
3628
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
    25
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
    26
3579
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    27
def nsc_fetch():
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    28
    def nsc_clone():
3664
e10e48cbce9c bug 322: download nsc from released location if in 'release' mode.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3651
diff changeset
    29
        print "Retrieving nsc from " + NSC_REPO
3579
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    30
        if os.system("hg version > /dev/null 2>&1") != 0:
4064
10222f483860 Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3977
diff changeset
    31
            raise Utils.WafError("Mercurial not installed, http fallback not yet implemented")
3664
e10e48cbce9c bug 322: download nsc from released location if in 'release' mode.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3651
diff changeset
    32
        if os.system("hg  clone " + NSC_REPO) != 0:
4064
10222f483860 Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3977
diff changeset
    33
            raise Utils.WafError("hg -q clone %s failed" % NSC_REPO)
3579
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    34
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    35
    def nsc_update():
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    36
        if os.system("hg version > /dev/null 2>&1") != 0:
4064
10222f483860 Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3977
diff changeset
    37
            Logs.warn("Mercurial not installed, not updating nsc source")
3579
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    38
3664
e10e48cbce9c bug 322: download nsc from released location if in 'release' mode.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3651
diff changeset
    39
        print "Pulling nsc updates from " + NSC_REPO
e10e48cbce9c bug 322: download nsc from released location if in 'release' mode.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3651
diff changeset
    40
        if os.system("cd nsc && hg pull %s && hg update" % NSC_REPO) != 0:
4064
10222f483860 Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3977
diff changeset
    41
            Logs.warn("Updating nsc using mercurial failed")
3579
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    42
3664
e10e48cbce9c bug 322: download nsc from released location if in 'release' mode.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3651
diff changeset
    43
    def nsc_download():
e10e48cbce9c bug 322: download nsc from released location if in 'release' mode.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3651
diff changeset
    44
        local_file = NSC_RELEASE_NAME + ".tar.bz2"
e10e48cbce9c bug 322: download nsc from released location if in 'release' mode.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3651
diff changeset
    45
        remote_file = NSC_RELEASE_URL + "/" + local_file
e10e48cbce9c bug 322: download nsc from released location if in 'release' mode.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3651
diff changeset
    46
        print "Retrieving nsc from " + remote_file
e10e48cbce9c bug 322: download nsc from released location if in 'release' mode.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3651
diff changeset
    47
        urllib.urlretrieve(remote_file, local_file)
e10e48cbce9c bug 322: download nsc from released location if in 'release' mode.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3651
diff changeset
    48
        print "Uncompressing " + local_file
e10e48cbce9c bug 322: download nsc from released location if in 'release' mode.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3651
diff changeset
    49
        os.system("tar -xjf " + local_file)
e10e48cbce9c bug 322: download nsc from released location if in 'release' mode.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3651
diff changeset
    50
        os.system('mv ' + NSC_RELEASE_NAME + ' nsc')
e10e48cbce9c bug 322: download nsc from released location if in 'release' mode.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3651
diff changeset
    51
e10e48cbce9c bug 322: download nsc from released location if in 'release' mode.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3651
diff changeset
    52
    if not os.path.exists('.hg'):
e10e48cbce9c bug 322: download nsc from released location if in 'release' mode.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3651
diff changeset
    53
        nsc_download ()
e10e48cbce9c bug 322: download nsc from released location if in 'release' mode.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3651
diff changeset
    54
    elif not os.path.exists("nsc"):
3579
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    55
        nsc_clone()
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    56
    else:
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    57
        nsc_update()
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    58
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    59
def configure(conf):
3703
71d93292bc49 Apply Sam's nsc regression patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3673
diff changeset
    60
    conf.env['ENABLE_NSC'] = False
71d93292bc49 Apply Sam's nsc regression patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3673
diff changeset
    61
3579
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    62
    # checks for flex and bison, which is needed to build NSCs globaliser
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    63
    def check_nsc_buildutils():
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    64
        import flex
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    65
        import bison
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    66
        conf.check_tool('flex bison')
4064
10222f483860 Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3977
diff changeset
    67
        conf.check(lib='fl', mandatory=True)
3579
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    68
4064
10222f483860 Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3977
diff changeset
    69
    if not Options.options.enable_nsc:
3625
30afad8324d5 Add a summary of optional features at the end of the configuration stage.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3595
diff changeset
    70
        conf.report_optional_feature("nsc", "Network Simulation Cradle", False,
3637
a6d8bf62a61d For better consistency, option --nsc becomes --enable-nsc, --python-disable becomes --disable-python.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3635
diff changeset
    71
                                     "--enable-nsc configure option not given")
3579
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    72
	return
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    73
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    74
    check_nsc_buildutils()
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    75
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    76
    arch = os.uname()[4]
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    77
    ok = False
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    78
    if arch == 'x86_64' or arch == 'i686' or arch == 'i586' or arch == 'i486' or arch == 'i386':
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    79
        conf.env['NSC_ENABLED'] = 'yes'
3669
e96e61efb9a5 enable nsc when nsc enabled
Craig Dowell <craigdo@ee.washington.edu>
parents: 3664
diff changeset
    80
        conf.env.append_value('CXXDEFINES', 'NETWORK_SIMULATION_CRADLE')
4064
10222f483860 Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3977
diff changeset
    81
        conf.env['ENABLE_NSC'] = conf.check(mandatory=True, lib='dl', define_name='HAVE_DL', uselib='DL')
3579
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    82
        ok = True
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    83
    conf.check_message('NSC supported architecture', arch, ok)
3625
30afad8324d5 Add a summary of optional features at the end of the configuration stage.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3595
diff changeset
    84
    conf.report_optional_feature("nsc", "Network Simulation Cradle", ok,
30afad8324d5 Add a summary of optional features at the end of the configuration stage.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3595
diff changeset
    85
                                 "architecture %r not supported" % arch)
3579
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
    86
    nsc_fetch()
537
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    87
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    88
3628
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
    89
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
    90
class NscBuildTask(Task.TaskBase):
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
    91
    """task that builds nsc
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
    92
    """
4064
10222f483860 Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3977
diff changeset
    93
    after = 'link' # build after the rest of ns-3
3628
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
    94
    def __init__(self, builddir):
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
    95
        self.builddir = builddir
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
    96
        super(NscBuildTask, self).__init__()
4064
10222f483860 Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3977
diff changeset
    97
        self.display = 'build-nsc\n'
3628
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
    98
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
    99
    def run(self):
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
   100
        # XXX: Detect gcc major version(s) available to build supported stacks
3673
319eb29611b1 nsc: fix liblinux2.6.18.so sym link creation
Florian Westphal <fw@strlen.de>
parents: 3672
diff changeset
   101
        builddir = self.builddir
3628
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
   102
        kernels = [['linux-2.6.18', 'linux2.6.18'],
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
   103
                   ['linux-2.6.26', 'linux2.6.26']]
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
   104
        for dir, name in kernels:
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
   105
            soname = 'lib' + name + '.so'
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
   106
            if not os.path.exists(os.path.join("..", NSC_DIR, dir, soname)):
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
   107
                if os.system('cd ../%s && python scons.py %s' % (NSC_DIR, dir)) != 0:
4064
10222f483860 Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3977
diff changeset
   108
                    raise Utils.WafError("Building NSC stack failed")
3672
817729f77408 nsc: remove nsc builddir symlink
Florian Westphal <fw@strlen.de>
parents: 3669
diff changeset
   109
3673
319eb29611b1 nsc: fix liblinux2.6.18.so sym link creation
Florian Westphal <fw@strlen.de>
parents: 3672
diff changeset
   110
            if not os.path.exists(builddir + '/' + soname):
319eb29611b1 nsc: fix liblinux2.6.18.so sym link creation
Florian Westphal <fw@strlen.de>
parents: 3672
diff changeset
   111
                try:
319eb29611b1 nsc: fix liblinux2.6.18.so sym link creation
Florian Westphal <fw@strlen.de>
parents: 3672
diff changeset
   112
                    os.symlink('../../' + NSC_DIR + '/' + dir + '/' + soname, builddir +  '/' + soname)
319eb29611b1 nsc: fix liblinux2.6.18.so sym link creation
Florian Westphal <fw@strlen.de>
parents: 3672
diff changeset
   113
                except:
4064
10222f483860 Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3977
diff changeset
   114
                    raise Utils.WafError("Error linking " + builddir + '/' + soname)
3673
319eb29611b1 nsc: fix liblinux2.6.18.so sym link creation
Florian Westphal <fw@strlen.de>
parents: 3672
diff changeset
   115
3628
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
   116
537
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   117
def build(bld):
3260
8c0ab08144e6 bug 186: internet-node directory must be renamed to internet-stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3216
diff changeset
   118
    obj = bld.create_ns3_module('internet-stack', ['node'])
537
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   119
    obj.source = [
2707
1c353c7aef5b introduce AddInternetStack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2609
diff changeset
   120
        'internet-stack.cc',
537
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   121
        'ipv4-l4-protocol.cc',
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   122
        'udp-header.cc',
2224
6f97d21a99c2 Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 1496
diff changeset
   123
        'tcp-header.cc',
537
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   124
        'ipv4-checksum.cc',
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   125
        'ipv4-interface.cc',
760
975a88259e2e Re-sync WAF build with the latest SConstruct changes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 729
diff changeset
   126
        'ipv4-l3-protocol.cc',
983
47c42bd66fb7 Support dynamic routing and multiple routing protocols; static routing table is refactored as a "routing protocol".
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 976
diff changeset
   127
        'ipv4-static-routing.cc',
3959
ec65107df095 Segregate Ipv4GlobalRouting from Ipv4StaticRouting; add API for deleting and recomputing global routes
Tom Henderson <tomh@tomh.org>
parents: 3876
diff changeset
   128
        'ipv4-global-routing.cc',
537
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   129
        'ipv4-end-point.cc',
760
975a88259e2e Re-sync WAF build with the latest SConstruct changes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 729
diff changeset
   130
        'udp-l4-protocol.cc',
2224
6f97d21a99c2 Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 1496
diff changeset
   131
        'tcp-l4-protocol.cc',
537
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   132
        'arp-header.cc',
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   133
        'arp-cache.cc',
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   134
        'arp-ipv4-interface.cc',
760
975a88259e2e Re-sync WAF build with the latest SConstruct changes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 729
diff changeset
   135
        'arp-l3-protocol.cc',
537
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   136
        'ipv4-loopback-interface.cc',
3130
881cc06cd651 rename UdpSocket to UdpSocketImpl
Tom Henderson <tomh@tomh.org>
parents: 3126
diff changeset
   137
        'udp-socket-impl.cc',
3131
d82336dfd269 change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents: 3130
diff changeset
   138
        'tcp-socket-impl.cc',
537
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   139
        'ipv4-end-point-demux.cc',
760
975a88259e2e Re-sync WAF build with the latest SConstruct changes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 729
diff changeset
   140
        'ipv4-impl.cc',
3126
68d35477a842 s/UdpImpl/UdpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents: 2830
diff changeset
   141
        'udp-socket-factory-impl.cc',
3133
295e061719fc change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents: 3131
diff changeset
   142
        'tcp-socket-factory-impl.cc',
2224
6f97d21a99c2 Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 1496
diff changeset
   143
        'pending-data.cc',
6f97d21a99c2 Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 1496
diff changeset
   144
        'sequence-number.cc',
6f97d21a99c2 Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 1496
diff changeset
   145
        'rtt-estimator.cc',
3820
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3703
diff changeset
   146
        'ipv4-raw-socket-factory-impl.cc',
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3703
diff changeset
   147
        'ipv4-raw-socket-impl.cc',
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3703
diff changeset
   148
        'icmpv4.cc',
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3703
diff changeset
   149
        'icmpv4-l4-protocol.cc',
537
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   150
        ]
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   151
4064
10222f483860 Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3977
diff changeset
   152
    headers = bld.new_task_gen('ns3header')
3260
8c0ab08144e6 bug 186: internet-node directory must be renamed to internet-stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3216
diff changeset
   153
    headers.module = 'internet-stack'
537
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   154
    headers.source = [
2707
1c353c7aef5b introduce AddInternetStack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2609
diff changeset
   155
        'internet-stack.h',
1244
9ee2a9242c10 make sure udp-header.h is exported for main-packet-printer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1177
diff changeset
   156
        'udp-header.h',
2224
6f97d21a99c2 Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 1496
diff changeset
   157
        'tcp-header.h',
2321
f1a18a24d318 Make sequence-number.h a public header file (because it is included by another public header, tcp-header.h)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 2224
diff changeset
   158
        'sequence-number.h',
3380
38b8549b1ad3 Minor doc notes added to ipv4.h
tjkopena@cs.drexel.edu
parents: 3260
diff changeset
   159
        'ipv4-interface.h',
38b8549b1ad3 Minor doc notes added to ipv4.h
tjkopena@cs.drexel.edu
parents: 3260
diff changeset
   160
        'ipv4-l3-protocol.h',
38b8549b1ad3 Minor doc notes added to ipv4.h
tjkopena@cs.drexel.edu
parents: 3260
diff changeset
   161
        'ipv4-static-routing.h',
3959
ec65107df095 Segregate Ipv4GlobalRouting from Ipv4StaticRouting; add API for deleting and recomputing global routes
Tom Henderson <tomh@tomh.org>
parents: 3876
diff changeset
   162
        'ipv4-global-routing.h',
3820
c04ecfdce1ef apply icmp patch
Craig Dowell <craigdo@ee.washington.edu>
parents: 3703
diff changeset
   163
        'icmpv4.h',
537
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   164
        ]
3579
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3380
diff changeset
   165
4064
10222f483860 Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3977
diff changeset
   166
    if bld.env['NSC_ENABLED']:        
3651
9a2b20293ae5 bug 316: make nsc compilation conditional again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3637
diff changeset
   167
        obj.source.append ('nsc-tcp-socket-impl.cc')
9a2b20293ae5 bug 316: make nsc compilation conditional again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3637
diff changeset
   168
        obj.source.append ('nsc-tcp-l4-protocol.cc')
9a2b20293ae5 bug 316: make nsc compilation conditional again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3637
diff changeset
   169
        obj.source.append ('nsc-tcp-socket-factory-impl.cc')
9a2b20293ae5 bug 316: make nsc compilation conditional again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3637
diff changeset
   170
        obj.source.append ('nsc-sysctl.cc')
9a2b20293ae5 bug 316: make nsc compilation conditional again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3637
diff changeset
   171
        obj.uselib = 'DL'
4064
10222f483860 Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3977
diff changeset
   172
        builddir = os.path.abspath(os.path.join(bld.env['NS3_BUILDDIR'], bld.env ().variant()))
3628
a9c05c7e54f2 Move all NSC related build code into src/internet-stack, to unclutter a bit the main wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3626
diff changeset
   173
        NscBuildTask(builddir)