|
|
| 146 |
opt.load('cflags') |
146 |
opt.load('cflags') |
| 147 |
opt.load('gnu_dirs') |
147 |
opt.load('gnu_dirs') |
| 148 |
|
148 |
|
|
|
149 |
opt.add_option('--check-config', |
| 150 |
help=('Print the current configuration.'), |
| 151 |
action="store_true", default=False, |
| 152 |
dest="check_config") |
| 153 |
|
| 149 |
opt.add_option('--cwd', |
154 |
opt.add_option('--cwd', |
| 150 |
help=('Set the working directory for a program.'), |
155 |
help=('Set the working directory for a program.'), |
| 151 |
action="store", type="string", default=None, |
156 |
action="store", type="string", default=None, |
|
|
| 304 |
except conf.errors.ConfigurationError: |
309 |
except conf.errors.ConfigurationError: |
| 305 |
return None |
310 |
return None |
| 306 |
|
311 |
|
|
|
312 |
# Write a summary of optional features status |
| 313 |
def print_config(env, phase='configure'): |
| 314 |
if phase == 'configure': |
| 315 |
profile = get_build_profile(env) |
| 316 |
else: |
| 317 |
profile = get_build_profile() |
| 318 |
|
| 319 |
print("---- Summary of optional NS-3 features:") |
| 320 |
print("%-30s: %s%s%s" % ("Build profile", Logs.colors('GREEN'), |
| 321 |
profile, Logs.colors('NORMAL'))) |
| 322 |
bld = wutils.bld |
| 323 |
print("%-30s: %s%s%s" % ("Build directory", Logs.colors('GREEN'), |
| 324 |
Options.options.out, Logs.colors('NORMAL'))) |
| 325 |
|
| 326 |
|
| 327 |
for (name, caption, was_enabled, reason_not_enabled) in sorted(env['NS3_OPTIONAL_FEATURES'], key=lambda s : s[1]): |
| 328 |
if was_enabled: |
| 329 |
status = 'enabled' |
| 330 |
color = 'GREEN' |
| 331 |
else: |
| 332 |
status = 'not enabled (%s)' % reason_not_enabled |
| 333 |
color = 'RED' |
| 334 |
print("%-30s: %s%s%s" % (caption, Logs.colors(color), status, Logs.colors('NORMAL'))) |
| 307 |
|
335 |
|
| 308 |
def configure(conf): |
336 |
def configure(conf): |
| 309 |
conf.load('relocation', tooldir=['waf-tools']) |
337 |
conf.load('relocation', tooldir=['waf-tools']) |
|
|
| 586 |
value = shlex.split(os.environ[envvar]) |
614 |
value = shlex.split(os.environ[envvar]) |
| 587 |
conf.env.append_value(confvar, value) |
615 |
conf.env.append_value(confvar, value) |
| 588 |
|
616 |
|
| 589 |
# Write a summary of optional features status |
617 |
print_config(env) |
| 590 |
print("---- Summary of optional NS-3 features:") |
|
|
| 591 |
print("%-30s: %s%s%s" % ("Build profile", Logs.colors('GREEN'), |
| 592 |
Options.options.build_profile, Logs.colors('NORMAL'))) |
| 593 |
bld = wutils.bld |
| 594 |
print("%-30s: %s%s%s" % ("Build directory", Logs.colors('GREEN'), |
| 595 |
Options.options.out, Logs.colors('NORMAL'))) |
| 596 |
|
618 |
|
| 597 |
|
|
|
| 598 |
for (name, caption, was_enabled, reason_not_enabled) in sorted(conf.env['NS3_OPTIONAL_FEATURES'], key=lambda s : s[1]): |
| 599 |
if was_enabled: |
| 600 |
status = 'enabled' |
| 601 |
color = 'GREEN' |
| 602 |
else: |
| 603 |
status = 'not enabled (%s)' % reason_not_enabled |
| 604 |
color = 'RED' |
| 605 |
print("%-30s: %s%s%s" % (caption, Logs.colors(color), status, Logs.colors('NORMAL'))) |
| 606 |
|
| 607 |
|
619 |
|
| 608 |
class SuidBuild_task(Task.Task): |
620 |
class SuidBuild_task(Task.Task): |
| 609 |
"""task that makes a binary Suid |
621 |
"""task that makes a binary Suid |
|
|
| 747 |
return obj |
759 |
return obj |
| 748 |
raise KeyError(name) |
760 |
raise KeyError(name) |
| 749 |
|
761 |
|
| 750 |
|
762 |
# Parse the waf lockfile generated by latest 'configure' operation |
| 751 |
def build(bld): |
763 |
def get_build_profile(env=None): |
| 752 |
env = bld.env |
764 |
if env == None: |
| 753 |
|
|
|
| 754 |
if Options.options.check_profile: |
| 755 |
# Parse the waf lockfile generated by latest 'configure' operation |
| 756 |
lockfile = os.environ.get('WAFLOCK', '.lock-waf_%s_build' % sys.platform) |
765 |
lockfile = os.environ.get('WAFLOCK', '.lock-waf_%s_build' % sys.platform) |
| 757 |
profile = "not found" |
766 |
profile = "not found" |
| 758 |
with open(lockfile, "r") as f: |
767 |
with open(lockfile, "r") as f: |
|
|
| 764 |
optkey,optval = x.split(':') |
773 |
optkey,optval = x.split(':') |
| 765 |
if (optkey.lstrip() == '\'build_profile\''): |
774 |
if (optkey.lstrip() == '\'build_profile\''): |
| 766 |
profile = str(optval.lstrip()).replace("'","") |
775 |
profile = str(optval.lstrip()).replace("'","") |
| 767 |
print("Build profile: %s" % profile) |
776 |
else: |
|
|
777 |
profile = Options.options.build_profile |
| 778 |
return profile |
| 779 |
|
| 780 |
def build(bld): |
| 781 |
env = bld.env |
| 782 |
|
| 783 |
if Options.options.check_config: |
| 784 |
print_config(env, 'build') |
| 785 |
else: |
| 786 |
if Options.options.check_profile: |
| 787 |
profile = get_build_profile() |
| 788 |
print("Build profile: %s" % profile) |
| 789 |
|
| 790 |
if Options.options.check_profile or Options.options.check_config: |
| 768 |
raise SystemExit(0) |
791 |
raise SystemExit(0) |
| 769 |
return |
792 |
return |
| 770 |
|
793 |
|