OLD | NEW |
1 # Copyright 2008 the V8 project authors. All rights reserved. | 1 # Copyright 2008 the V8 project authors. All rights reserved. |
2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
4 # met: | 4 # met: |
5 # | 5 # |
6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 'values': ['freebsd', 'linux', 'macos', 'win32'], | 296 'values': ['freebsd', 'linux', 'macos', 'win32'], |
297 'default': OS_GUESS, | 297 'default': OS_GUESS, |
298 'help': 'the os to build for' | 298 'help': 'the os to build for' |
299 }, | 299 }, |
300 'arch': { | 300 'arch': { |
301 'values':['arm', 'ia32'], | 301 'values':['arm', 'ia32'], |
302 'default': ARCH_GUESS, | 302 'default': ARCH_GUESS, |
303 'help': 'the architecture to build for' | 303 'help': 'the architecture to build for' |
304 }, | 304 }, |
305 'snapshot': { | 305 'snapshot': { |
306 'values': ['on', 'off'], | 306 'values': ['on', 'off', 'nobuild'], |
307 'default': 'off', | 307 'default': 'off', |
308 'help': 'build using snapshots for faster start-up' | 308 'help': 'build using snapshots for faster start-up' |
309 }, | 309 }, |
310 'prof': { | 310 'prof': { |
311 'values': ['on', 'off'], | 311 'values': ['on', 'off'], |
312 'default': 'off', | 312 'default': 'off', |
313 'help': 'enable profiling of build target' | 313 'help': 'enable profiling of build target' |
314 }, | 314 }, |
315 'library': { | 315 'library': { |
316 'values': ['static', 'shared'], | 316 'values': ['static', 'shared'], |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 if not env[name] in option['values']: | 389 if not env[name] in option['values']: |
390 message = ("Unknown %s value '%s'. Possible values are (%s)." % | 390 message = ("Unknown %s value '%s'. Possible values are (%s)." % |
391 (name, env[name], ", ".join(option['values']))) | 391 (name, env[name], ", ".join(option['values']))) |
392 Abort(message) | 392 Abort(message) |
393 | 393 |
394 | 394 |
395 class BuildContext(object): | 395 class BuildContext(object): |
396 | 396 |
397 def __init__(self, options, env_overrides, samples): | 397 def __init__(self, options, env_overrides, samples): |
398 self.library_targets = [] | 398 self.library_targets = [] |
| 399 self.mksnapshot_targets = [] |
399 self.cctest_targets = [] | 400 self.cctest_targets = [] |
400 self.sample_targets = [] | 401 self.sample_targets = [] |
401 self.d8_targets = [] | 402 self.d8_targets = [] |
402 self.options = options | 403 self.options = options |
403 self.env_overrides = env_overrides | 404 self.env_overrides = env_overrides |
404 self.samples = samples | 405 self.samples = samples |
405 self.use_snapshot = (options['snapshot'] == 'on') | 406 self.use_snapshot = (options['snapshot'] != 'off') |
| 407 self.build_snapshot = (options['snapshot'] == 'on') |
406 self.flags = None | 408 self.flags = None |
407 | 409 |
408 def AddRelevantFlags(self, initial, flags): | 410 def AddRelevantFlags(self, initial, flags): |
409 result = initial.copy() | 411 result = initial.copy() |
410 self.AppendFlags(result, flags.get('all')) | 412 self.AppendFlags(result, flags.get('all')) |
411 toolchain = self.options['toolchain'] | 413 toolchain = self.options['toolchain'] |
412 if toolchain in flags: | 414 if toolchain in flags: |
413 self.AppendFlags(result, flags[toolchain].get('all')) | 415 self.AppendFlags(result, flags[toolchain].get('all')) |
414 for option in sorted(self.options.keys()): | 416 for option in sorted(self.options.keys()): |
415 value = self.options[option] | 417 value = self.options[option] |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 library_flags = context.AddRelevantFlags(os.environ, LIBRARY_FLAGS) | 491 library_flags = context.AddRelevantFlags(os.environ, LIBRARY_FLAGS) |
490 v8_flags = context.AddRelevantFlags(library_flags, V8_EXTRA_FLAGS) | 492 v8_flags = context.AddRelevantFlags(library_flags, V8_EXTRA_FLAGS) |
491 jscre_flags = context.AddRelevantFlags(library_flags, JSCRE_EXTRA_FLAGS) | 493 jscre_flags = context.AddRelevantFlags(library_flags, JSCRE_EXTRA_FLAGS) |
492 dtoa_flags = context.AddRelevantFlags(library_flags, DTOA_EXTRA_FLAGS) | 494 dtoa_flags = context.AddRelevantFlags(library_flags, DTOA_EXTRA_FLAGS) |
493 cctest_flags = context.AddRelevantFlags(v8_flags, CCTEST_EXTRA_FLAGS) | 495 cctest_flags = context.AddRelevantFlags(v8_flags, CCTEST_EXTRA_FLAGS) |
494 sample_flags = context.AddRelevantFlags(os.environ, SAMPLE_FLAGS) | 496 sample_flags = context.AddRelevantFlags(os.environ, SAMPLE_FLAGS) |
495 d8_flags = context.AddRelevantFlags(library_flags, D8_FLAGS) | 497 d8_flags = context.AddRelevantFlags(library_flags, D8_FLAGS) |
496 | 498 |
497 context.flags = { | 499 context.flags = { |
498 'v8': v8_flags, | 500 'v8': v8_flags, |
| 501 'mksnapshot': v8_flags, |
499 'jscre': jscre_flags, | 502 'jscre': jscre_flags, |
500 'dtoa': dtoa_flags, | 503 'dtoa': dtoa_flags, |
501 'cctest': cctest_flags, | 504 'cctest': cctest_flags, |
502 'sample': sample_flags, | 505 'sample': sample_flags, |
503 'd8': d8_flags | 506 'd8': d8_flags |
504 } | 507 } |
505 | 508 |
506 target_id = mode | 509 target_id = mode |
507 suffix = SUFFIXES[target_id] | 510 suffix = SUFFIXES[target_id] |
508 library_name = 'v8' + suffix | 511 library_name = 'v8' + suffix |
509 env['LIBRARY'] = library_name | 512 env['LIBRARY'] = library_name |
510 | 513 |
511 # Build the object files by invoking SCons recursively. | 514 # Build the object files by invoking SCons recursively. |
512 (object_files, shell_files) = env.SConscript( | 515 (object_files, shell_files, mksnapshot) = env.SConscript( |
513 join('src', 'SConscript'), | 516 join('src', 'SConscript'), |
514 build_dir=join('obj', target_id), | 517 build_dir=join('obj', target_id), |
515 exports='context', | 518 exports='context', |
516 duplicate=False | 519 duplicate=False |
517 ) | 520 ) |
518 | 521 |
| 522 context.mksnapshot_targets.append(mksnapshot) |
| 523 |
519 # Link the object files into a library. | 524 # Link the object files into a library. |
520 env.Replace(**context.flags['v8']) | 525 env.Replace(**context.flags['v8']) |
521 context.ApplyEnvOverrides(env) | 526 context.ApplyEnvOverrides(env) |
522 if context.options['library'] == 'static': | 527 if context.options['library'] == 'static': |
523 library = env.StaticLibrary(library_name, object_files) | 528 library = env.StaticLibrary(library_name, object_files) |
524 else: | 529 else: |
525 # There seems to be a glitch in the way scons decides where to put | 530 # There seems to be a glitch in the way scons decides where to put |
526 # PDB files when compiling using MSVC so we specify it manually. | 531 # PDB files when compiling using MSVC so we specify it manually. |
527 # This should not affect any other platforms. | 532 # This should not affect any other platforms. |
528 pdb_name = library_name + '.dll.pdb' | 533 pdb_name = library_name + '.dll.pdb' |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 def Build(): | 568 def Build(): |
564 opts = GetOptions() | 569 opts = GetOptions() |
565 env = Environment(options=opts) | 570 env = Environment(options=opts) |
566 Help(opts.GenerateHelpText(env)) | 571 Help(opts.GenerateHelpText(env)) |
567 VerifyOptions(env) | 572 VerifyOptions(env) |
568 env_overrides = ParseEnvOverrides(env['env']) | 573 env_overrides = ParseEnvOverrides(env['env']) |
569 | 574 |
570 SourceSignatures(env['sourcesignatures']) | 575 SourceSignatures(env['sourcesignatures']) |
571 | 576 |
572 libraries = [] | 577 libraries = [] |
| 578 mksnapshots = [] |
573 cctests = [] | 579 cctests = [] |
574 samples = [] | 580 samples = [] |
575 d8s = [] | 581 d8s = [] |
576 modes = SplitList(env['mode']) | 582 modes = SplitList(env['mode']) |
577 for mode in modes: | 583 for mode in modes: |
578 context = BuildSpecific(env.Copy(), mode, env_overrides) | 584 context = BuildSpecific(env.Copy(), mode, env_overrides) |
579 libraries += context.library_targets | 585 libraries += context.library_targets |
| 586 mksnapshots += context.mksnapshot_targets |
580 cctests += context.cctest_targets | 587 cctests += context.cctest_targets |
581 samples += context.sample_targets | 588 samples += context.sample_targets |
582 d8s += context.d8_targets | 589 d8s += context.d8_targets |
583 | 590 |
584 env.Alias('library', libraries) | 591 env.Alias('library', libraries) |
| 592 env.Alias('mksnapshot', mksnapshots) |
585 env.Alias('cctests', cctests) | 593 env.Alias('cctests', cctests) |
586 env.Alias('sample', samples) | 594 env.Alias('sample', samples) |
587 env.Alias('d8', d8s) | 595 env.Alias('d8', d8s) |
588 | 596 |
589 if env['sample']: | 597 if env['sample']: |
590 env.Default('sample') | 598 env.Default('sample') |
591 else: | 599 else: |
592 env.Default('library') | 600 env.Default('library') |
593 | 601 |
594 | 602 |
595 # We disable deprecation warnings because we need to be able to use | 603 # We disable deprecation warnings because we need to be able to use |
596 # env.Copy without getting warnings for compatibility with older | 604 # env.Copy without getting warnings for compatibility with older |
597 # version of scons. Also, there's a bug in some revisions that | 605 # version of scons. Also, there's a bug in some revisions that |
598 # doesn't allow this flag to be set, so we swallow any exceptions. | 606 # doesn't allow this flag to be set, so we swallow any exceptions. |
599 # Lovely. | 607 # Lovely. |
600 try: | 608 try: |
601 SetOption('warn', 'no-deprecated') | 609 SetOption('warn', 'no-deprecated') |
602 except: | 610 except: |
603 pass | 611 pass |
604 | 612 |
605 | 613 |
606 Build() | 614 Build() |
OLD | NEW |