58 |
58 |
59 # these variables are mandatory ('/' are converted automatically) |
59 # these variables are mandatory ('/' are converted automatically) |
60 srcdir = '.' |
60 srcdir = '.' |
61 blddir = 'build' |
61 blddir = 'build' |
62 |
62 |
|
63 def load_env(): |
|
64 bld_cls = getattr(Utils.g_module, 'build_context', Utils.Context) |
|
65 bld_ctx = bld_cls() |
|
66 bld_ctx.load_dirs(os.path.abspath(os.path.join (srcdir,'..')), |
|
67 os.path.abspath(os.path.join (srcdir,'..', blddir))) |
|
68 bld_ctx.load_envs() |
|
69 env = bld_ctx.get_env() |
|
70 return env |
|
71 |
|
72 def get_files(base_dir): |
|
73 retval = [] |
|
74 reference=os.path.dirname(base_dir) |
|
75 for root, dirs, files in os.walk(base_dir): |
|
76 if root.find('.hg') != -1: |
|
77 continue |
|
78 for file in files: |
|
79 if file.find('.hg') != -1: |
|
80 continue |
|
81 fullname = os.path.join(root,file) |
|
82 # we can't use os.path.relpath because it's new in python 2.6 |
|
83 relname = fullname.replace(reference + '/','') |
|
84 retval.append([fullname,relname]) |
|
85 return retval |
|
86 |
63 |
87 |
64 def dist_hook(): |
88 def dist_hook(): |
65 import tarfile |
89 import tarfile |
66 shutil.rmtree("doc/html", True) |
90 shutil.rmtree("doc/html", True) |
67 shutil.rmtree("doc/latex", True) |
91 shutil.rmtree("doc/latex", True) |
68 shutil.rmtree("nsc", True) |
92 shutil.rmtree("nsc", True) |
69 |
93 |
70 ## build the name of the traces subdirectory. Will be something like |
94 ## build the name of the traces subdirectory. Will be something like |
71 ## ns-3-dev-ref-traces |
95 ## ns-3-dev-ref-traces |
72 traces_name = APPNAME + '-' + VERSION + regression.REGRESSION_SUFFIX |
96 traces_name = APPNAME + '-' + VERSION + REGRESSION_SUFFIX |
73 ## Create a tar.bz2 file with the traces |
97 ## Create a tar.bz2 file with the traces |
74 traces_dir = os.path.join(regression.REGRESSION_DIR, traces_name) |
98 env = load_env() |
75 if not os.path.isdir(traces_dir): |
99 regression_dir = env['REGRESSION_TRACES'] |
76 Logs.warn("Not creating traces archive: the %s directory does not exist" % traces_dir) |
100 if not os.path.isdir(regression_dir): |
|
101 Logs.warn("Not creating traces archive: the %s directory does not exist" % regression_dir) |
77 else: |
102 else: |
78 traceball = traces_name + wutils.TRACEBALL_SUFFIX |
103 traceball = traces_name + wutils.TRACEBALL_SUFFIX |
79 tar = tarfile.open(os.path.join("..", traceball), 'w:bz2') |
104 tar = tarfile.open(os.path.join("..", traceball), 'w:bz2') |
80 tar.add(traces_dir) |
105 files = get_files(regression_dir) |
|
106 for fullfilename,relfilename in files: |
|
107 tar.add(fullfilename,arcname=relfilename) |
81 tar.close() |
108 tar.close() |
82 ## Now remove it; we do not ship the traces with the main tarball... |
|
83 shutil.rmtree(traces_dir, True) |
|
84 |
109 |
85 def set_options(opt): |
110 def set_options(opt): |
86 # options provided by the modules |
111 # options provided by the modules |
87 opt.tool_options('compiler_cxx') |
112 opt.tool_options('compiler_cxx') |
88 opt.tool_options('cflags') |
113 opt.tool_options('cflags') |
207 conf.check_tool('pkgconfig') |
232 conf.check_tool('pkgconfig') |
208 except Configure.ConfigurationError: |
233 except Configure.ConfigurationError: |
209 pass |
234 pass |
210 conf.check_tool('command') |
235 conf.check_tool('command') |
211 |
236 |
212 # create the second environment, set the variant and set its name |
|
213 variant_env = conf.env.copy() |
|
214 variant_name = Options.options.build_profile |
|
215 |
|
216 # Check for the location of regression reference traces |
237 # Check for the location of regression reference traces |
217 if Options.options.regression_traces is not None: |
238 if Options.options.regression_traces is not None: |
218 if os.path.isdir(Options.options.regression_traces): |
239 if os.path.isdir(Options.options.regression_traces): |
219 conf.check_message("regression traces location", '', True, ("%s (given)" % Options.options.regression_traces)) |
240 conf.check_message("regression traces location", '', True, ("%s (given)" % Options.options.regression_traces)) |
220 variant_env['REGRESSION_TRACES'] = os.path.abspath(Options.options.regression_traces) |
241 conf.env['REGRESSION_TRACES'] = os.path.abspath(Options.options.regression_traces) |
221 else: |
242 else: |
222 traces = os.path.join('..', "%s-%s%s" % (APPNAME, VERSION, REGRESSION_SUFFIX)) |
243 traces = os.path.join('..', "%s-%s%s" % (APPNAME, VERSION, REGRESSION_SUFFIX)) |
223 if os.path.isdir(traces): |
244 if os.path.isdir(traces): |
224 conf.check_message("regression reference traces", '', True, ("%s (guessed)" % traces)) |
245 conf.check_message("regression reference traces", '', True, ("%s (guessed)" % traces)) |
225 variant_env['REGRESSION_TRACES'] = os.path.abspath(traces) |
246 conf.env['REGRESSION_TRACES'] = os.path.abspath(traces) |
226 del traces |
247 del traces |
227 if not variant_env['REGRESSION_TRACES']: |
248 if not conf.env['REGRESSION_TRACES']: |
228 conf.check_message("regression reference traces", '', False) |
249 conf.check_message("regression reference traces", '', False) |
|
250 |
|
251 # create the second environment, set the variant and set its name |
|
252 variant_env = conf.env.copy() |
|
253 variant_name = Options.options.build_profile |
229 |
254 |
230 if Options.options.enable_gcov: |
255 if Options.options.enable_gcov: |
231 variant_name += '-gcov' |
256 variant_name += '-gcov' |
232 variant_env.append_value('CCFLAGS', '-fprofile-arcs') |
257 variant_env.append_value('CCFLAGS', '-fprofile-arcs') |
233 variant_env.append_value('CCFLAGS', '-ftest-coverage') |
258 variant_env.append_value('CCFLAGS', '-ftest-coverage') |