| 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 | |
| 31 import sys | 30 import sys |
| 32 import os | 31 import os |
| 33 from os.path import join, dirname, abspath | 32 from os.path import join, dirname, abspath |
| 34 from types import DictType, StringTypes | 33 from types import DictType, StringTypes |
| 35 root_dir = dirname(File('SConstruct').rfile().abspath) | 34 root_dir = dirname(File('SConstruct').rfile().abspath) |
| 36 sys.path.insert(0, join(root_dir, 'tools')) | 35 sys.path.insert(0, join(root_dir, 'tools')) |
| 37 import js2c, utils | 36 import js2c, utils |
| 38 | 37 |
| 39 # ANDROID_TOP is the top of the Android checkout, fetched from the environment | 38 # ANDROID_TOP is the top of the Android checkout, fetched from the environment |
| 40 # variable 'TOP'. You will also need to set the CXX, CC, AR and RANLIB | 39 # variable 'TOP'. You will also need to set the CXX, CC, AR and RANLIB |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 }, | 138 }, |
| 140 'gcc': { | 139 'gcc': { |
| 141 'all': { | 140 'all': { |
| 142 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], | 141 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], |
| 143 'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'], | 142 'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'], |
| 144 }, | 143 }, |
| 145 'visibility:hidden': { | 144 'visibility:hidden': { |
| 146 # Use visibility=default to disable this. | 145 # Use visibility=default to disable this. |
| 147 'CXXFLAGS': ['-fvisibility=hidden'] | 146 'CXXFLAGS': ['-fvisibility=hidden'] |
| 148 }, | 147 }, |
| 149 'strictaliasing:off': { | |
| 150 'CCFLAGS': ['-fno-strict-aliasing'] | |
| 151 }, | |
| 152 'mode:debug': { | 148 'mode:debug': { |
| 153 'CCFLAGS': ['-g', '-O0'], | 149 'CCFLAGS': ['-g', '-O0'], |
| 154 'CPPDEFINES': ['ENABLE_DISASSEMBLER', 'DEBUG'], | 150 'CPPDEFINES': ['ENABLE_DISASSEMBLER', 'DEBUG'], |
| 155 'os:android': { | 151 'os:android': { |
| 156 'CCFLAGS': ['-mthumb'] | 152 'CCFLAGS': ['-mthumb'] |
| 157 } | 153 } |
| 158 }, | 154 }, |
| 159 'mode:release': { | 155 'mode:release': { |
| 160 'CCFLAGS': ['-O3', '-fomit-frame-pointer', '-fdata-sections', | 156 'CCFLAGS': ['-O3', '-fomit-frame-pointer', '-fdata-sections', |
| 161 '-ffunction-sections'], | 157 '-ffunction-sections'], |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 'release': '', | 819 'release': '', |
| 824 'debug': '_g' | 820 'debug': '_g' |
| 825 } | 821 } |
| 826 | 822 |
| 827 | 823 |
| 828 def Abort(message): | 824 def Abort(message): |
| 829 print message | 825 print message |
| 830 sys.exit(1) | 826 sys.exit(1) |
| 831 | 827 |
| 832 | 828 |
| 833 def GuessOS(env): | 829 def GuessToolchain(os): |
| 834 return utils.GuessOS() | 830 tools = Environment()['TOOLS'] |
| 835 | |
| 836 | |
| 837 def GuessArch(env): | |
| 838 return utils.GuessArchitecture() | |
| 839 | |
| 840 | |
| 841 def GuessToolchain(env): | |
| 842 tools = env['TOOLS'] | |
| 843 if 'gcc' in tools: | 831 if 'gcc' in tools: |
| 844 return 'gcc' | 832 return 'gcc' |
| 845 elif 'msvc' in tools: | 833 elif 'msvc' in tools: |
| 846 return 'msvc' | 834 return 'msvc' |
| 847 else: | 835 else: |
| 848 return None | 836 return None |
| 849 | 837 |
| 850 | 838 |
| 851 def GuessVisibility(env): | 839 def GuessVisibility(os, toolchain): |
| 852 os = env['os'] | |
| 853 toolchain = env['toolchain']; | |
| 854 if (os == 'win32' or os == 'cygwin') and toolchain == 'gcc': | 840 if (os == 'win32' or os == 'cygwin') and toolchain == 'gcc': |
| 855 # MinGW / Cygwin can't do it. | 841 # MinGW / Cygwin can't do it. |
| 856 return 'default' | 842 return 'default' |
| 857 elif os == 'solaris': | 843 elif os == 'solaris': |
| 858 return 'default' | 844 return 'default' |
| 859 else: | 845 else: |
| 860 return 'hidden' | 846 return 'hidden' |
| 861 | 847 |
| 862 | 848 |
| 863 def GuessStrictAliasing(env): | 849 OS_GUESS = utils.GuessOS() |
| 864 # There seems to be a problem with gcc 4.5.x. | 850 TOOLCHAIN_GUESS = GuessToolchain(OS_GUESS) |
| 865 # See http://code.google.com/p/v8/issues/detail?id=884 | 851 ARCH_GUESS = utils.GuessArchitecture() |
| 866 # It can be worked around by disabling strict aliasing. | 852 VISIBILITY_GUESS = GuessVisibility(OS_GUESS, TOOLCHAIN_GUESS) |
| 867 toolchain = env['toolchain']; | |
| 868 if toolchain == 'gcc': | |
| 869 env = Environment(tools=['gcc']) | |
| 870 # The gcc version should be available in env['CCVERSION'], | |
| 871 # but when scons detects msvc this value is not set. | |
| 872 version = subprocess.Popen([env['CC'], '-dumpversion'], | |
| 873 stdout=subprocess.PIPE).communicate()[0] | |
| 874 if version.find('4.5') == 0: | |
| 875 return 'off' | |
| 876 return 'default' | |
| 877 | 853 |
| 878 | 854 |
| 879 PLATFORM_OPTIONS = { | 855 SIMPLE_OPTIONS = { |
| 880 'arch': { | 856 'toolchain': { |
| 881 'values': ['arm', 'ia32', 'x64', 'mips'], | 857 'values': ['gcc', 'msvc'], |
| 882 'guess': GuessArch, | 858 'default': TOOLCHAIN_GUESS, |
| 883 'help': 'the architecture to build for' | 859 'help': 'the toolchain to use (%s)' % TOOLCHAIN_GUESS |
| 884 }, | 860 }, |
| 885 'os': { | 861 'os': { |
| 886 'values': ['freebsd', 'linux', 'macos', 'win32', 'android', 'openbsd', 'sola
ris', 'cygwin'], | 862 'values': ['freebsd', 'linux', 'macos', 'win32', 'android', 'openbsd', 'sola
ris', 'cygwin'], |
| 887 'guess': GuessOS, | 863 'default': OS_GUESS, |
| 888 'help': 'the os to build for' | 864 'help': 'the os to build for (%s)' % OS_GUESS |
| 889 }, | 865 }, |
| 890 'toolchain': { | 866 'arch': { |
| 891 'values': ['gcc', 'msvc'], | 867 'values':['arm', 'ia32', 'x64', 'mips'], |
| 892 'guess': GuessToolchain, | 868 'default': ARCH_GUESS, |
| 893 'help': 'the toolchain to use' | 869 'help': 'the architecture to build for (%s)' % ARCH_GUESS |
| 894 } | 870 }, |
| 895 } | |
| 896 | |
| 897 SIMPLE_OPTIONS = { | |
| 898 'regexp': { | 871 'regexp': { |
| 899 'values': ['native', 'interpreted'], | 872 'values': ['native', 'interpreted'], |
| 900 'default': 'native', | 873 'default': 'native', |
| 901 'help': 'Whether to use native or interpreted regexp implementation' | 874 'help': 'Whether to use native or interpreted regexp implementation' |
| 902 }, | 875 }, |
| 903 'snapshot': { | 876 'snapshot': { |
| 904 'values': ['on', 'off', 'nobuild'], | 877 'values': ['on', 'off', 'nobuild'], |
| 905 'default': 'off', | 878 'default': 'off', |
| 906 'help': 'build using snapshots for faster start-up' | 879 'help': 'build using snapshots for faster start-up' |
| 907 }, | 880 }, |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1001 'default': 'dumb', | 974 'default': 'dumb', |
| 1002 'help': 'the console to use for the d8 shell' | 975 'help': 'the console to use for the d8 shell' |
| 1003 }, | 976 }, |
| 1004 'verbose': { | 977 'verbose': { |
| 1005 'values': ['on', 'off'], | 978 'values': ['on', 'off'], |
| 1006 'default': 'off', | 979 'default': 'off', |
| 1007 'help': 'more output from compiler and linker' | 980 'help': 'more output from compiler and linker' |
| 1008 }, | 981 }, |
| 1009 'visibility': { | 982 'visibility': { |
| 1010 'values': ['default', 'hidden'], | 983 'values': ['default', 'hidden'], |
| 1011 'guess': GuessVisibility, | 984 'default': VISIBILITY_GUESS, |
| 1012 'help': 'shared library symbol visibility' | 985 'help': 'shared library symbol visibility (%s)' % VISIBILITY_GUESS |
| 1013 }, | |
| 1014 'strictaliasing': { | |
| 1015 'values': ['default', 'off'], | |
| 1016 'guess': GuessStrictAliasing, | |
| 1017 'help': 'assume strict aliasing while optimizing' | |
| 1018 }, | 986 }, |
| 1019 'pgo': { | 987 'pgo': { |
| 1020 'values': ['off', 'instrument', 'optimize'], | 988 'values': ['off', 'instrument', 'optimize'], |
| 1021 'default': 'off', | 989 'default': 'off', |
| 1022 'help': 'select profile guided optimization variant', | 990 'help': 'select profile guided optimization variant', |
| 1023 }, | 991 }, |
| 1024 'mipsabi': { | 992 'mipsabi': { |
| 1025 'values': ['hardfloat', 'softfloat', 'none'], | 993 'values': ['hardfloat', 'softfloat', 'none'], |
| 1026 'default': 'hardfloat', | 994 'default': 'hardfloat', |
| 1027 'help': 'generate calling conventiont according to selected mips ABI' | 995 'help': 'generate calling conventiont according to selected mips ABI' |
| 1028 }, | 996 }, |
| 1029 'mips_arch_variant': { | 997 'mips_arch_variant': { |
| 1030 'values': ['mips32r2', 'mips32r1'], | 998 'values': ['mips32r2', 'mips32r1'], |
| 1031 'default': 'mips32r2', | 999 'default': 'mips32r2', |
| 1032 'help': 'mips variant' | 1000 'help': 'mips variant' |
| 1033 } | 1001 } |
| 1034 } | 1002 } |
| 1035 | 1003 |
| 1036 ALL_OPTIONS = dict(PLATFORM_OPTIONS, **SIMPLE_OPTIONS) | |
| 1037 | |
| 1038 | |
| 1039 def AddOptions(options, result): | |
| 1040 guess_env = Environment(options=result) | |
| 1041 for (name, option) in options.iteritems(): | |
| 1042 if 'guess' in option: | |
| 1043 # Option has a guess function | |
| 1044 guess = option.get('guess') | |
| 1045 default = guess(guess_env) | |
| 1046 else: | |
| 1047 # Option has a fixed default | |
| 1048 default = option.get('default') | |
| 1049 help = '%s (%s)' % (option.get('help'), ", ".join(option['values'])) | |
| 1050 result.Add(name, help, default) | |
| 1051 | |
| 1052 | 1004 |
| 1053 def GetOptions(): | 1005 def GetOptions(): |
| 1054 result = Options() | 1006 result = Options() |
| 1055 result.Add('mode', 'compilation mode (debug, release)', 'release') | 1007 result.Add('mode', 'compilation mode (debug, release)', 'release') |
| 1056 result.Add('sample', 'build sample (shell, process, lineprocessor)', '') | 1008 result.Add('sample', 'build sample (shell, process, lineprocessor)', '') |
| 1057 result.Add('cache', 'directory to use for scons build cache', '') | 1009 result.Add('cache', 'directory to use for scons build cache', '') |
| 1058 result.Add('env', 'override environment settings (NAME0:value0,NAME1:value1,..
.)', '') | 1010 result.Add('env', 'override environment settings (NAME0:value0,NAME1:value1,..
.)', '') |
| 1059 result.Add('importenv', 'import environment settings (NAME0,NAME1,...)', '') | 1011 result.Add('importenv', 'import environment settings (NAME0,NAME1,...)', '') |
| 1060 AddOptions(PLATFORM_OPTIONS, result) | 1012 for (name, option) in SIMPLE_OPTIONS.iteritems(): |
| 1061 AddOptions(SIMPLE_OPTIONS, result) | 1013 help = '%s (%s)' % (name, ", ".join(option['values'])) |
| 1014 result.Add(name, help, option.get('default')) |
| 1062 return result | 1015 return result |
| 1063 | 1016 |
| 1064 | 1017 |
| 1065 def GetTools(opts): | |
| 1066 env = Environment(options=opts) | |
| 1067 os = env['os'] | |
| 1068 toolchain = env['toolchain'] | |
| 1069 if os == 'win32' and toolchain == 'gcc': | |
| 1070 return ['mingw'] | |
| 1071 elif os == 'win32' and toolchain == 'msvc': | |
| 1072 return ['msvc', 'mslink', 'mslib', 'msvs'] | |
| 1073 else: | |
| 1074 return ['default'] | |
| 1075 | |
| 1076 | |
| 1077 def GetVersionComponents(): | 1018 def GetVersionComponents(): |
| 1078 MAJOR_VERSION_PATTERN = re.compile(r"#define\s+MAJOR_VERSION\s+(.*)") | 1019 MAJOR_VERSION_PATTERN = re.compile(r"#define\s+MAJOR_VERSION\s+(.*)") |
| 1079 MINOR_VERSION_PATTERN = re.compile(r"#define\s+MINOR_VERSION\s+(.*)") | 1020 MINOR_VERSION_PATTERN = re.compile(r"#define\s+MINOR_VERSION\s+(.*)") |
| 1080 BUILD_NUMBER_PATTERN = re.compile(r"#define\s+BUILD_NUMBER\s+(.*)") | 1021 BUILD_NUMBER_PATTERN = re.compile(r"#define\s+BUILD_NUMBER\s+(.*)") |
| 1081 PATCH_LEVEL_PATTERN = re.compile(r"#define\s+PATCH_LEVEL\s+(.*)") | 1022 PATCH_LEVEL_PATTERN = re.compile(r"#define\s+PATCH_LEVEL\s+(.*)") |
| 1082 | 1023 |
| 1083 patterns = [MAJOR_VERSION_PATTERN, | 1024 patterns = [MAJOR_VERSION_PATTERN, |
| 1084 MINOR_VERSION_PATTERN, | 1025 MINOR_VERSION_PATTERN, |
| 1085 BUILD_NUMBER_PATTERN, | 1026 BUILD_NUMBER_PATTERN, |
| 1086 PATCH_LEVEL_PATTERN] | 1027 PATCH_LEVEL_PATTERN] |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 if env['soname'] == 'on' and env['library'] == 'static': | 1087 if env['soname'] == 'on' and env['library'] == 'static': |
| 1147 Abort("Shared Object soname not applicable for static library.") | 1088 Abort("Shared Object soname not applicable for static library.") |
| 1148 if env['os'] != 'win32' and env['pgo'] != 'off': | 1089 if env['os'] != 'win32' and env['pgo'] != 'off': |
| 1149 Abort("Profile guided optimization only supported on Windows.") | 1090 Abort("Profile guided optimization only supported on Windows.") |
| 1150 if env['cache'] and not os.path.isdir(env['cache']): | 1091 if env['cache'] and not os.path.isdir(env['cache']): |
| 1151 Abort("The specified cache directory does not exist.") | 1092 Abort("The specified cache directory does not exist.") |
| 1152 if not (env['arch'] == 'arm' or env['simulator'] == 'arm') and ('unalignedacce
sses' in ARGUMENTS): | 1093 if not (env['arch'] == 'arm' or env['simulator'] == 'arm') and ('unalignedacce
sses' in ARGUMENTS): |
| 1153 print env['arch'] | 1094 print env['arch'] |
| 1154 print env['simulator'] | 1095 print env['simulator'] |
| 1155 Abort("Option unalignedaccesses only supported for the ARM architecture.") | 1096 Abort("Option unalignedaccesses only supported for the ARM architecture.") |
| 1156 for (name, option) in ALL_OPTIONS.iteritems(): | 1097 for (name, option) in SIMPLE_OPTIONS.iteritems(): |
| 1157 if (not name in env): | 1098 if (not option.get('default')) and (name not in ARGUMENTS): |
| 1158 message = ("A value for option %s must be specified (%s)." % | 1099 message = ("A value for option %s must be specified (%s)." % |
| 1159 (name, ", ".join(option['values']))) | 1100 (name, ", ".join(option['values']))) |
| 1160 Abort(message) | 1101 Abort(message) |
| 1161 if not env[name] in option['values']: | 1102 if not env[name] in option['values']: |
| 1162 message = ("Unknown %s value '%s'. Possible values are (%s)." % | 1103 message = ("Unknown %s value '%s'. Possible values are (%s)." % |
| 1163 (name, env[name], ", ".join(option['values']))) | 1104 (name, env[name], ", ".join(option['values']))) |
| 1164 Abort(message) | 1105 Abort(message) |
| 1165 | 1106 |
| 1166 | 1107 |
| 1167 class BuildContext(object): | 1108 class BuildContext(object): |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1277 if var in os.environ: | 1218 if var in os.environ: |
| 1278 overrides[var] = os.environ[var] | 1219 overrides[var] = os.environ[var] |
| 1279 for override in arg.split(','): | 1220 for override in arg.split(','): |
| 1280 pos = override.find(':') | 1221 pos = override.find(':') |
| 1281 if pos == -1: | 1222 if pos == -1: |
| 1282 continue | 1223 continue |
| 1283 overrides[override[:pos].strip()] = override[pos+1:].strip() | 1224 overrides[override[:pos].strip()] = override[pos+1:].strip() |
| 1284 return overrides | 1225 return overrides |
| 1285 | 1226 |
| 1286 | 1227 |
| 1287 def BuildSpecific(env, mode, env_overrides, tools): | 1228 def BuildSpecific(env, mode, env_overrides): |
| 1288 options = {'mode': mode} | 1229 options = {'mode': mode} |
| 1289 for option in ALL_OPTIONS: | 1230 for option in SIMPLE_OPTIONS: |
| 1290 options[option] = env[option] | 1231 options[option] = env[option] |
| 1291 PostprocessOptions(options, env['os']) | 1232 PostprocessOptions(options, env['os']) |
| 1292 | 1233 |
| 1293 context = BuildContext(options, env_overrides, samples=SplitList(env['sample']
)) | 1234 context = BuildContext(options, env_overrides, samples=SplitList(env['sample']
)) |
| 1294 | 1235 |
| 1295 # Remove variables which can't be imported from the user's external | 1236 # Remove variables which can't be imported from the user's external |
| 1296 # environment into a construction environment. | 1237 # environment into a construction environment. |
| 1297 user_environ = os.environ.copy() | 1238 user_environ = os.environ.copy() |
| 1298 try: | 1239 try: |
| 1299 del user_environ['ENV'] | 1240 del user_environ['ENV'] |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1333 if context.options['soname'] == 'on': | 1274 if context.options['soname'] == 'on': |
| 1334 soname = GetSpecificSONAME() | 1275 soname = GetSpecificSONAME() |
| 1335 if soname == '': | 1276 if soname == '': |
| 1336 soname = 'lib' + library_name + '.so' | 1277 soname = 'lib' + library_name + '.so' |
| 1337 env['SONAME'] = soname | 1278 env['SONAME'] = soname |
| 1338 | 1279 |
| 1339 # Build the object files by invoking SCons recursively. | 1280 # Build the object files by invoking SCons recursively. |
| 1340 (object_files, shell_files, mksnapshot, preparser_files) = env.SConscript( | 1281 (object_files, shell_files, mksnapshot, preparser_files) = env.SConscript( |
| 1341 join('src', 'SConscript'), | 1282 join('src', 'SConscript'), |
| 1342 build_dir=join('obj', target_id), | 1283 build_dir=join('obj', target_id), |
| 1343 exports='context tools', | 1284 exports='context', |
| 1344 duplicate=False | 1285 duplicate=False |
| 1345 ) | 1286 ) |
| 1346 | 1287 |
| 1347 context.mksnapshot_targets.append(mksnapshot) | 1288 context.mksnapshot_targets.append(mksnapshot) |
| 1348 | 1289 |
| 1349 # Link the object files into a library. | 1290 # Link the object files into a library. |
| 1350 env.Replace(**context.flags['v8']) | 1291 env.Replace(**context.flags['v8']) |
| 1351 | 1292 |
| 1352 context.ApplyEnvOverrides(env) | 1293 context.ApplyEnvOverrides(env) |
| 1353 if context.options['library'] == 'static': | 1294 if context.options['library'] == 'static': |
| 1354 library = env.StaticLibrary(library_name, object_files) | 1295 library = env.StaticLibrary(library_name, object_files) |
| 1355 preparser_library = env.StaticLibrary(preparser_library_name, | 1296 preparser_library = env.StaticLibrary(preparser_library_name, |
| 1356 preparser_files) | 1297 preparser_files) |
| 1357 else: | 1298 else: |
| 1358 # There seems to be a glitch in the way scons decides where to put | 1299 # There seems to be a glitch in the way scons decides where to put |
| 1359 # PDB files when compiling using MSVC so we specify it manually. | 1300 # PDB files when compiling using MSVC so we specify it manually. |
| 1360 # This should not affect any other platforms. | 1301 # This should not affect any other platforms. |
| 1361 pdb_name = library_name + '.dll.pdb' | 1302 pdb_name = library_name + '.dll.pdb' |
| 1362 library = env.SharedLibrary(library_name, object_files, PDB=pdb_name) | 1303 library = env.SharedLibrary(library_name, object_files, PDB=pdb_name) |
| 1363 preparser_pdb_name = preparser_library_name + '.dll.pdb'; | 1304 preparser_pdb_name = preparser_library_name + '.dll.pdb'; |
| 1364 preparser_library = env.SharedLibrary(preparser_library_name, | 1305 preparser_library = env.SharedLibrary(preparser_library_name, |
| 1365 preparser_files, | 1306 preparser_files, |
| 1366 PDB=preparser_pdb_name) | 1307 PDB=preparser_pdb_name) |
| 1367 context.library_targets.append(library) | 1308 context.library_targets.append(library) |
| 1368 context.library_targets.append(preparser_library) | 1309 context.library_targets.append(preparser_library) |
| 1369 | 1310 |
| 1370 d8_env = Environment(tools=tools) | 1311 d8_env = Environment() |
| 1371 d8_env.Replace(**context.flags['d8']) | 1312 d8_env.Replace(**context.flags['d8']) |
| 1372 context.ApplyEnvOverrides(d8_env) | 1313 context.ApplyEnvOverrides(d8_env) |
| 1373 shell = d8_env.Program('d8' + suffix, object_files + shell_files) | 1314 shell = d8_env.Program('d8' + suffix, object_files + shell_files) |
| 1374 context.d8_targets.append(shell) | 1315 context.d8_targets.append(shell) |
| 1375 | 1316 |
| 1376 for sample in context.samples: | 1317 for sample in context.samples: |
| 1377 sample_env = Environment(tools=tools) | 1318 sample_env = Environment() |
| 1378 sample_env.Replace(**context.flags['sample']) | 1319 sample_env.Replace(**context.flags['sample']) |
| 1379 sample_env.Prepend(LIBS=[library_name]) | 1320 sample_env.Prepend(LIBS=[library_name]) |
| 1380 context.ApplyEnvOverrides(sample_env) | 1321 context.ApplyEnvOverrides(sample_env) |
| 1381 sample_object = sample_env.SConscript( | 1322 sample_object = sample_env.SConscript( |
| 1382 join('samples', 'SConscript'), | 1323 join('samples', 'SConscript'), |
| 1383 build_dir=join('obj', 'sample', sample, target_id), | 1324 build_dir=join('obj', 'sample', sample, target_id), |
| 1384 exports='sample context tools', | 1325 exports='sample context', |
| 1385 duplicate=False | 1326 duplicate=False |
| 1386 ) | 1327 ) |
| 1387 sample_name = sample + suffix | 1328 sample_name = sample + suffix |
| 1388 sample_program = sample_env.Program(sample_name, sample_object) | 1329 sample_program = sample_env.Program(sample_name, sample_object) |
| 1389 sample_env.Depends(sample_program, library) | 1330 sample_env.Depends(sample_program, library) |
| 1390 context.sample_targets.append(sample_program) | 1331 context.sample_targets.append(sample_program) |
| 1391 | 1332 |
| 1392 cctest_env = env.Copy() | 1333 cctest_env = env.Copy() |
| 1393 cctest_env.Prepend(LIBS=[library_name]) | 1334 cctest_env.Prepend(LIBS=[library_name]) |
| 1394 cctest_program = cctest_env.SConscript( | 1335 cctest_program = cctest_env.SConscript( |
| 1395 join('test', 'cctest', 'SConscript'), | 1336 join('test', 'cctest', 'SConscript'), |
| 1396 build_dir=join('obj', 'test', target_id), | 1337 build_dir=join('obj', 'test', target_id), |
| 1397 exports='context object_files tools', | 1338 exports='context object_files', |
| 1398 duplicate=False | 1339 duplicate=False |
| 1399 ) | 1340 ) |
| 1400 context.cctest_targets.append(cctest_program) | 1341 context.cctest_targets.append(cctest_program) |
| 1401 | 1342 |
| 1402 preparser_env = env.Copy() | 1343 preparser_env = env.Copy() |
| 1403 preparser_env.Replace(**context.flags['preparser']) | 1344 preparser_env.Replace(**context.flags['preparser']) |
| 1404 preparser_env.Prepend(LIBS=[preparser_library_name]) | 1345 preparser_env.Prepend(LIBS=[preparser_library_name]) |
| 1405 context.ApplyEnvOverrides(preparser_env) | 1346 context.ApplyEnvOverrides(preparser_env) |
| 1406 preparser_object = preparser_env.SConscript( | 1347 preparser_object = preparser_env.SConscript( |
| 1407 join('preparser', 'SConscript'), | 1348 join('preparser', 'SConscript'), |
| 1408 build_dir=join('obj', 'preparser', target_id), | 1349 build_dir=join('obj', 'preparser', target_id), |
| 1409 exports='context', | 1350 exports='context', |
| 1410 duplicate=False | 1351 duplicate=False |
| 1411 ) | 1352 ) |
| 1412 preparser_name = join('obj', 'preparser', target_id, 'preparser') | 1353 preparser_name = join('obj', 'preparser', target_id, 'preparser' + suffix) |
| 1413 preparser_program = preparser_env.Program(preparser_name, preparser_object); | 1354 preparser_program = preparser_env.Program(preparser_name, preparser_object); |
| 1414 preparser_env.Depends(preparser_program, preparser_library) | 1355 preparser_env.Depends(preparser_program, preparser_library) |
| 1415 context.preparser_targets.append(preparser_program) | 1356 context.preparser_targets.append(preparser_program) |
| 1416 | 1357 |
| 1417 return context | 1358 return context |
| 1418 | 1359 |
| 1419 | 1360 |
| 1420 def Build(): | 1361 def Build(): |
| 1421 opts = GetOptions() | 1362 opts = GetOptions() |
| 1422 tools = GetTools(opts) | 1363 env = Environment(options=opts) |
| 1423 env = Environment(options=opts, tools=tools) | |
| 1424 | |
| 1425 Help(opts.GenerateHelpText(env)) | 1364 Help(opts.GenerateHelpText(env)) |
| 1426 VerifyOptions(env) | 1365 VerifyOptions(env) |
| 1427 env_overrides = ParseEnvOverrides(env['env'], env['importenv']) | 1366 env_overrides = ParseEnvOverrides(env['env'], env['importenv']) |
| 1428 | 1367 |
| 1429 SourceSignatures(env['sourcesignatures']) | 1368 SourceSignatures(env['sourcesignatures']) |
| 1430 | 1369 |
| 1431 libraries = [] | 1370 libraries = [] |
| 1432 mksnapshots = [] | 1371 mksnapshots = [] |
| 1433 cctests = [] | 1372 cctests = [] |
| 1434 samples = [] | 1373 samples = [] |
| 1435 preparsers = [] | 1374 preparsers = [] |
| 1436 d8s = [] | 1375 d8s = [] |
| 1437 modes = SplitList(env['mode']) | 1376 modes = SplitList(env['mode']) |
| 1438 for mode in modes: | 1377 for mode in modes: |
| 1439 context = BuildSpecific(env.Copy(), mode, env_overrides, tools) | 1378 context = BuildSpecific(env.Copy(), mode, env_overrides) |
| 1440 libraries += context.library_targets | 1379 libraries += context.library_targets |
| 1441 mksnapshots += context.mksnapshot_targets | 1380 mksnapshots += context.mksnapshot_targets |
| 1442 cctests += context.cctest_targets | 1381 cctests += context.cctest_targets |
| 1443 samples += context.sample_targets | 1382 samples += context.sample_targets |
| 1444 preparsers += context.preparser_targets | 1383 preparsers += context.preparser_targets |
| 1445 d8s += context.d8_targets | 1384 d8s += context.d8_targets |
| 1446 | 1385 |
| 1447 env.Alias('library', libraries) | 1386 env.Alias('library', libraries) |
| 1448 env.Alias('mksnapshot', mksnapshots) | 1387 env.Alias('mksnapshot', mksnapshots) |
| 1449 env.Alias('cctests', cctests) | 1388 env.Alias('cctests', cctests) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1464 # version of scons. Also, there's a bug in some revisions that | 1403 # version of scons. Also, there's a bug in some revisions that |
| 1465 # doesn't allow this flag to be set, so we swallow any exceptions. | 1404 # doesn't allow this flag to be set, so we swallow any exceptions. |
| 1466 # Lovely. | 1405 # Lovely. |
| 1467 try: | 1406 try: |
| 1468 SetOption('warn', 'no-deprecated') | 1407 SetOption('warn', 'no-deprecated') |
| 1469 except: | 1408 except: |
| 1470 pass | 1409 pass |
| 1471 | 1410 |
| 1472 | 1411 |
| 1473 Build() | 1412 Build() |
| OLD | NEW |