Chromium Code Reviews| OLD | NEW | 
|---|---|
| 1 # Copyright 2010 the V8 project authors. All rights reserved. | 1 # Copyright 2010 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 | 
| 11 # with the distribution. | 11 # with the distribution. | 
| 12 # * Neither the name of Google Inc. nor the names of its | 12 # * Neither the name of Google Inc. nor the names of its | 
| 13 # contributors may be used to endorse or promote products derived | 13 # contributors may be used to endorse or promote products derived | 
| 14 # from this software without specific prior written permission. | 14 # from this software without specific prior written permission. | 
| 15 # | 15 # | 
| 16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 
| 17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 
| 18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 
| 19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 
| 20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 
| 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 
| 22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 
| 23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 
| 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 
| 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
| 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
| 27 | 27 | 
| 28 import platform | 28 import platform | 
| 29 import re | 29 import re | 
| 30 import subprocess | |
| 30 import sys | 31 import sys | 
| 31 import os | 32 import os | 
| 32 from os.path import join, dirname, abspath | 33 from os.path import join, dirname, abspath | 
| 33 from types import DictType, StringTypes | 34 from types import DictType, StringTypes | 
| 34 root_dir = dirname(File('SConstruct').rfile().abspath) | 35 root_dir = dirname(File('SConstruct').rfile().abspath) | 
| 35 sys.path.insert(0, join(root_dir, 'tools')) | 36 sys.path.insert(0, join(root_dir, 'tools')) | 
| 36 import js2c, utils | 37 import js2c, utils | 
| 37 | 38 | 
| 38 # ANDROID_TOP is the top of the Android checkout, fetched from the environment | 39 # ANDROID_TOP is the top of the Android checkout, fetched from the environment | 
| 39 # variable 'TOP'. You will also need to set the CXX, CC, AR and RANLIB | 40 # variable 'TOP'. You will also need to set the CXX, CC, AR and RANLIB | 
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 }, | 136 }, | 
| 136 'gcc': { | 137 'gcc': { | 
| 137 'all': { | 138 'all': { | 
| 138 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], | 139 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], | 
| 139 'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'], | 140 'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'], | 
| 140 }, | 141 }, | 
| 141 'visibility:hidden': { | 142 'visibility:hidden': { | 
| 142 # Use visibility=default to disable this. | 143 # Use visibility=default to disable this. | 
| 143 'CXXFLAGS': ['-fvisibility=hidden'] | 144 'CXXFLAGS': ['-fvisibility=hidden'] | 
| 144 }, | 145 }, | 
| 146 'strictaliasing:off': { | |
| 147 'CCFLAGS': ['-fno-strict-aliasing'] | |
| 148 }, | |
| 145 'mode:debug': { | 149 'mode:debug': { | 
| 146 'CCFLAGS': ['-g', '-O0'], | 150 'CCFLAGS': ['-g', '-O0'], | 
| 147 'CPPDEFINES': ['ENABLE_DISASSEMBLER', 'DEBUG'], | 151 'CPPDEFINES': ['ENABLE_DISASSEMBLER', 'DEBUG'], | 
| 148 'os:android': { | 152 'os:android': { | 
| 149 'CCFLAGS': ['-mthumb'] | 153 'CCFLAGS': ['-mthumb'] | 
| 150 } | 154 } | 
| 151 }, | 155 }, | 
| 152 'mode:release': { | 156 'mode:release': { | 
| 153 'CCFLAGS': ['-O3', '-fomit-frame-pointer', '-fdata-sections', | 157 'CCFLAGS': ['-O3', '-fomit-frame-pointer', '-fdata-sections', | 
| 154 '-ffunction-sections'], | 158 '-ffunction-sections'], | 
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 645 'release': '', | 649 'release': '', | 
| 646 'debug': '_g' | 650 'debug': '_g' | 
| 647 } | 651 } | 
| 648 | 652 | 
| 649 | 653 | 
| 650 def Abort(message): | 654 def Abort(message): | 
| 651 print message | 655 print message | 
| 652 sys.exit(1) | 656 sys.exit(1) | 
| 653 | 657 | 
| 654 | 658 | 
| 655 def GuessToolchain(os): | 659 def GuessOS(env): | 
| 656 tools = Environment()['TOOLS'] | 660 return utils.GuessOS() | 
| 661 | |
| 662 | |
| 663 def GuessArch(env): | |
| 664 return utils.GuessArchitecture() | |
| 665 | |
| 666 | |
| 667 def GuessToolchain(env): | |
| 668 tools = env['TOOLS'] | |
| 657 if 'gcc' in tools: | 669 if 'gcc' in tools: | 
| 658 return 'gcc' | 670 return 'gcc' | 
| 659 elif 'msvc' in tools: | 671 elif 'msvc' in tools: | 
| 660 return 'msvc' | 672 return 'msvc' | 
| 661 else: | 673 else: | 
| 662 return None | 674 return None | 
| 663 | 675 | 
| 664 | 676 | 
| 665 def GuessVisibility(os, toolchain): | 677 def GuessVisibility(env): | 
| 678 os = env['os'] | |
| 679 toolchain = env['toolchain']; | |
| 666 if (os == 'win32' or os == 'cygwin') and toolchain == 'gcc': | 680 if (os == 'win32' or os == 'cygwin') and toolchain == 'gcc': | 
| 667 # MinGW / Cygwin can't do it. | 681 # MinGW / Cygwin can't do it. | 
| 668 return 'default' | 682 return 'default' | 
| 669 elif os == 'solaris': | 683 elif os == 'solaris': | 
| 670 return 'default' | 684 return 'default' | 
| 671 else: | 685 else: | 
| 672 return 'hidden' | 686 return 'hidden' | 
| 673 | 687 | 
| 674 | 688 | 
| 675 OS_GUESS = utils.GuessOS() | 689 def GuessStrictAliasing(env): | 
| 676 TOOLCHAIN_GUESS = GuessToolchain(OS_GUESS) | 690 # There seems to be a problem with gcc 4.5.x | 
| 677 ARCH_GUESS = utils.GuessArchitecture() | 691 # see http://code.google.com/p/v8/issues/detail?id=884 | 
| 678 VISIBILITY_GUESS = GuessVisibility(OS_GUESS, TOOLCHAIN_GUESS) | 692 # it can be worked around by disabling strict aliasing | 
| 693 toolchain = env['toolchain']; | |
| 694 if toolchain == 'gcc': | |
| 695 env = Environment(tools=['gcc']) | |
| 696 version = subprocess.Popen([env['CC'], '-dumpversion'], | |
| 
 
Vyacheslav Egorov (Chromium)
2011/03/29 11:59:33
should not we just rely on env['CCVERSION'] instea
 
 | |
| 697 stdout=subprocess.PIPE).communicate()[0] | |
| 698 if version.find('4.5') == 0: | |
| 699 return 'off' | |
| 700 return 'default' | |
| 679 | 701 | 
| 680 | 702 | 
| 681 SIMPLE_OPTIONS = { | 703 SIMPLE_OPTIONS = { | 
| 682 'toolchain': { | 704 'toolchain': { | 
| 683 'values': ['gcc', 'msvc'], | 705 'values': ['gcc', 'msvc'], | 
| 684 'default': TOOLCHAIN_GUESS, | 706 'guess': GuessToolchain, | 
| 685 'help': 'the toolchain to use (%s)' % TOOLCHAIN_GUESS | 707 'help': 'the toolchain to use' | 
| 686 }, | 708 }, | 
| 687 'os': { | 709 'os': { | 
| 688 'values': ['freebsd', 'linux', 'macos', 'win32', 'android', 'openbsd', 'sola ris', 'cygwin'], | 710 'values': ['freebsd', 'linux', 'macos', 'win32', 'android', 'openbsd', 'sola ris', 'cygwin'], | 
| 689 'default': OS_GUESS, | 711 'guess': GuessOS, | 
| 690 'help': 'the os to build for (%s)' % OS_GUESS | 712 'help': 'the os to build for' | 
| 691 }, | 713 }, | 
| 692 'arch': { | 714 'arch': { | 
| 693 'values':['arm', 'ia32', 'x64', 'mips'], | 715 'values':['arm', 'ia32', 'x64', 'mips'], | 
| 694 'default': ARCH_GUESS, | 716 'guess': GuessArch, | 
| 695 'help': 'the architecture to build for (%s)' % ARCH_GUESS | 717 'help': 'the architecture to build for' | 
| 696 }, | 718 }, | 
| 697 'regexp': { | 719 'regexp': { | 
| 698 'values': ['native', 'interpreted'], | 720 'values': ['native', 'interpreted'], | 
| 699 'default': 'native', | 721 'default': 'native', | 
| 700 'help': 'Whether to use native or interpreted regexp implementation' | 722 'help': 'Whether to use native or interpreted regexp implementation' | 
| 701 }, | 723 }, | 
| 702 'snapshot': { | 724 'snapshot': { | 
| 703 'values': ['on', 'off', 'nobuild'], | 725 'values': ['on', 'off', 'nobuild'], | 
| 704 'default': 'off', | 726 'default': 'off', | 
| 705 'help': 'build using snapshots for faster start-up' | 727 'help': 'build using snapshots for faster start-up' | 
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 794 'default': 'dumb', | 816 'default': 'dumb', | 
| 795 'help': 'the console to use for the d8 shell' | 817 'help': 'the console to use for the d8 shell' | 
| 796 }, | 818 }, | 
| 797 'verbose': { | 819 'verbose': { | 
| 798 'values': ['on', 'off'], | 820 'values': ['on', 'off'], | 
| 799 'default': 'off', | 821 'default': 'off', | 
| 800 'help': 'more output from compiler and linker' | 822 'help': 'more output from compiler and linker' | 
| 801 }, | 823 }, | 
| 802 'visibility': { | 824 'visibility': { | 
| 803 'values': ['default', 'hidden'], | 825 'values': ['default', 'hidden'], | 
| 804 'default': VISIBILITY_GUESS, | 826 'guess': GuessVisibility, | 
| 805 'help': 'shared library symbol visibility (%s)' % VISIBILITY_GUESS | 827 'depends': ['os', 'toolchain'], | 
| 828 'help': 'shared library symbol visibility' | |
| 829 }, | |
| 830 'strictaliasing': { | |
| 831 'values': ['default', 'off'], | |
| 832 'guess': GuessStrictAliasing, | |
| 833 'depends': ['toolchain'], | |
| 834 'help': 'assume strict aliasing while optimizing' | |
| 806 }, | 835 }, | 
| 807 'pgo': { | 836 'pgo': { | 
| 808 'values': ['off', 'instrument', 'optimize'], | 837 'values': ['off', 'instrument', 'optimize'], | 
| 809 'default': 'off', | 838 'default': 'off', | 
| 810 'help': 'select profile guided optimization variant', | 839 'help': 'select profile guided optimization variant', | 
| 811 } | 840 } | 
| 812 } | 841 } | 
| 813 | 842 | 
| 814 | 843 | 
| 844 def AddOption(result, name, option): | |
| 845 if 'guess' in option: | |
| 846 # Option has a guess function | |
| 847 guess = option.get('guess') | |
| 848 guess_env = Environment(options=result) | |
| 849 # Check if all options that the guess function depends on are set | |
| 850 if 'depends' in option: | |
| 851 for dependency in option.get('depends'): | |
| 852 if not dependency in guess_env: | |
| 853 return False | |
| 854 default = guess(guess_env) | |
| 855 else: | |
| 856 # Option has a fixed default | |
| 857 default = option.get('default') | |
| 858 | |
| 859 help = '%s (%s)' % (option.get('help'), ", ".join(option['values'])) | |
| 860 result.Add(name, help, default) | |
| 861 return True | |
| 862 | |
| 863 | |
| 815 def GetOptions(): | 864 def GetOptions(): | 
| 816 result = Options() | 865 result = Options() | 
| 817 result.Add('mode', 'compilation mode (debug, release)', 'release') | 866 result.Add('mode', 'compilation mode (debug, release)', 'release') | 
| 818 result.Add('sample', 'build sample (shell, process, lineprocessor)', '') | 867 result.Add('sample', 'build sample (shell, process, lineprocessor)', '') | 
| 819 result.Add('cache', 'directory to use for scons build cache', '') | 868 result.Add('cache', 'directory to use for scons build cache', '') | 
| 820 result.Add('env', 'override environment settings (NAME0:value0,NAME1:value1,.. .)', '') | 869 result.Add('env', 'override environment settings (NAME0:value0,NAME1:value1,.. .)', '') | 
| 821 result.Add('importenv', 'import environment settings (NAME0,NAME1,...)', '') | 870 result.Add('importenv', 'import environment settings (NAME0,NAME1,...)', '') | 
| 822 for (name, option) in SIMPLE_OPTIONS.iteritems(): | 871 options = SIMPLE_OPTIONS | 
| 823 help = '%s (%s)' % (name, ", ".join(option['values'])) | 872 while len(options): | 
| 
 
