53 # path will be APPNAME + '-' + VERSION + REGRESSION_SUFFIX + TRACEBALL_SUFFIX, |
53 # path will be APPNAME + '-' + VERSION + REGRESSION_SUFFIX + TRACEBALL_SUFFIX, |
54 # e.g., ns-3-dev-ref-traces.tar.bz2 |
54 # e.g., ns-3-dev-ref-traces.tar.bz2 |
55 # |
55 # |
56 TRACEBALL_SUFFIX = ".tar.bz2" |
56 TRACEBALL_SUFFIX = ".tar.bz2" |
57 |
57 |
|
58 # directory that contains network simulation cradle source |
|
59 NSC_DIR = "nsc" |
58 |
60 |
59 def dist_hook(): |
61 def dist_hook(): |
60 import tarfile |
62 import tarfile |
61 shutil.rmtree("doc/html", True) |
63 shutil.rmtree("doc/html", True) |
62 shutil.rmtree("doc/latex", True) |
64 shutil.rmtree("doc/latex", True) |
163 default=False, dest='regression_generate', action="store_true") |
165 default=False, dest='regression_generate', action="store_true") |
164 opt.add_option('--regression-tests', |
166 opt.add_option('--regression-tests', |
165 help=('For regression testing, only run/generate the indicated regression tests, ' |
167 help=('For regression testing, only run/generate the indicated regression tests, ' |
166 'specified as a comma separated list of test names'), |
168 'specified as a comma separated list of test names'), |
167 dest='regression_tests', type="string") |
169 dest='regression_tests', type="string") |
|
170 opt.add_option('--nsc', |
|
171 help=('Enable Network Simulation Cradle to allow the use real-world network stacks'), |
|
172 action="store_true", default=False, |
|
173 dest='nsc') |
168 |
174 |
169 # options provided in a script in a subdirectory named "src" |
175 # options provided in a script in a subdirectory named "src" |
170 opt.sub_options('src') |
176 opt.sub_options('src') |
171 opt.sub_options('bindings/python') |
177 opt.sub_options('bindings/python') |
172 |
178 |
191 if not ok: # if it doesn't accept, remove it again |
197 if not ok: # if it doesn't accept, remove it again |
192 conf.env['CXXFLAGS'] = save_CXXFLAGS |
198 conf.env['CXXFLAGS'] = save_CXXFLAGS |
193 |
199 |
194 |
200 |
195 def configure(conf): |
201 def configure(conf): |
|
202 conf.env['NS3_BUILDDIR'] = conf.m_blddir |
196 conf.check_tool('compiler_cxx') |
203 conf.check_tool('compiler_cxx') |
197 |
204 |
198 # create the second environment, set the variant and set its name |
205 # create the second environment, set the variant and set its name |
199 variant_env = conf.env.copy() |
206 variant_env = conf.env.copy() |
200 debug_level = Params.g_options.debug_level.lower() |
207 debug_level = Params.g_options.debug_level.lower() |
301 stat = proc.wait() |
308 stat = proc.wait() |
302 if stat & 0xff: |
309 if stat & 0xff: |
303 return stat | 0x80 |
310 return stat | 0x80 |
304 return stat >> 8 |
311 return stat >> 8 |
305 |
312 |
|
313 |
|
314 def nsc_build(bld): |
|
315 # XXX: Detect gcc major version(s) available to build supported stacks |
|
316 kernels = [['linux-2.6.18', 'linux2.6.18'], |
|
317 ['linux-2.6.26', 'linux2.6.26']] |
|
318 for dir,name in kernels: |
|
319 soname = 'lib' + name + '.so' |
|
320 tmp = NSC_DIR + '/' + dir +'/' + soname |
|
321 if not os.path.exists(tmp): |
|
322 if os.system('cd ' + NSC_DIR + ' && python scons.py ' + dir) != 0: |
|
323 Params.fatal("Building NSC stack failed") |
|
324 builddir = os.path.abspath(os.path.join(bld.env()['NS3_BUILDDIR'], bld.env ().variant())) |
|
325 if not os.path.exists(builddir + '/nsc'): |
|
326 try: |
|
327 os.symlink('../../' + NSC_DIR, builddir + '/nsc') |
|
328 except: |
|
329 Params.fatal("Error linkink " + builddir + '/nsc') |
|
330 if not os.path.exists(builddir + '/' + soname): |
|
331 try: |
|
332 os.symlink('../../' + NSC_DIR + '/' + dir + '/' + soname, builddir + '/' + soname) |
|
333 except: |
|
334 Params.fatal("Error linking " + builddir + '/' + soname) |
306 |
335 |
307 def build(bld): |
336 def build(bld): |
308 if Params.g_options.no_task_lines: |
337 if Params.g_options.no_task_lines: |
309 import Runner |
338 import Runner |
310 def null_printout(s): |
339 def null_printout(s): |
390 else: |
419 else: |
391 lib.add_objects = list(env['NS3_MODULES']) |
420 lib.add_objects = list(env['NS3_MODULES']) |
392 lib.uselib_local = list(env['NS3_MODULES']) |
421 lib.uselib_local = list(env['NS3_MODULES']) |
393 |
422 |
394 bld.add_subdirs('bindings/python') |
423 bld.add_subdirs('bindings/python') |
|
424 |
|
425 if env['NSC_ENABLED'] == 'yes': |
|
426 nsc_build(bld) |
395 |
427 |
396 def get_command_template(): |
428 def get_command_template(): |
397 if Params.g_options.valgrind: |
429 if Params.g_options.valgrind: |
398 if Params.g_options.command_template: |
430 if Params.g_options.command_template: |
399 Params.fatal("Options --command-template and --valgrind are conflicting") |
431 Params.fatal("Options --command-template and --valgrind are conflicting") |