author | Florian Westphal <fw@strlen.de> |
Wed, 10 Sep 2008 13:11:35 +0200 | |
changeset 3673 | 319eb29611b1 |
parent 3672 | 817729f77408 |
child 3703 | 71d93292bc49 |
permissions | -rw-r--r-- |
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 Params |
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
|
3 |
import Task |
3579
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
4 |
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
|
5 |
import urllib |
3579
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
6 |
|
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
7 |
# 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
|
8 |
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
|
9 |
NSC_RELEASE_URL = "http://research.wand.net.nz/software/nsc" |
e10e48cbce9c
bug 322: download nsc from released location if in 'release' mode.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3651
diff
changeset
|
10 |
NSC_RELEASE_NAME = "nsc-0.4.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
|
11 |
|
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
|
12 |
# 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
|
13 |
# 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
|
14 |
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
|
15 |
|
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 |
|
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 |
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
|
18 |
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
|
19 |
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
|
20 |
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
|
21 |
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
|
22 |
|
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 |
|
3579
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
24 |
def nsc_fetch(): |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
25 |
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
|
26 |
print "Retrieving nsc from " + NSC_REPO |
3579
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
27 |
if os.system("hg version > /dev/null 2>&1") != 0: |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
28 |
Params.fatal("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
|
29 |
if os.system("hg clone " + NSC_REPO) != 0: |
e10e48cbce9c
bug 322: download nsc from released location if in 'release' mode.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3651
diff
changeset
|
30 |
Params.fatal("hg -q clone %s failed" % NSC_REPO) |
3579
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
31 |
|
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
32 |
def nsc_update(): |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
33 |
if os.system("hg version > /dev/null 2>&1") != 0: |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
34 |
Params.warning("Mercurial not installed, not updating nsc source") |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
35 |
|
3664
e10e48cbce9c
bug 322: download nsc from released location if in 'release' mode.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3651
diff
changeset
|
36 |
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
|
37 |
if os.system("cd nsc && hg pull %s && hg update" % NSC_REPO) != 0: |
3579
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
38 |
Params.warning("Updating nsc using mercurial failed") |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
39 |
|
3664
e10e48cbce9c
bug 322: download nsc from released location if in 'release' mode.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3651
diff
changeset
|
40 |
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
|
41 |
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
|
42 |
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
|
43 |
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
|
44 |
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
|
45 |
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
|
46 |
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
|
47 |
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
|
48 |
|
e10e48cbce9c
bug 322: download nsc from released location if in 'release' mode.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3651
diff
changeset
|
49 |
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
|
50 |
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
|
51 |
elif not os.path.exists("nsc"): |
3579
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
52 |
nsc_clone() |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
53 |
else: |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
54 |
nsc_update() |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
55 |
|
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
56 |
def configure(conf): |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
57 |
# 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
|
58 |
def check_nsc_buildutils(): |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
59 |
import flex |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
60 |
import bison |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
61 |
conf.check_tool('flex bison') |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
62 |
e = conf.create_library_configurator() |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
63 |
e.mandatory = True |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
64 |
e.name = 'fl' |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
65 |
e.run() |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
66 |
|
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
|
67 |
if not Params.g_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
|
68 |
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
|
69 |
"--enable-nsc configure option not given") |
3579
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
70 |
return |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
71 |
|
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
72 |
check_nsc_buildutils() |
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 |
arch = os.uname()[4] |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
75 |
ok = False |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
76 |
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
|
77 |
conf.env['NSC_ENABLED'] = 'yes' |
3669
e96e61efb9a5
enable nsc when nsc enabled
Craig Dowell <craigdo@ee.washington.edu>
parents:
3664
diff
changeset
|
78 |
conf.env.append_value('CXXDEFINES', 'NETWORK_SIMULATION_CRADLE') |
3579
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
79 |
e = conf.create_library_configurator() |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
80 |
e.mandatory = True |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
81 |
e.name = 'dl' |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
82 |
e.define = 'HAVE_DL' |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
83 |
e.uselib = 'DL' |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
84 |
e.run() |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
85 |
ok = True |
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
86 |
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
|
87 |
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
|
88 |
"architecture %r not supported" % arch) |
3579
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
89 |
nsc_fetch() |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
90 |
|
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
91 |
|
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
|
92 |
|
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
|
93 |
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
|
94 |
"""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
|
95 |
""" |
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 |
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
|
97 |
self.m_display = 'build-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
|
98 |
self.prio = 1000 # build after the rest of ns-3 |
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 |
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
|
100 |
super(NscBuildTask, self).__init__() |
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
|
101 |
|
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 |
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
|
103 |
# 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
|
104 |
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
|
105 |
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
|
106 |
['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
|
107 |
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
|
108 |
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
|
109 |
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
|
110 |
if os.system('cd ../%s && python scons.py %s' % (NSC_DIR, dir)) != 0: |
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
|
111 |
Params.fatal("Building NSC stack failed") |
3672
817729f77408
nsc: remove nsc builddir symlink
Florian Westphal <fw@strlen.de>
parents:
3669
diff
changeset
|
112 |
|
3673
319eb29611b1
nsc: fix liblinux2.6.18.so sym link creation
Florian Westphal <fw@strlen.de>
parents:
3672
diff
changeset
|
113 |
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
|
114 |
try: |
319eb29611b1
nsc: fix liblinux2.6.18.so sym link creation
Florian Westphal <fw@strlen.de>
parents:
3672
diff
changeset
|
115 |
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
|
116 |
except: |
319eb29611b1
nsc: fix liblinux2.6.18.so sym link creation
Florian Westphal <fw@strlen.de>
parents:
3672
diff
changeset
|
117 |
Params.fatal("Error linking " + builddir + '/' + soname) |
319eb29611b1
nsc: fix liblinux2.6.18.so sym link creation
Florian Westphal <fw@strlen.de>
parents:
3672
diff
changeset
|
118 |
|
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
|
119 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
120 |
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
|
121 |
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
|
122 |
obj.source = [ |
2707
1c353c7aef5b
introduce AddInternetStack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2609
diff
changeset
|
123 |
'internet-stack.cc', |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
124 |
'ipv4-l4-protocol.cc', |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
125 |
'udp-header.cc', |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1496
diff
changeset
|
126 |
'tcp-header.cc', |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
127 |
'ipv4-checksum.cc', |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
128 |
'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
|
129 |
'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
|
130 |
'ipv4-static-routing.cc', |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
131 |
'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
|
132 |
'udp-l4-protocol.cc', |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1496
diff
changeset
|
133 |
'tcp-l4-protocol.cc', |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
134 |
'arp-header.cc', |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
135 |
'arp-cache.cc', |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
136 |
'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
|
137 |
'arp-l3-protocol.cc', |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
138 |
'ipv4-loopback-interface.cc', |
3130
881cc06cd651
rename UdpSocket to UdpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
3126
diff
changeset
|
139 |
'udp-socket-impl.cc', |
3131
d82336dfd269
change TcpSocket to TcpSocketImpl
Tom Henderson <tomh@tomh.org>
parents:
3130
diff
changeset
|
140 |
'tcp-socket-impl.cc', |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
141 |
'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
|
142 |
'ipv4-impl.cc', |
3126
68d35477a842
s/UdpImpl/UdpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
2830
diff
changeset
|
143 |
'udp-socket-factory-impl.cc', |
3133
295e061719fc
change TcpImpl to TcpSocketFactoryImpl
Tom Henderson <tomh@tomh.org>
parents:
3131
diff
changeset
|
144 |
'tcp-socket-factory-impl.cc', |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1496
diff
changeset
|
145 |
'pending-data.cc', |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1496
diff
changeset
|
146 |
'sequence-number.cc', |
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1496
diff
changeset
|
147 |
'rtt-estimator.cc', |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
148 |
] |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
149 |
|
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
150 |
headers = bld.create_obj('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
|
151 |
headers.module = 'internet-stack' |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
152 |
headers.source = [ |
2707
1c353c7aef5b
introduce AddInternetStack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2609
diff
changeset
|
153 |
'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
|
154 |
'udp-header.h', |
2224
6f97d21a99c2
Added in ns-3-tcp (second try)
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
1496
diff
changeset
|
155 |
'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
|
156 |
'sequence-number.h', |
3380 | 157 |
'ipv4-interface.h', |
158 |
'ipv4-l3-protocol.h', |
|
159 |
'ipv4-static-routing.h', |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
160 |
] |
3579
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3380
diff
changeset
|
161 |
|
3635
cddd59578812
compile nsc code unconditionally.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3634
diff
changeset
|
162 |
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
|
163 |
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
|
164 |
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
|
165 |
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
|
166 |
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
|
167 |
obj.uselib = 'DL' |
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
|
168 |
builddir = os.path.abspath(os.path.join(bld.env()['NS3_BUILDDIR'], bld.env ().variant())) |
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
|
169 |
NscBuildTask(builddir) |