Vyacheslav Egorov (Chromium)
2011/03/29 11:59:33
Seems a bit too complicated for the current use ca
 
 | |
| 824 result.Add(name, help, option.get('default')) | 873 postpone = {} | 
| 874 for (name, option) in options.iteritems(): | |
| 875 if not AddOption(result, name, option): | |
| 876 postpone[name] = option | |
| 877 options = postpone | |
| 825 return result | 878 return result | 
| 826 | 879 | 
| 827 | 880 | 
| 881 def GetTools(opts): | |
| 882 env = Environment(options=opts) | |
| 883 os = env['os'] | |
| 884 toolchain = env['toolchain'] | |
| 885 if os == 'win32' and toolchain == 'gcc': | |
| 886 return ['mingw'] | |
| 887 elif os == 'win32' and toolchain == 'msvc': | |
| 888 return ['msvc', 'mslink', 'mslib', 'msvs'] | |
| 889 else: | |
| 890 return ['default'] | |
| 891 | |
| 892 | |
| 828 def GetVersionComponents(): | 893 def GetVersionComponents(): | 
| 829 MAJOR_VERSION_PATTERN = re.compile(r"#define\s+MAJOR_VERSION\s+(.*)") | 894 MAJOR_VERSION_PATTERN = re.compile(r"#define\s+MAJOR_VERSION\s+(.*)") | 
| 830 MINOR_VERSION_PATTERN = re.compile(r"#define\s+MINOR_VERSION\s+(.*)") | 895 MINOR_VERSION_PATTERN = re.compile(r"#define\s+MINOR_VERSION\s+(.*)") | 
| 831 BUILD_NUMBER_PATTERN = re.compile(r"#define\s+BUILD_NUMBER\s+(.*)") | 896 BUILD_NUMBER_PATTERN = re.compile(r"#define\s+BUILD_NUMBER\s+(.*)") | 
| 832 PATCH_LEVEL_PATTERN = re.compile(r"#define\s+PATCH_LEVEL\s+(.*)") | 897 PATCH_LEVEL_PATTERN = re.compile(r"#define\s+PATCH_LEVEL\s+(.*)") | 
| 833 | 898 | 
| 834 patterns = [MAJOR_VERSION_PATTERN, | 899 patterns = [MAJOR_VERSION_PATTERN, | 
| 835 MINOR_VERSION_PATTERN, | 900 MINOR_VERSION_PATTERN, | 
| 836 BUILD_NUMBER_PATTERN, | 901 BUILD_NUMBER_PATTERN, | 
| 837 PATCH_LEVEL_PATTERN] | 902 PATCH_LEVEL_PATTERN] | 
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 898 Abort("Shared Object soname not applicable for static library.") | 963 Abort("Shared Object soname not applicable for static library.") | 
| 899 if env['os'] != 'win32' and env['pgo'] != 'off': | 964 if env['os'] != 'win32' and env['pgo'] != 'off': | 
| 900 Abort("Profile guided optimization only supported on Windows.") | 965 Abort("Profile guided optimization only supported on Windows.") | 
| 901 if env['cache'] and not os.path.isdir(env['cache']): | 966 if env['cache'] and not os.path.isdir(env['cache']): | 
| 902 Abort("The specified cache directory does not exist.") | 967 Abort("The specified cache directory does not exist.") | 
| 903 if not (env['arch'] == 'arm' or env['simulator'] == 'arm') and ('unalignedacce sses' in ARGUMENTS): | 968 if not (env['arch'] == 'arm' or env['simulator'] == 'arm') and ('unalignedacce sses' in ARGUMENTS): | 
| 904 print env['arch'] | 969 print env['arch'] | 
| 905 print env['simulator'] | 970 print env['simulator'] | 
| 906 Abort("Option unalignedaccesses only supported for the ARM architecture.") | 971 Abort("Option unalignedaccesses only supported for the ARM architecture.") | 
| 907 for (name, option) in SIMPLE_OPTIONS.iteritems(): | 972 for (name, option) in SIMPLE_OPTIONS.iteritems(): | 
| 908 if (not option.get('default')) and (name not in ARGUMENTS): | 973 if (not name in env): | 
| 909 message = ("A value for option %s must be specified (%s)." % | 974 message = ("A value for option %s must be specified (%s)." % | 
| 910 (name, ", ".join(option['values']))) | 975 (name, ", ".join(option['values']))) | 
| 911 Abort(message) | 976 Abort(message) | 
| 912 if not env[name] in option['values']: | 977 if not env[name] in option['values']: | 
| 913 message = ("Unknown %s value '%s'. Possible values are (%s)." % | 978 message = ("Unknown %s value '%s'. Possible values are (%s)." % | 
| 914 (name, env[name], ", ".join(option['values']))) | 979 (name, env[name], ", ".join(option['values']))) | 
| 915 Abort(message) | 980 Abort(message) | 
| 916 | 981 | 
| 917 | 982 | 
| 918 class BuildContext(object): | 983 class BuildContext(object): | 
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1026 if var in os.environ: | 1091 if var in os.environ: | 
| 1027 overrides[var] = os.environ[var] | 1092 overrides[var] = os.environ[var] | 
| 1028 for override in arg.split(','): | 1093 for override in arg.split(','): | 
| 1029 pos = override.find(':') | 1094 pos = override.find(':') | 
| 1030 if pos == -1: | 1095 if pos == -1: | 
| 1031 continue | 1096 continue | 
| 1032 overrides[override[:pos].strip()] = override[pos+1:].strip() | 1097 overrides[override[:pos].strip()] = override[pos+1:].strip() | 
| 1033 return overrides | 1098 return overrides | 
| 1034 | 1099 | 
| 1035 | 1100 | 
| 1036 def BuildSpecific(env, mode, env_overrides): | 1101 def BuildSpecific(env, mode, env_overrides, tools): | 
| 1037 options = {'mode': mode} | 1102 options = {'mode': mode} | 
| 1038 for option in SIMPLE_OPTIONS: | 1103 for option in SIMPLE_OPTIONS: | 
| 1039 options[option] = env[option] | 1104 options[option] = env[option] | 
| 1040 PostprocessOptions(options, env['os']) | 1105 PostprocessOptions(options, env['os']) | 
| 1041 | 1106 | 
| 1042 context = BuildContext(options, env_overrides, samples=SplitList(env['sample'] )) | 1107 context = BuildContext(options, env_overrides, samples=SplitList(env['sample'] )) | 
| 1043 | 1108 | 
| 1044 # Remove variables which can't be imported from the user's external | 1109 # Remove variables which can't be imported from the user's external | 
| 1045 # environment into a construction environment. | 1110 # environment into a construction environment. | 
| 1046 user_environ = os.environ.copy() | 1111 user_environ = os.environ.copy() | 
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1079 if context.options['soname'] == 'on': | 1144 if context.options['soname'] == 'on': | 
| 1080 soname = GetSpecificSONAME() | 1145 soname = GetSpecificSONAME() | 
| 1081 if soname == '': | 1146 if soname == '': | 
| 1082 soname = 'lib' + library_name + '.so' | 1147 soname = 'lib' + library_name + '.so' | 
| 1083 env['SONAME'] = soname | 1148 env['SONAME'] = soname | 
| 1084 | 1149 | 
| 1085 # Build the object files by invoking SCons recursively. | 1150 # Build the object files by invoking SCons recursively. | 
| 1086 (object_files, shell_files, mksnapshot) = env.SConscript( | 1151 (object_files, shell_files, mksnapshot) = env.SConscript( | 
| 1087 join('src', 'SConscript'), | 1152 join('src', 'SConscript'), | 
| 1088 build_dir=join('obj', target_id), | 1153 build_dir=join('obj', target_id), | 
| 1089 exports='context', | 1154 exports='context tools', | 
| 1090 duplicate=False | 1155 duplicate=False | 
| 1091 ) | 1156 ) | 
| 1092 | 1157 | 
| 1093 context.mksnapshot_targets.append(mksnapshot) | 1158 context.mksnapshot_targets.append(mksnapshot) | 
| 1094 | 1159 | 
| 1095 # Link the object files into a library. | 1160 # Link the object files into a library. | 
| 1096 env.Replace(**context.flags['v8']) | 1161 env.Replace(**context.flags['v8']) | 
| 1097 | 1162 | 
| 1098 context.ApplyEnvOverrides(env) | 1163 context.ApplyEnvOverrides(env) | 
| 1099 if context.options['library'] == 'static': | 1164 if context.options['library'] == 'static': | 
| 1100 library = env.StaticLibrary(library_name, object_files) | 1165 library = env.StaticLibrary(library_name, object_files) | 
| 1101 else: | 1166 else: | 
| 1102 # There seems to be a glitch in the way scons decides where to put | 1167 # There seems to be a glitch in the way scons decides where to put | 
| 1103 # PDB files when compiling using MSVC so we specify it manually. | 1168 # PDB files when compiling using MSVC so we specify it manually. | 
| 1104 # This should not affect any other platforms. | 1169 # This should not affect any other platforms. | 
| 1105 pdb_name = library_name + '.dll.pdb' | 1170 pdb_name = library_name + '.dll.pdb' | 
| 1106 library = env.SharedLibrary(library_name, object_files, PDB=pdb_name) | 1171 library = env.SharedLibrary(library_name, object_files, PDB=pdb_name) | 
| 1107 context.library_targets.append(library) | 1172 context.library_targets.append(library) | 
| 1108 | 1173 | 
| 1109 d8_env = Environment() | 1174 d8_env = Environment(tools=tools) | 
| 1110 d8_env.Replace(**context.flags['d8']) | 1175 d8_env.Replace(**context.flags['d8']) | 
| 1111 context.ApplyEnvOverrides(d8_env) | 1176 context.ApplyEnvOverrides(d8_env) | 
| 1112 shell = d8_env.Program('d8' + suffix, object_files + shell_files) | 1177 shell = d8_env.Program('d8' + suffix, object_files + shell_files) | 
| 1113 context.d8_targets.append(shell) | 1178 context.d8_targets.append(shell) | 
| 1114 | 1179 | 
| 1115 for sample in context.samples: | 1180 for sample in context.samples: | 
| 1116 sample_env = Environment() | 1181 sample_env = Environment(tools=tools) | 
| 1117 sample_env.Replace(**context.flags['sample']) | 1182 sample_env.Replace(**context.flags['sample']) | 
| 1118 sample_env.Prepend(LIBS=[library_name]) | 1183 sample_env.Prepend(LIBS=[library_name]) | 
| 1119 context.ApplyEnvOverrides(sample_env) | 1184 context.ApplyEnvOverrides(sample_env) | 
| 1120 sample_object = sample_env.SConscript( | 1185 sample_object = sample_env.SConscript( | 
| 1121 join('samples', 'SConscript'), | 1186 join('samples', 'SConscript'), | 
| 1122 build_dir=join('obj', 'sample', sample, target_id), | 1187 build_dir=join('obj', 'sample', sample, target_id), | 
| 1123 exports='sample context', | 1188 exports='sample context tools', | 
| 1124 duplicate=False | 1189 duplicate=False | 
| 1125 ) | 1190 ) | 
| 1126 sample_name = sample + suffix | 1191 sample_name = sample + suffix | 
| 1127 sample_program = sample_env.Program(sample_name, sample_object) | 1192 sample_program = sample_env.Program(sample_name, sample_object) | 
| 1128 sample_env.Depends(sample_program, library) | 1193 sample_env.Depends(sample_program, library) | 
| 1129 context.sample_targets.append(sample_program) | 1194 context.sample_targets.append(sample_program) | 
| 1130 | 1195 | 
| 1131 cctest_env = env.Copy() | 1196 cctest_env = env.Copy() | 
| 1132 cctest_env.Prepend(LIBS=[library_name]) | 1197 cctest_env.Prepend(LIBS=[library_name]) | 
| 1133 cctest_program = cctest_env.SConscript( | 1198 cctest_program = cctest_env.SConscript( | 
| 1134 join('test', 'cctest', 'SConscript'), | 1199 join('test', 'cctest', 'SConscript'), | 
| 1135 build_dir=join('obj', 'test', target_id), | 1200 build_dir=join('obj', 'test', target_id), | 
| 1136 exports='context object_files', | 1201 exports='context object_files tools', | 
| 1137 duplicate=False | 1202 duplicate=False | 
| 1138 ) | 1203 ) | 
| 1139 context.cctest_targets.append(cctest_program) | 1204 context.cctest_targets.append(cctest_program) | 
| 1140 | 1205 | 
| 1141 return context | 1206 return context | 
| 1142 | 1207 | 
| 1143 | 1208 | 
| 1144 def Build(): | 1209 def Build(): | 
| 1145 opts = GetOptions() | 1210 opts = GetOptions() | 
| 1146 env = Environment(options=opts) | 1211 tools = GetTools(opts) | 
| 1212 env = Environment(options=opts, tools=tools) | |
| 1213 | |
| 1147 Help(opts.GenerateHelpText(env)) | 1214 Help(opts.GenerateHelpText(env)) | 
| 1148 VerifyOptions(env) | 1215 VerifyOptions(env) | 
| 1149 env_overrides = ParseEnvOverrides(env['env'], env['importenv']) | 1216 env_overrides = ParseEnvOverrides(env['env'], env['importenv']) | 
| 1150 | 1217 | 
| 1151 SourceSignatures(env['sourcesignatures']) | 1218 SourceSignatures(env['sourcesignatures']) | 
| 1152 | 1219 | 
| 1153 libraries = [] | 1220 libraries = [] | 
| 1154 mksnapshots = [] | 1221 mksnapshots = [] | 
| 1155 cctests = [] | 1222 cctests = [] | 
| 1156 samples = [] | 1223 samples = [] | 
| 1157 d8s = [] | 1224 d8s = [] | 
| 1158 modes = SplitList(env['mode']) | 1225 modes = SplitList(env['mode']) | 
| 1159 for mode in modes: | 1226 for mode in modes: | 
| 1160 context = BuildSpecific(env.Copy(), mode, env_overrides) | 1227 context = BuildSpecific(env.Copy(), mode, env_overrides, tools) | 
| 1161 libraries += context.library_targets | 1228 libraries += context.library_targets | 
| 1162 mksnapshots += context.mksnapshot_targets | 1229 mksnapshots += context.mksnapshot_targets | 
| 1163 cctests += context.cctest_targets | 1230 cctests += context.cctest_targets | 
| 1164 samples += context.sample_targets | 1231 samples += context.sample_targets | 
| 1165 d8s += context.d8_targets | 1232 d8s += context.d8_targets | 
| 1166 | 1233 | 
| 1167 env.Alias('library', libraries) | 1234 env.Alias('library', libraries) | 
| 1168 env.Alias('mksnapshot', mksnapshots) | 1235 env.Alias('mksnapshot', mksnapshots) | 
| 1169 env.Alias('cctests', cctests) | 1236 env.Alias('cctests', cctests) | 
| 1170 env.Alias('sample', samples) | 1237 env.Alias('sample', samples) | 
| (...skipping 12 matching lines...) Expand all Loading... | |
| 1183 # version of scons. Also, there's a bug in some revisions that | 1250 # version of scons. Also, there's a bug in some revisions that | 
| 1184 # doesn't allow this flag to be set, so we swallow any exceptions. | 1251 # doesn't allow this flag to be set, so we swallow any exceptions. | 
| 1185 # Lovely. | 1252 # Lovely. | 
| 1186 try: | 1253 try: | 
| 1187 SetOption('warn', 'no-deprecated') | 1254 SetOption('warn', 'no-deprecated') | 
| 1188 except: | 1255 except: | 
| 1189 pass | 1256 pass | 
| 1190 | 1257 | 
| 1191 | 1258 | 
| 1192 Build() | 1259 Build() | 
| OLD | NEW |