wok-6.x diff node/stuff/SConstruct @ rev 17325
e2tools: update bdeps
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Nov 04 21:14:04 2014 +0100 (2014-11-04) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/node/stuff/SConstruct Tue Nov 04 21:14:04 2014 +0100 1.3 @@ -0,0 +1,1636 @@ 1.4 +# Copyright 2012 the V8 project authors. All rights reserved. 1.5 +# Redistribution and use in source and binary forms, with or without 1.6 +# modification, are permitted provided that the following conditions are 1.7 +# met: 1.8 +# 1.9 +# * Redistributions of source code must retain the above copyright 1.10 +# notice, this list of conditions and the following disclaimer. 1.11 +# * Redistributions in binary form must reproduce the above 1.12 +# copyright notice, this list of conditions and the following 1.13 +# disclaimer in the documentation and/or other materials provided 1.14 +# with the distribution. 1.15 +# * Neither the name of Google Inc. nor the names of its 1.16 +# contributors may be used to endorse or promote products derived 1.17 +# from this software without specific prior written permission. 1.18 +# 1.19 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1.20 +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1.21 +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1.22 +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 1.23 +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1.24 +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 1.25 +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 1.26 +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 1.27 +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 1.28 +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 1.29 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1.30 + 1.31 +import platform 1.32 +import re 1.33 +import subprocess 1.34 +import sys 1.35 +import os 1.36 +from os.path import join, dirname, abspath 1.37 +from types import DictType, StringTypes 1.38 +root_dir = dirname(File('SConstruct').rfile().abspath) 1.39 +src_dir = join(root_dir, 'src') 1.40 +sys.path.insert(0, join(root_dir, 'tools')) 1.41 +import js2c, utils 1.42 + 1.43 +# ARM_TARGET_LIB is the path to the dynamic library to use on the target 1.44 +# machine if cross-compiling to an arm machine. You will also need to set 1.45 +# the additional cross-compiling environment variables to the cross compiler. 1.46 +ARM_TARGET_LIB = os.environ.get('ARM_TARGET_LIB') 1.47 +if ARM_TARGET_LIB: 1.48 + ARM_LINK_FLAGS = ['-Wl,-rpath=' + ARM_TARGET_LIB + '/lib:' + 1.49 + ARM_TARGET_LIB + '/usr/lib', 1.50 + '-Wl,--dynamic-linker=' + ARM_TARGET_LIB + 1.51 + '/lib/ld-linux.so.3'] 1.52 +else: 1.53 + ARM_LINK_FLAGS = [] 1.54 + 1.55 +GCC_EXTRA_CCFLAGS = [] 1.56 +GCC_DTOA_EXTRA_CCFLAGS = [] 1.57 + 1.58 +LIBRARY_FLAGS = { 1.59 + 'all': { 1.60 + 'CPPPATH': [src_dir], 1.61 + 'regexp:interpreted': { 1.62 + 'CPPDEFINES': ['V8_INTERPRETED_REGEXP'] 1.63 + }, 1.64 + 'mode:debug': { 1.65 + 'CPPDEFINES': ['V8_ENABLE_CHECKS', 'OBJECT_PRINT', 'VERIFY_HEAP'] 1.66 + }, 1.67 + 'objectprint:on': { 1.68 + 'CPPDEFINES': ['OBJECT_PRINT'], 1.69 + }, 1.70 + 'debuggersupport:on': { 1.71 + 'CPPDEFINES': ['ENABLE_DEBUGGER_SUPPORT'], 1.72 + }, 1.73 + 'inspector:on': { 1.74 + 'CPPDEFINES': ['INSPECTOR'], 1.75 + }, 1.76 + 'fasttls:off': { 1.77 + 'CPPDEFINES': ['V8_NO_FAST_TLS'], 1.78 + }, 1.79 + 'liveobjectlist:on': { 1.80 + 'CPPDEFINES': ['ENABLE_DEBUGGER_SUPPORT', 'INSPECTOR', 1.81 + 'LIVE_OBJECT_LIST', 'OBJECT_PRINT'], 1.82 + } 1.83 + }, 1.84 + 'gcc': { 1.85 + 'all': { 1.86 + 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS', '-march=armv6'], 1.87 + 'CXXFLAGS': ['-fno-rtti', '-fno-exceptions', '-march=armv6'], 1.88 + }, 1.89 + 'visibility:hidden': { 1.90 + # Use visibility=default to disable this. 1.91 + 'CXXFLAGS': ['-fvisibility=hidden'] 1.92 + }, 1.93 + 'strictaliasing:off': { 1.94 + 'CCFLAGS': ['-fno-strict-aliasing'] 1.95 + }, 1.96 + 'mode:debug': { 1.97 + 'CCFLAGS': ['-g', '-O0'], 1.98 + 'CPPDEFINES': ['ENABLE_DISASSEMBLER', 'DEBUG'], 1.99 + }, 1.100 + 'mode:release': { 1.101 + 'CCFLAGS': ['-O3', '-fomit-frame-pointer', '-fdata-sections', 1.102 + '-ffunction-sections'], 1.103 + }, 1.104 + 'os:linux': { 1.105 + 'CCFLAGS': ['-ansi'] + GCC_EXTRA_CCFLAGS, 1.106 + 'library:shared': { 1.107 + 'CPPDEFINES': ['V8_SHARED', 'BUILDING_V8_SHARED'], 1.108 + 'LIBS': ['pthread'] 1.109 + } 1.110 + }, 1.111 + 'os:macos': { 1.112 + 'CCFLAGS': ['-ansi', '-mmacosx-version-min=10.4'], 1.113 + 'library:shared': { 1.114 + 'CPPDEFINES': ['V8_SHARED', 'BUILDING_V8_SHARED'], 1.115 + } 1.116 + }, 1.117 + 'os:freebsd': { 1.118 + 'CPPPATH' : [src_dir, '/usr/local/include'], 1.119 + 'LIBPATH' : ['/usr/local/lib'], 1.120 + 'CCFLAGS': ['-ansi'], 1.121 + 'LIBS': ['execinfo'] 1.122 + }, 1.123 + 'os:openbsd': { 1.124 + 'CPPPATH' : [src_dir, '/usr/local/include'], 1.125 + 'LIBPATH' : ['/usr/local/lib'], 1.126 + 'CCFLAGS': ['-ansi'], 1.127 + }, 1.128 + 'os:solaris': { 1.129 + # On Solaris, to get isinf, INFINITY, fpclassify and other macros one 1.130 + # needs to define __C99FEATURES__. 1.131 + 'CPPDEFINES': ['__C99FEATURES__'], 1.132 + 'CPPPATH' : [src_dir, '/usr/local/include'], 1.133 + 'LIBPATH' : ['/usr/local/lib'], 1.134 + 'CCFLAGS': ['-ansi'], 1.135 + }, 1.136 + 'os:netbsd': { 1.137 + 'CPPPATH' : [src_dir, '/usr/pkg/include'], 1.138 + 'LIBPATH' : ['/usr/pkg/lib'], 1.139 + }, 1.140 + 'os:win32': { 1.141 + 'CCFLAGS': ['-DWIN32'], 1.142 + 'CXXFLAGS': ['-DWIN32'], 1.143 + }, 1.144 + 'arch:ia32': { 1.145 + 'CPPDEFINES': ['V8_TARGET_ARCH_IA32'], 1.146 + 'CCFLAGS': ['-m32'], 1.147 + 'LINKFLAGS': ['-m32'] 1.148 + }, 1.149 + 'arch:arm': { 1.150 + 'CPPDEFINES': ['V8_TARGET_ARCH_ARM'], 1.151 + 'unalignedaccesses:on' : { 1.152 + 'CPPDEFINES' : ['CAN_USE_UNALIGNED_ACCESSES=1'] 1.153 + }, 1.154 + 'unalignedaccesses:off' : { 1.155 + 'CPPDEFINES' : ['CAN_USE_UNALIGNED_ACCESSES=0'] 1.156 + }, 1.157 + 'armeabi:soft' : { 1.158 + 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'], 1.159 + 'simulator:none': { 1.160 + 'CCFLAGS': ['-mfloat-abi=soft'], 1.161 + } 1.162 + }, 1.163 + 'armeabi:softfp' : { 1.164 + 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'], 1.165 + 'vfp3:on': { 1.166 + 'CPPDEFINES' : ['CAN_USE_VFP_INSTRUCTIONS'] 1.167 + }, 1.168 + 'simulator:none': { 1.169 + 'CCFLAGS': ['-mfloat-abi=softfp'], 1.170 + } 1.171 + }, 1.172 + 'armeabi:hard' : { 1.173 + 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=1'], 1.174 + 'vfp3:on': { 1.175 + 'CPPDEFINES' : ['CAN_USE_VFP_INSTRUCTIONS'] 1.176 + }, 1.177 + 'simulator:none': { 1.178 + 'CCFLAGS': ['-mfloat-abi=hard'], 1.179 + } 1.180 + } 1.181 + }, 1.182 + 'simulator:arm': { 1.183 + 'CCFLAGS': ['-m32'], 1.184 + 'LINKFLAGS': ['-m32'], 1.185 + }, 1.186 + 'arch:mips': { 1.187 + 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'], 1.188 + 'mips_arch_variant:mips32r2': { 1.189 + 'CPPDEFINES': ['_MIPS_ARCH_MIPS32R2'] 1.190 + }, 1.191 + 'mips_arch_variant:loongson': { 1.192 + 'CPPDEFINES': ['_MIPS_ARCH_LOONGSON'] 1.193 + }, 1.194 + 'simulator:none': { 1.195 + 'CCFLAGS': ['-EL'], 1.196 + 'LINKFLAGS': ['-EL'], 1.197 + 'mips_arch_variant:mips32r2': { 1.198 + 'CCFLAGS': ['-mips32r2', '-Wa,-mips32r2'] 1.199 + }, 1.200 + 'mips_arch_variant:mips32r1': { 1.201 + 'CCFLAGS': ['-mips32', '-Wa,-mips32'] 1.202 + }, 1.203 + 'mips_arch_variant:loongson': { 1.204 + 'CCFLAGS': ['-march=mips3', '-Wa,-march=mips3'] 1.205 + }, 1.206 + 'library:static': { 1.207 + 'LINKFLAGS': ['-static', '-static-libgcc'] 1.208 + }, 1.209 + 'mipsabi:softfloat': { 1.210 + 'CCFLAGS': ['-msoft-float'], 1.211 + 'LINKFLAGS': ['-msoft-float'] 1.212 + }, 1.213 + 'mipsabi:hardfloat': { 1.214 + 'CCFLAGS': ['-mhard-float'], 1.215 + 'LINKFLAGS': ['-mhard-float'] 1.216 + } 1.217 + } 1.218 + }, 1.219 + 'simulator:mips': { 1.220 + 'CCFLAGS': ['-m32'], 1.221 + 'LINKFLAGS': ['-m32'], 1.222 + 'mipsabi:softfloat': { 1.223 + 'CPPDEFINES': ['__mips_soft_float=1'], 1.224 + 'fpu:on': { 1.225 + 'CPPDEFINES' : ['CAN_USE_FPU_INSTRUCTIONS'] 1.226 + } 1.227 + }, 1.228 + 'mipsabi:hardfloat': { 1.229 + 'CPPDEFINES': ['__mips_hard_float=1', 'CAN_USE_FPU_INSTRUCTIONS'], 1.230 + } 1.231 + }, 1.232 + 'arch:x64': { 1.233 + 'CPPDEFINES': ['V8_TARGET_ARCH_X64'], 1.234 + 'CCFLAGS': ['-m64'], 1.235 + 'LINKFLAGS': ['-m64'], 1.236 + }, 1.237 + 'gdbjit:on': { 1.238 + 'CPPDEFINES': ['ENABLE_GDB_JIT_INTERFACE'] 1.239 + }, 1.240 + 'compress_startup_data:bz2': { 1.241 + 'CPPDEFINES': ['COMPRESS_STARTUP_DATA_BZ2'] 1.242 + } 1.243 + }, 1.244 + 'msvc': { 1.245 + 'all': { 1.246 + 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], 1.247 + 'CXXFLAGS': ['/GR-', '/Gy'], 1.248 + 'CPPDEFINES': ['WIN32'], 1.249 + 'LINKFLAGS': ['/INCREMENTAL:NO', '/NXCOMPAT', '/IGNORE:4221'], 1.250 + 'CCPDBFLAGS': ['/Zi'] 1.251 + }, 1.252 + 'verbose:off': { 1.253 + 'DIALECTFLAGS': ['/nologo'], 1.254 + 'ARFLAGS': ['/NOLOGO'] 1.255 + }, 1.256 + 'arch:ia32': { 1.257 + 'CPPDEFINES': ['V8_TARGET_ARCH_IA32', '_USE_32BIT_TIME_T'], 1.258 + 'LINKFLAGS': ['/MACHINE:X86'], 1.259 + 'ARFLAGS': ['/MACHINE:X86'] 1.260 + }, 1.261 + 'arch:x64': { 1.262 + 'CPPDEFINES': ['V8_TARGET_ARCH_X64'], 1.263 + 'LINKFLAGS': ['/MACHINE:X64'], 1.264 + 'ARFLAGS': ['/MACHINE:X64'] 1.265 + }, 1.266 + 'mode:debug': { 1.267 + 'CCFLAGS': ['/Od', '/Gm'], 1.268 + 'CPPDEFINES': ['_DEBUG', 'ENABLE_DISASSEMBLER', 'DEBUG'], 1.269 + 'LINKFLAGS': ['/DEBUG'], 1.270 + 'msvcrt:static': { 1.271 + 'CCFLAGS': ['/MTd'] 1.272 + }, 1.273 + 'msvcrt:shared': { 1.274 + 'CCFLAGS': ['/MDd'] 1.275 + } 1.276 + }, 1.277 + 'mode:release': { 1.278 + 'CCFLAGS': ['/O2'], 1.279 + 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'], 1.280 + 'msvcrt:static': { 1.281 + 'CCFLAGS': ['/MT'] 1.282 + }, 1.283 + 'msvcrt:shared': { 1.284 + 'CCFLAGS': ['/MD'] 1.285 + }, 1.286 + 'msvcltcg:on': { 1.287 + 'CCFLAGS': ['/GL'], 1.288 + 'ARFLAGS': ['/LTCG'], 1.289 + 'pgo:off': { 1.290 + 'LINKFLAGS': ['/LTCG'], 1.291 + }, 1.292 + 'pgo:instrument': { 1.293 + 'LINKFLAGS': ['/LTCG:PGI'] 1.294 + }, 1.295 + 'pgo:optimize': { 1.296 + 'LINKFLAGS': ['/LTCG:PGO'] 1.297 + } 1.298 + } 1.299 + } 1.300 + } 1.301 +} 1.302 + 1.303 + 1.304 +V8_EXTRA_FLAGS = { 1.305 + 'gcc': { 1.306 + 'all': { 1.307 + 'WARNINGFLAGS': ['-Wall', 1.308 + '-Werror', 1.309 + '-W', 1.310 + '-Wno-unused-parameter', 1.311 + '-Woverloaded-virtual', 1.312 + '-Wnon-virtual-dtor'] 1.313 + }, 1.314 + 'os:win32': { 1.315 + 'WARNINGFLAGS': ['-pedantic', 1.316 + '-Wno-long-long', 1.317 + '-Wno-pedantic-ms-format'], 1.318 + 'library:shared': { 1.319 + 'LIBS': ['winmm', 'ws2_32'] 1.320 + } 1.321 + }, 1.322 + 'os:linux': { 1.323 + 'WARNINGFLAGS': ['-pedantic'], 1.324 + 'library:shared': { 1.325 + 'soname:on': { 1.326 + 'LINKFLAGS': ['-Wl,-soname,${SONAME}'] 1.327 + } 1.328 + } 1.329 + }, 1.330 + 'os:macos': { 1.331 + 'WARNINGFLAGS': ['-pedantic'] 1.332 + }, 1.333 + 'arch:arm': { 1.334 + # This is to silence warnings about ABI changes that some versions of the 1.335 + # CodeSourcery G++ tool chain produce for each occurrence of varargs. 1.336 + 'WARNINGFLAGS': ['-Wno-abi'] 1.337 + }, 1.338 + 'disassembler:on': { 1.339 + 'CPPDEFINES': ['ENABLE_DISASSEMBLER'] 1.340 + } 1.341 + }, 1.342 + 'msvc': { 1.343 + 'all': { 1.344 + 'WARNINGFLAGS': ['/W3', '/WX', '/wd4351', '/wd4355', '/wd4800'] 1.345 + }, 1.346 + 'library:shared': { 1.347 + 'CPPDEFINES': ['BUILDING_V8_SHARED'], 1.348 + 'LIBS': ['winmm', 'ws2_32'] 1.349 + }, 1.350 + 'arch:arm': { 1.351 + 'CPPDEFINES': ['V8_TARGET_ARCH_ARM'], 1.352 + # /wd4996 is to silence the warning about sscanf 1.353 + # used by the arm simulator. 1.354 + 'WARNINGFLAGS': ['/wd4996'] 1.355 + }, 1.356 + 'arch:mips': { 1.357 + 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'], 1.358 + 'mips_arch_variant:mips32r2': { 1.359 + 'CPPDEFINES': ['_MIPS_ARCH_MIPS32R2'] 1.360 + }, 1.361 + }, 1.362 + 'disassembler:on': { 1.363 + 'CPPDEFINES': ['ENABLE_DISASSEMBLER'] 1.364 + } 1.365 + } 1.366 +} 1.367 + 1.368 + 1.369 +MKSNAPSHOT_EXTRA_FLAGS = { 1.370 + 'gcc': { 1.371 + 'os:linux': { 1.372 + 'LIBS': ['pthread'], 1.373 + }, 1.374 + 'os:macos': { 1.375 + 'LIBS': ['pthread'], 1.376 + }, 1.377 + 'os:freebsd': { 1.378 + 'LIBS': ['execinfo', 'pthread'] 1.379 + }, 1.380 + 'os:solaris': { 1.381 + 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], 1.382 + 'LINKFLAGS': ['-mt'] 1.383 + }, 1.384 + 'os:openbsd': { 1.385 + 'LIBS': ['execinfo', 'pthread'] 1.386 + }, 1.387 + 'os:win32': { 1.388 + 'LIBS': ['winmm', 'ws2_32'], 1.389 + }, 1.390 + 'os:netbsd': { 1.391 + 'LIBS': ['execinfo', 'pthread'] 1.392 + }, 1.393 + 'compress_startup_data:bz2': { 1.394 + 'os:linux': { 1.395 + 'LIBS': ['bz2'] 1.396 + } 1.397 + }, 1.398 + }, 1.399 + 'msvc': { 1.400 + 'all': { 1.401 + 'CPPDEFINES': ['_HAS_EXCEPTIONS=0'], 1.402 + 'LIBS': ['winmm', 'ws2_32'] 1.403 + } 1.404 + } 1.405 +} 1.406 + 1.407 + 1.408 +DTOA_EXTRA_FLAGS = { 1.409 + 'gcc': { 1.410 + 'all': { 1.411 + 'WARNINGFLAGS': ['-Werror', '-Wno-uninitialized'], 1.412 + 'CCFLAGS': GCC_DTOA_EXTRA_CCFLAGS 1.413 + } 1.414 + }, 1.415 + 'msvc': { 1.416 + 'all': { 1.417 + 'WARNINGFLAGS': ['/WX', '/wd4018', '/wd4244'] 1.418 + } 1.419 + } 1.420 +} 1.421 + 1.422 + 1.423 +CCTEST_EXTRA_FLAGS = { 1.424 + 'all': { 1.425 + 'CPPPATH': [src_dir], 1.426 + 'library:shared': { 1.427 + 'CPPDEFINES': ['USING_V8_SHARED'] 1.428 + }, 1.429 + }, 1.430 + 'gcc': { 1.431 + 'all': { 1.432 + 'LIBPATH': [abspath('.')], 1.433 + 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], 1.434 + 'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'], 1.435 + 'LINKFLAGS': ['$CCFLAGS'], 1.436 + }, 1.437 + 'os:linux': { 1.438 + 'LIBS': ['pthread'], 1.439 + 'CCFLAGS': ['-Wno-unused-but-set-variable'], 1.440 + }, 1.441 + 'os:macos': { 1.442 + 'LIBS': ['pthread'], 1.443 + }, 1.444 + 'os:freebsd': { 1.445 + 'LIBS': ['execinfo', 'pthread'] 1.446 + }, 1.447 + 'os:solaris': { 1.448 + 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], 1.449 + 'LINKFLAGS': ['-mt'] 1.450 + }, 1.451 + 'os:openbsd': { 1.452 + 'LIBS': ['execinfo', 'pthread'] 1.453 + }, 1.454 + 'os:win32': { 1.455 + 'LIBS': ['winmm', 'ws2_32'] 1.456 + }, 1.457 + 'os:netbsd': { 1.458 + 'LIBS': ['execinfo', 'pthread'] 1.459 + }, 1.460 + 'arch:arm': { 1.461 + 'LINKFLAGS': ARM_LINK_FLAGS 1.462 + }, 1.463 + }, 1.464 + 'msvc': { 1.465 + 'all': { 1.466 + 'CPPDEFINES': ['_HAS_EXCEPTIONS=0'], 1.467 + 'LIBS': ['winmm', 'ws2_32'] 1.468 + }, 1.469 + 'arch:ia32': { 1.470 + 'CPPDEFINES': ['V8_TARGET_ARCH_IA32'] 1.471 + }, 1.472 + 'arch:x64': { 1.473 + 'CPPDEFINES': ['V8_TARGET_ARCH_X64'], 1.474 + 'LINKFLAGS': ['/STACK:2097152'] 1.475 + }, 1.476 + } 1.477 +} 1.478 + 1.479 + 1.480 +SAMPLE_FLAGS = { 1.481 + 'all': { 1.482 + 'CPPPATH': [join(root_dir, 'include')], 1.483 + 'library:shared': { 1.484 + 'CPPDEFINES': ['USING_V8_SHARED'] 1.485 + }, 1.486 + }, 1.487 + 'gcc': { 1.488 + 'all': { 1.489 + 'LIBPATH': ['.'], 1.490 + 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], 1.491 + 'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'], 1.492 + 'LINKFLAGS': ['$CCFLAGS'], 1.493 + }, 1.494 + 'os:linux': { 1.495 + 'LIBS': ['pthread'], 1.496 + }, 1.497 + 'os:macos': { 1.498 + 'LIBS': ['pthread'], 1.499 + }, 1.500 + 'os:freebsd': { 1.501 + 'LIBPATH' : ['/usr/local/lib'], 1.502 + 'LIBS': ['execinfo', 'pthread'] 1.503 + }, 1.504 + 'os:solaris': { 1.505 + # On Solaris, to get isinf, INFINITY, fpclassify and other macros one 1.506 + # needs to define __C99FEATURES__. 1.507 + 'CPPDEFINES': ['__C99FEATURES__'], 1.508 + 'LIBPATH' : ['/usr/local/lib'], 1.509 + 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], 1.510 + 'LINKFLAGS': ['-mt'] 1.511 + }, 1.512 + 'os:openbsd': { 1.513 + 'LIBPATH' : ['/usr/local/lib'], 1.514 + 'LIBS': ['execinfo', 'pthread'] 1.515 + }, 1.516 + 'os:win32': { 1.517 + 'LIBS': ['winmm', 'ws2_32'] 1.518 + }, 1.519 + 'os:netbsd': { 1.520 + 'LIBPATH' : ['/usr/pkg/lib'], 1.521 + 'LIBS': ['execinfo', 'pthread'] 1.522 + }, 1.523 + 'arch:arm': { 1.524 + 'LINKFLAGS': ARM_LINK_FLAGS, 1.525 + 'armeabi:soft' : { 1.526 + 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'], 1.527 + 'simulator:none': { 1.528 + 'CCFLAGS': ['-mfloat-abi=soft'], 1.529 + } 1.530 + }, 1.531 + 'armeabi:softfp' : { 1.532 + 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'], 1.533 + 'simulator:none': { 1.534 + 'CCFLAGS': ['-mfloat-abi=softfp'], 1.535 + } 1.536 + }, 1.537 + 'armeabi:hard' : { 1.538 + 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=1'], 1.539 + 'vfp3:on': { 1.540 + 'CPPDEFINES' : ['CAN_USE_VFP_INSTRUCTIONS'] 1.541 + }, 1.542 + 'simulator:none': { 1.543 + 'CCFLAGS': ['-mfloat-abi=hard'], 1.544 + } 1.545 + } 1.546 + }, 1.547 + 'arch:ia32': { 1.548 + 'CCFLAGS': ['-m32'], 1.549 + 'LINKFLAGS': ['-m32'] 1.550 + }, 1.551 + 'arch:x64': { 1.552 + 'CCFLAGS': ['-m64'], 1.553 + 'LINKFLAGS': ['-m64'] 1.554 + }, 1.555 + 'arch:mips': { 1.556 + 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'], 1.557 + 'mips_arch_variant:mips32r2': { 1.558 + 'CPPDEFINES': ['_MIPS_ARCH_MIPS32R2'] 1.559 + }, 1.560 + 'mips_arch_variant:loongson': { 1.561 + 'CPPDEFINES': ['_MIPS_ARCH_LOONGSON'] 1.562 + }, 1.563 + 'simulator:none': { 1.564 + 'CCFLAGS': ['-EL'], 1.565 + 'LINKFLAGS': ['-EL'], 1.566 + 'mips_arch_variant:mips32r2': { 1.567 + 'CCFLAGS': ['-mips32r2', '-Wa,-mips32r2'] 1.568 + }, 1.569 + 'mips_arch_variant:mips32r1': { 1.570 + 'CCFLAGS': ['-mips32', '-Wa,-mips32'] 1.571 + }, 1.572 + 'mips_arch_variant:loongson': { 1.573 + 'CCFLAGS': ['-march=mips3', '-Wa,-march=mips3'] 1.574 + }, 1.575 + 'library:static': { 1.576 + 'LINKFLAGS': ['-static', '-static-libgcc'] 1.577 + }, 1.578 + 'mipsabi:softfloat': { 1.579 + 'CCFLAGS': ['-msoft-float'], 1.580 + 'LINKFLAGS': ['-msoft-float'] 1.581 + }, 1.582 + 'mipsabi:hardfloat': { 1.583 + 'CCFLAGS': ['-mhard-float'], 1.584 + 'LINKFLAGS': ['-mhard-float'], 1.585 + 'fpu:on': { 1.586 + 'CPPDEFINES' : ['CAN_USE_FPU_INSTRUCTIONS'] 1.587 + } 1.588 + } 1.589 + } 1.590 + }, 1.591 + 'simulator:arm': { 1.592 + 'CCFLAGS': ['-m32'], 1.593 + 'LINKFLAGS': ['-m32'] 1.594 + }, 1.595 + 'simulator:mips': { 1.596 + 'CCFLAGS': ['-m32'], 1.597 + 'LINKFLAGS': ['-m32'] 1.598 + }, 1.599 + 'mode:release': { 1.600 + 'CCFLAGS': ['-O2'] 1.601 + }, 1.602 + 'mode:debug': { 1.603 + 'CCFLAGS': ['-g', '-O0'], 1.604 + 'CPPDEFINES': ['DEBUG'] 1.605 + }, 1.606 + 'compress_startup_data:bz2': { 1.607 + 'CPPDEFINES': ['COMPRESS_STARTUP_DATA_BZ2'], 1.608 + 'os:linux': { 1.609 + 'LIBS': ['bz2'] 1.610 + } 1.611 + }, 1.612 + }, 1.613 + 'msvc': { 1.614 + 'all': { 1.615 + 'LIBS': ['winmm', 'ws2_32'] 1.616 + }, 1.617 + 'verbose:off': { 1.618 + 'CCFLAGS': ['/nologo'], 1.619 + 'LINKFLAGS': ['/NOLOGO'] 1.620 + }, 1.621 + 'verbose:on': { 1.622 + 'LINKFLAGS': ['/VERBOSE'] 1.623 + }, 1.624 + 'prof:on': { 1.625 + 'LINKFLAGS': ['/MAP'] 1.626 + }, 1.627 + 'mode:release': { 1.628 + 'CCFLAGS': ['/O2'], 1.629 + 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'], 1.630 + 'msvcrt:static': { 1.631 + 'CCFLAGS': ['/MT'] 1.632 + }, 1.633 + 'msvcrt:shared': { 1.634 + 'CCFLAGS': ['/MD'] 1.635 + }, 1.636 + 'msvcltcg:on': { 1.637 + 'CCFLAGS': ['/GL'], 1.638 + 'pgo:off': { 1.639 + 'LINKFLAGS': ['/LTCG'], 1.640 + }, 1.641 + }, 1.642 + 'pgo:instrument': { 1.643 + 'LINKFLAGS': ['/LTCG:PGI'] 1.644 + }, 1.645 + 'pgo:optimize': { 1.646 + 'LINKFLAGS': ['/LTCG:PGO'] 1.647 + } 1.648 + }, 1.649 + 'arch:ia32': { 1.650 + 'CPPDEFINES': ['V8_TARGET_ARCH_IA32', 'WIN32'], 1.651 + 'LINKFLAGS': ['/MACHINE:X86'] 1.652 + }, 1.653 + 'arch:x64': { 1.654 + 'CPPDEFINES': ['V8_TARGET_ARCH_X64', 'WIN32'], 1.655 + 'LINKFLAGS': ['/MACHINE:X64', '/STACK:2097152'] 1.656 + }, 1.657 + 'mode:debug': { 1.658 + 'CCFLAGS': ['/Od'], 1.659 + 'LINKFLAGS': ['/DEBUG'], 1.660 + 'CPPDEFINES': ['DEBUG'], 1.661 + 'msvcrt:static': { 1.662 + 'CCFLAGS': ['/MTd'] 1.663 + }, 1.664 + 'msvcrt:shared': { 1.665 + 'CCFLAGS': ['/MDd'] 1.666 + } 1.667 + } 1.668 + } 1.669 +} 1.670 + 1.671 + 1.672 +PREPARSER_FLAGS = { 1.673 + 'all': { 1.674 + 'CPPPATH': [join(root_dir, 'include'), src_dir], 1.675 + 'library:shared': { 1.676 + 'CPPDEFINES': ['USING_V8_SHARED'] 1.677 + }, 1.678 + }, 1.679 + 'gcc': { 1.680 + 'all': { 1.681 + 'LIBPATH': ['.'], 1.682 + 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], 1.683 + 'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'], 1.684 + 'LINKFLAGS': ['$CCFLAGS'], 1.685 + }, 1.686 + 'os:win32': { 1.687 + 'LIBS': ['winmm', 'ws2_32'] 1.688 + }, 1.689 + 'arch:arm': { 1.690 + 'LINKFLAGS': ARM_LINK_FLAGS, 1.691 + 'armeabi:soft' : { 1.692 + 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'], 1.693 + 'simulator:none': { 1.694 + 'CCFLAGS': ['-mfloat-abi=soft'], 1.695 + } 1.696 + }, 1.697 + 'armeabi:softfp' : { 1.698 + 'simulator:none': { 1.699 + 'CCFLAGS': ['-mfloat-abi=softfp'], 1.700 + } 1.701 + }, 1.702 + 'armeabi:hard' : { 1.703 + 'simulator:none': { 1.704 + 'CCFLAGS': ['-mfloat-abi=hard'], 1.705 + } 1.706 + } 1.707 + }, 1.708 + 'arch:ia32': { 1.709 + 'CCFLAGS': ['-m32'], 1.710 + 'LINKFLAGS': ['-m32'] 1.711 + }, 1.712 + 'arch:x64': { 1.713 + 'CCFLAGS': ['-m64'], 1.714 + 'LINKFLAGS': ['-m64'] 1.715 + }, 1.716 + 'arch:mips': { 1.717 + 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'], 1.718 + 'mips_arch_variant:mips32r2': { 1.719 + 'CPPDEFINES': ['_MIPS_ARCH_MIPS32R2'] 1.720 + }, 1.721 + 'mips_arch_variant:loongson': { 1.722 + 'CPPDEFINES': ['_MIPS_ARCH_LOONGSON'] 1.723 + }, 1.724 + 'simulator:none': { 1.725 + 'CCFLAGS': ['-EL'], 1.726 + 'LINKFLAGS': ['-EL'], 1.727 + 'mips_arch_variant:mips32r2': { 1.728 + 'CCFLAGS': ['-mips32r2', '-Wa,-mips32r2'] 1.729 + }, 1.730 + 'mips_arch_variant:mips32r1': { 1.731 + 'CCFLAGS': ['-mips32', '-Wa,-mips32'] 1.732 + }, 1.733 + 'mips_arch_variant:loongson': { 1.734 + 'CCFLAGS': ['-march=mips3', '-Wa,-march=mips3'] 1.735 + }, 1.736 + 'library:static': { 1.737 + 'LINKFLAGS': ['-static', '-static-libgcc'] 1.738 + }, 1.739 + 'mipsabi:softfloat': { 1.740 + 'CCFLAGS': ['-msoft-float'], 1.741 + 'LINKFLAGS': ['-msoft-float'] 1.742 + }, 1.743 + 'mipsabi:hardfloat': { 1.744 + 'CCFLAGS': ['-mhard-float'], 1.745 + 'LINKFLAGS': ['-mhard-float'] 1.746 + } 1.747 + } 1.748 + }, 1.749 + 'simulator:arm': { 1.750 + 'CCFLAGS': ['-m32'], 1.751 + 'LINKFLAGS': ['-m32'] 1.752 + }, 1.753 + 'simulator:mips': { 1.754 + 'CCFLAGS': ['-m32'], 1.755 + 'LINKFLAGS': ['-m32'], 1.756 + 'mipsabi:softfloat': { 1.757 + 'CPPDEFINES': ['__mips_soft_float=1'], 1.758 + }, 1.759 + 'mipsabi:hardfloat': { 1.760 + 'CPPDEFINES': ['__mips_hard_float=1'], 1.761 + } 1.762 + }, 1.763 + 'mode:release': { 1.764 + 'CCFLAGS': ['-O2'] 1.765 + }, 1.766 + 'mode:debug': { 1.767 + 'CCFLAGS': ['-g', '-O0'], 1.768 + 'CPPDEFINES': ['DEBUG'] 1.769 + }, 1.770 + 'os:freebsd': { 1.771 + 'LIBPATH' : ['/usr/local/lib'], 1.772 + }, 1.773 + }, 1.774 + 'msvc': { 1.775 + 'all': { 1.776 + 'LIBS': ['winmm', 'ws2_32'] 1.777 + }, 1.778 + 'verbose:off': { 1.779 + 'CCFLAGS': ['/nologo'], 1.780 + 'LINKFLAGS': ['/NOLOGO'] 1.781 + }, 1.782 + 'verbose:on': { 1.783 + 'LINKFLAGS': ['/VERBOSE'] 1.784 + }, 1.785 + 'prof:on': { 1.786 + 'LINKFLAGS': ['/MAP'] 1.787 + }, 1.788 + 'mode:release': { 1.789 + 'CCFLAGS': ['/O2'], 1.790 + 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'], 1.791 + 'msvcrt:static': { 1.792 + 'CCFLAGS': ['/MT'] 1.793 + }, 1.794 + 'msvcrt:shared': { 1.795 + 'CCFLAGS': ['/MD'] 1.796 + }, 1.797 + 'msvcltcg:on': { 1.798 + 'CCFLAGS': ['/GL'], 1.799 + 'pgo:off': { 1.800 + 'LINKFLAGS': ['/LTCG'], 1.801 + }, 1.802 + }, 1.803 + 'pgo:instrument': { 1.804 + 'LINKFLAGS': ['/LTCG:PGI'] 1.805 + }, 1.806 + 'pgo:optimize': { 1.807 + 'LINKFLAGS': ['/LTCG:PGO'] 1.808 + } 1.809 + }, 1.810 + 'arch:ia32': { 1.811 + 'CPPDEFINES': ['V8_TARGET_ARCH_IA32', 'WIN32'], 1.812 + 'LINKFLAGS': ['/MACHINE:X86'] 1.813 + }, 1.814 + 'arch:x64': { 1.815 + 'CPPDEFINES': ['V8_TARGET_ARCH_X64', 'WIN32'], 1.816 + 'LINKFLAGS': ['/MACHINE:X64', '/STACK:2097152'] 1.817 + }, 1.818 + 'mode:debug': { 1.819 + 'CCFLAGS': ['/Od'], 1.820 + 'LINKFLAGS': ['/DEBUG'], 1.821 + 'CPPDEFINES': ['DEBUG'], 1.822 + 'msvcrt:static': { 1.823 + 'CCFLAGS': ['/MTd'] 1.824 + }, 1.825 + 'msvcrt:shared': { 1.826 + 'CCFLAGS': ['/MDd'] 1.827 + } 1.828 + } 1.829 + } 1.830 +} 1.831 + 1.832 + 1.833 +D8_FLAGS = { 1.834 + 'all': { 1.835 + 'library:shared': { 1.836 + 'CPPDEFINES': ['V8_SHARED'], 1.837 + 'LIBS': ['v8'], 1.838 + 'LIBPATH': ['.'] 1.839 + }, 1.840 + }, 1.841 + 'gcc': { 1.842 + 'all': { 1.843 + 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], 1.844 + 'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'], 1.845 + 'LINKFLAGS': ['$CCFLAGS'], 1.846 + }, 1.847 + 'console:readline': { 1.848 + 'LIBS': ['readline'] 1.849 + }, 1.850 + 'os:linux': { 1.851 + 'LIBS': ['pthread'], 1.852 + }, 1.853 + 'os:macos': { 1.854 + 'LIBS': ['pthread'], 1.855 + }, 1.856 + 'os:freebsd': { 1.857 + 'LIBS': ['pthread'], 1.858 + }, 1.859 + 'os:solaris': { 1.860 + 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], 1.861 + 'LINKFLAGS': ['-mt'] 1.862 + }, 1.863 + 'os:openbsd': { 1.864 + 'LIBS': ['pthread'], 1.865 + }, 1.866 + 'os:win32': { 1.867 + 'LIBS': ['winmm', 'ws2_32'], 1.868 + }, 1.869 + 'os:netbsd': { 1.870 + 'LIBS': ['pthread'], 1.871 + }, 1.872 + 'arch:arm': { 1.873 + 'LINKFLAGS': ARM_LINK_FLAGS 1.874 + }, 1.875 + 'compress_startup_data:bz2': { 1.876 + 'CPPDEFINES': ['COMPRESS_STARTUP_DATA_BZ2'], 1.877 + 'os:linux': { 1.878 + 'LIBS': ['bz2'] 1.879 + } 1.880 + } 1.881 + }, 1.882 + 'msvc': { 1.883 + 'all': { 1.884 + 'LIBS': ['winmm', 'ws2_32'] 1.885 + }, 1.886 + 'verbose:off': { 1.887 + 'CCFLAGS': ['/nologo'], 1.888 + 'LINKFLAGS': ['/NOLOGO'] 1.889 + }, 1.890 + 'verbose:on': { 1.891 + 'LINKFLAGS': ['/VERBOSE'] 1.892 + }, 1.893 + 'prof:on': { 1.894 + 'LINKFLAGS': ['/MAP'] 1.895 + }, 1.896 + 'mode:release': { 1.897 + 'CCFLAGS': ['/O2'], 1.898 + 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'], 1.899 + 'msvcrt:static': { 1.900 + 'CCFLAGS': ['/MT'] 1.901 + }, 1.902 + 'msvcrt:shared': { 1.903 + 'CCFLAGS': ['/MD'] 1.904 + }, 1.905 + 'msvcltcg:on': { 1.906 + 'CCFLAGS': ['/GL'], 1.907 + 'pgo:off': { 1.908 + 'LINKFLAGS': ['/LTCG'], 1.909 + }, 1.910 + }, 1.911 + 'pgo:instrument': { 1.912 + 'LINKFLAGS': ['/LTCG:PGI'] 1.913 + }, 1.914 + 'pgo:optimize': { 1.915 + 'LINKFLAGS': ['/LTCG:PGO'] 1.916 + } 1.917 + }, 1.918 + 'arch:ia32': { 1.919 + 'CPPDEFINES': ['V8_TARGET_ARCH_IA32', 'WIN32'], 1.920 + 'LINKFLAGS': ['/MACHINE:X86'] 1.921 + }, 1.922 + 'arch:x64': { 1.923 + 'CPPDEFINES': ['V8_TARGET_ARCH_X64', 'WIN32'], 1.924 + 'LINKFLAGS': ['/MACHINE:X64', '/STACK:2097152'] 1.925 + }, 1.926 + 'mode:debug': { 1.927 + 'CCFLAGS': ['/Od'], 1.928 + 'LINKFLAGS': ['/DEBUG'], 1.929 + 'CPPDEFINES': ['DEBUG'], 1.930 + 'msvcrt:static': { 1.931 + 'CCFLAGS': ['/MTd'] 1.932 + }, 1.933 + 'msvcrt:shared': { 1.934 + 'CCFLAGS': ['/MDd'] 1.935 + } 1.936 + } 1.937 + } 1.938 +} 1.939 + 1.940 + 1.941 +SUFFIXES = { 1.942 + 'release': '', 1.943 + 'debug': '_g' 1.944 +} 1.945 + 1.946 + 1.947 +def Abort(message): 1.948 + print message 1.949 + sys.exit(1) 1.950 + 1.951 + 1.952 +def GuessOS(env): 1.953 + return utils.GuessOS() 1.954 + 1.955 + 1.956 +def GuessArch(env): 1.957 + return utils.GuessArchitecture() 1.958 + 1.959 + 1.960 +def GuessToolchain(env): 1.961 + tools = env['TOOLS'] 1.962 + if 'gcc' in tools: 1.963 + return 'gcc' 1.964 + elif 'msvc' in tools: 1.965 + return 'msvc' 1.966 + else: 1.967 + return None 1.968 + 1.969 + 1.970 +def GuessVisibility(env): 1.971 + os = env['os'] 1.972 + toolchain = env['toolchain']; 1.973 + if (os == 'win32' or os == 'cygwin') and toolchain == 'gcc': 1.974 + # MinGW / Cygwin can't do it. 1.975 + return 'default' 1.976 + elif os == 'solaris': 1.977 + return 'default' 1.978 + else: 1.979 + return 'hidden' 1.980 + 1.981 + 1.982 +def GuessStrictAliasing(env): 1.983 + # There seems to be a problem with gcc 4.5.x. 1.984 + # See http://code.google.com/p/v8/issues/detail?id=884 1.985 + # It can be worked around by disabling strict aliasing. 1.986 + toolchain = env['toolchain']; 1.987 + if toolchain == 'gcc': 1.988 + env = Environment(tools=['gcc']) 1.989 + # The gcc version should be available in env['CCVERSION'], 1.990 + # but when scons detects msvc this value is not set. 1.991 + version = subprocess.Popen([env['CC'], '-dumpversion'], 1.992 + stdout=subprocess.PIPE).communicate()[0] 1.993 + if version.find('4.5') == 0: 1.994 + return 'off' 1.995 + return 'default' 1.996 + 1.997 + 1.998 +PLATFORM_OPTIONS = { 1.999 + 'arch': { 1.1000 + 'values': ['arm', 'ia32', 'x64', 'mips'], 1.1001 + 'guess': GuessArch, 1.1002 + 'help': 'the architecture to build for' 1.1003 + }, 1.1004 + 'os': { 1.1005 + 'values': ['freebsd', 'linux', 'macos', 'win32', 'openbsd', 'solaris', 'cygwin', 'netbsd'], 1.1006 + 'guess': GuessOS, 1.1007 + 'help': 'the os to build for' 1.1008 + }, 1.1009 + 'toolchain': { 1.1010 + 'values': ['gcc', 'msvc'], 1.1011 + 'guess': GuessToolchain, 1.1012 + 'help': 'the toolchain to use' 1.1013 + } 1.1014 +} 1.1015 + 1.1016 +SIMPLE_OPTIONS = { 1.1017 + 'regexp': { 1.1018 + 'values': ['native', 'interpreted'], 1.1019 + 'default': 'native', 1.1020 + 'help': 'Whether to use native or interpreted regexp implementation' 1.1021 + }, 1.1022 + 'snapshot': { 1.1023 + 'values': ['on', 'off', 'nobuild'], 1.1024 + 'default': 'off', 1.1025 + 'help': 'build using snapshots for faster start-up' 1.1026 + }, 1.1027 + 'prof': { 1.1028 + 'values': ['on', 'off'], 1.1029 + 'default': 'off', 1.1030 + 'help': 'enable profiling of build target' 1.1031 + }, 1.1032 + 'gdbjit': { 1.1033 + 'values': ['on', 'off'], 1.1034 + 'default': 'off', 1.1035 + 'help': 'enable GDB JIT interface' 1.1036 + }, 1.1037 + 'library': { 1.1038 + 'values': ['static', 'shared'], 1.1039 + 'default': 'static', 1.1040 + 'help': 'the type of library to produce' 1.1041 + }, 1.1042 + 'objectprint': { 1.1043 + 'values': ['on', 'off'], 1.1044 + 'default': 'off', 1.1045 + 'help': 'enable object printing' 1.1046 + }, 1.1047 + 'profilingsupport': { 1.1048 + 'values': ['on', 'off'], 1.1049 + 'default': 'on', 1.1050 + 'help': 'enable profiling of JavaScript code' 1.1051 + }, 1.1052 + 'debuggersupport': { 1.1053 + 'values': ['on', 'off'], 1.1054 + 'default': 'on', 1.1055 + 'help': 'enable debugging of JavaScript code' 1.1056 + }, 1.1057 + 'inspector': { 1.1058 + 'values': ['on', 'off'], 1.1059 + 'default': 'off', 1.1060 + 'help': 'enable inspector features' 1.1061 + }, 1.1062 + 'liveobjectlist': { 1.1063 + 'values': ['on', 'off'], 1.1064 + 'default': 'off', 1.1065 + 'help': 'enable live object list features in the debugger' 1.1066 + }, 1.1067 + 'soname': { 1.1068 + 'values': ['on', 'off'], 1.1069 + 'default': 'off', 1.1070 + 'help': 'turn on setting soname for Linux shared library' 1.1071 + }, 1.1072 + 'msvcrt': { 1.1073 + 'values': ['static', 'shared'], 1.1074 + 'default': 'static', 1.1075 + 'help': 'the type of Microsoft Visual C++ runtime library to use' 1.1076 + }, 1.1077 + 'msvcltcg': { 1.1078 + 'values': ['on', 'off'], 1.1079 + 'default': 'on', 1.1080 + 'help': 'use Microsoft Visual C++ link-time code generation' 1.1081 + }, 1.1082 + 'simulator': { 1.1083 + 'values': ['arm', 'mips', 'none'], 1.1084 + 'default': 'none', 1.1085 + 'help': 'build with simulator' 1.1086 + }, 1.1087 + 'unalignedaccesses': { 1.1088 + 'values': ['default', 'on', 'off'], 1.1089 + 'default': 'default', 1.1090 + 'help': 'set whether the ARM target supports unaligned accesses' 1.1091 + }, 1.1092 + 'disassembler': { 1.1093 + 'values': ['on', 'off'], 1.1094 + 'default': 'off', 1.1095 + 'help': 'enable the disassembler to inspect generated code' 1.1096 + }, 1.1097 + 'fasttls': { 1.1098 + 'values': ['on', 'off'], 1.1099 + 'default': 'on', 1.1100 + 'help': 'enable fast thread local storage support ' 1.1101 + '(if available on the current architecture/platform)' 1.1102 + }, 1.1103 + 'sourcesignatures': { 1.1104 + 'values': ['MD5', 'timestamp'], 1.1105 + 'default': 'MD5', 1.1106 + 'help': 'set how the build system detects file changes' 1.1107 + }, 1.1108 + 'console': { 1.1109 + 'values': ['dumb', 'readline'], 1.1110 + 'default': 'dumb', 1.1111 + 'help': 'the console to use for the d8 shell' 1.1112 + }, 1.1113 + 'verbose': { 1.1114 + 'values': ['on', 'off'], 1.1115 + 'default': 'off', 1.1116 + 'help': 'more output from compiler and linker' 1.1117 + }, 1.1118 + 'visibility': { 1.1119 + 'values': ['default', 'hidden'], 1.1120 + 'guess': GuessVisibility, 1.1121 + 'help': 'shared library symbol visibility' 1.1122 + }, 1.1123 + 'strictaliasing': { 1.1124 + 'values': ['default', 'off'], 1.1125 + 'guess': GuessStrictAliasing, 1.1126 + 'help': 'assume strict aliasing while optimizing' 1.1127 + }, 1.1128 + 'pgo': { 1.1129 + 'values': ['off', 'instrument', 'optimize'], 1.1130 + 'default': 'off', 1.1131 + 'help': 'select profile guided optimization variant', 1.1132 + }, 1.1133 + 'armeabi': { 1.1134 + 'values': ['hard', 'softfp', 'soft'], 1.1135 + 'default': 'softfp', 1.1136 + 'help': 'generate calling conventiont according to selected ARM EABI variant' 1.1137 + }, 1.1138 + 'mipsabi': { 1.1139 + 'values': ['hardfloat', 'softfloat', 'none'], 1.1140 + 'default': 'hardfloat', 1.1141 + 'help': 'generate calling conventiont according to selected mips ABI' 1.1142 + }, 1.1143 + 'mips_arch_variant': { 1.1144 + 'values': ['mips32r2', 'mips32r1', 'loongson'], 1.1145 + 'default': 'mips32r2', 1.1146 + 'help': 'mips variant' 1.1147 + }, 1.1148 + 'compress_startup_data': { 1.1149 + 'values': ['off', 'bz2'], 1.1150 + 'default': 'off', 1.1151 + 'help': 'compress startup data (snapshot) [Linux only]' 1.1152 + }, 1.1153 + 'vfp3': { 1.1154 + 'values': ['on', 'off'], 1.1155 + 'default': 'on', 1.1156 + 'help': 'use vfp3 instructions when building the snapshot [Arm only]' 1.1157 + }, 1.1158 + 'fpu': { 1.1159 + 'values': ['on', 'off'], 1.1160 + 'default': 'on', 1.1161 + 'help': 'use fpu instructions when building the snapshot [MIPS only]' 1.1162 + }, 1.1163 + 'I_know_I_should_build_with_GYP': { 1.1164 + 'values': ['yes', 'no'], 1.1165 + 'default': 'no', 1.1166 + 'help': 'grace period: temporarily override SCons deprecation' 1.1167 + } 1.1168 + 1.1169 +} 1.1170 + 1.1171 +ALL_OPTIONS = dict(PLATFORM_OPTIONS, **SIMPLE_OPTIONS) 1.1172 + 1.1173 + 1.1174 +def AddOptions(options, result): 1.1175 + guess_env = Environment(options=result) 1.1176 + for (name, option) in options.iteritems(): 1.1177 + if 'guess' in option: 1.1178 + # Option has a guess function 1.1179 + guess = option.get('guess') 1.1180 + default = guess(guess_env) 1.1181 + else: 1.1182 + # Option has a fixed default 1.1183 + default = option.get('default') 1.1184 + help = '%s (%s)' % (option.get('help'), ", ".join(option['values'])) 1.1185 + result.Add(name, help, default) 1.1186 + 1.1187 + 1.1188 +def GetOptions(): 1.1189 + result = Options() 1.1190 + result.Add('mode', 'compilation mode (debug, release)', 'release') 1.1191 + result.Add('sample', 'build sample (shell, process, lineprocessor)', '') 1.1192 + result.Add('cache', 'directory to use for scons build cache', '') 1.1193 + result.Add('env', 'override environment settings (NAME0:value0,NAME1:value1,...)', '') 1.1194 + result.Add('importenv', 'import environment settings (NAME0,NAME1,...)', '') 1.1195 + AddOptions(PLATFORM_OPTIONS, result) 1.1196 + AddOptions(SIMPLE_OPTIONS, result) 1.1197 + return result 1.1198 + 1.1199 + 1.1200 +def GetTools(opts): 1.1201 + env = Environment(options=opts) 1.1202 + os = env['os'] 1.1203 + toolchain = env['toolchain'] 1.1204 + if os == 'win32' and toolchain == 'gcc': 1.1205 + return ['mingw'] 1.1206 + elif os == 'win32' and toolchain == 'msvc': 1.1207 + return ['msvc', 'mslink', 'mslib', 'msvs'] 1.1208 + else: 1.1209 + return ['default'] 1.1210 + 1.1211 + 1.1212 +def GetVersionComponents(): 1.1213 + MAJOR_VERSION_PATTERN = re.compile(r"#define\s+MAJOR_VERSION\s+(.*)") 1.1214 + MINOR_VERSION_PATTERN = re.compile(r"#define\s+MINOR_VERSION\s+(.*)") 1.1215 + BUILD_NUMBER_PATTERN = re.compile(r"#define\s+BUILD_NUMBER\s+(.*)") 1.1216 + PATCH_LEVEL_PATTERN = re.compile(r"#define\s+PATCH_LEVEL\s+(.*)") 1.1217 + 1.1218 + patterns = [MAJOR_VERSION_PATTERN, 1.1219 + MINOR_VERSION_PATTERN, 1.1220 + BUILD_NUMBER_PATTERN, 1.1221 + PATCH_LEVEL_PATTERN] 1.1222 + 1.1223 + source = open(join(root_dir, 'src', 'version.cc')).read() 1.1224 + version_components = [] 1.1225 + for pattern in patterns: 1.1226 + match = pattern.search(source) 1.1227 + if match: 1.1228 + version_components.append(match.group(1).strip()) 1.1229 + else: 1.1230 + version_components.append('0') 1.1231 + 1.1232 + return version_components 1.1233 + 1.1234 + 1.1235 +def GetVersion(): 1.1236 + version_components = GetVersionComponents() 1.1237 + 1.1238 + if version_components[len(version_components) - 1] == '0': 1.1239 + version_components.pop() 1.1240 + return '.'.join(version_components) 1.1241 + 1.1242 + 1.1243 +def GetSpecificSONAME(): 1.1244 + SONAME_PATTERN = re.compile(r"#define\s+SONAME\s+\"(.*)\"") 1.1245 + 1.1246 + source = open(join(root_dir, 'src', 'version.cc')).read() 1.1247 + match = SONAME_PATTERN.search(source) 1.1248 + 1.1249 + if match: 1.1250 + return match.group(1).strip() 1.1251 + else: 1.1252 + return '' 1.1253 + 1.1254 + 1.1255 +def SplitList(str): 1.1256 + return [ s for s in str.split(",") if len(s) > 0 ] 1.1257 + 1.1258 + 1.1259 +def IsLegal(env, option, values): 1.1260 + str = env[option] 1.1261 + for s in SplitList(str): 1.1262 + if not s in values: 1.1263 + Abort("Illegal value for option %s '%s'." % (option, s)) 1.1264 + return False 1.1265 + return True 1.1266 + 1.1267 + 1.1268 +def WarnAboutDeprecation(): 1.1269 + print """ 1.1270 + ##################################################################### 1.1271 + # # 1.1272 + # LAST WARNING: Building V8 with SCons is deprecated. # 1.1273 + # # 1.1274 + # This only works because you have overridden the kill switch. # 1.1275 + # # 1.1276 + # MIGRATE TO THE GYP-BASED BUILD NOW! # 1.1277 + # # 1.1278 + # Instructions: http://code.google.com/p/v8/wiki/BuildingWithGYP. # 1.1279 + # # 1.1280 + ##################################################################### 1.1281 + """ 1.1282 + 1.1283 + 1.1284 +def VerifyOptions(env): 1.1285 + if env['I_know_I_should_build_with_GYP'] != 'yes': 1.1286 + Abort("Building V8 with SCons is no longer supported. Please use GYP " 1.1287 + "instead; you can find instructions are at " 1.1288 + "http://code.google.com/p/v8/wiki/BuildingWithGYP.\n\n" 1.1289 + "Quitting.\n\n" 1.1290 + "For a limited grace period, you can specify " 1.1291 + "\"I_know_I_should_build_with_GYP=yes\" to override.") 1.1292 + else: 1.1293 + WarnAboutDeprecation() 1.1294 + import atexit 1.1295 + atexit.register(WarnAboutDeprecation) 1.1296 + 1.1297 + if not IsLegal(env, 'mode', ['debug', 'release']): 1.1298 + return False 1.1299 + if not IsLegal(env, 'sample', ["shell", "process", "lineprocessor"]): 1.1300 + return False 1.1301 + if not IsLegal(env, 'regexp', ["native", "interpreted"]): 1.1302 + return False 1.1303 + if env['os'] == 'win32' and env['library'] == 'shared' and env['prof'] == 'on': 1.1304 + Abort("Profiling on windows only supported for static library.") 1.1305 + if env['gdbjit'] == 'on' and ((env['os'] != 'linux' and env['os'] != 'macos') or (env['arch'] != 'ia32' and env['arch'] != 'x64' and env['arch'] != 'arm')): 1.1306 + Abort("GDBJIT interface is supported only for Intel-compatible (ia32 or x64) Linux/OSX target.") 1.1307 + if env['os'] == 'win32' and env['soname'] == 'on': 1.1308 + Abort("Shared Object soname not applicable for Windows.") 1.1309 + if env['soname'] == 'on' and env['library'] == 'static': 1.1310 + Abort("Shared Object soname not applicable for static library.") 1.1311 + if env['os'] != 'win32' and env['pgo'] != 'off': 1.1312 + Abort("Profile guided optimization only supported on Windows.") 1.1313 + if env['cache'] and not os.path.isdir(env['cache']): 1.1314 + Abort("The specified cache directory does not exist.") 1.1315 + if not (env['arch'] == 'arm' or env['simulator'] == 'arm') and ('unalignedaccesses' in ARGUMENTS): 1.1316 + print env['arch'] 1.1317 + print env['simulator'] 1.1318 + Abort("Option unalignedaccesses only supported for the ARM architecture.") 1.1319 + if env['os'] != 'linux' and env['compress_startup_data'] != 'off': 1.1320 + Abort("Startup data compression is only available on Linux") 1.1321 + for (name, option) in ALL_OPTIONS.iteritems(): 1.1322 + if (not name in env): 1.1323 + message = ("A value for option %s must be specified (%s)." % 1.1324 + (name, ", ".join(option['values']))) 1.1325 + Abort(message) 1.1326 + if not env[name] in option['values']: 1.1327 + message = ("Unknown %s value '%s'. Possible values are (%s)." % 1.1328 + (name, env[name], ", ".join(option['values']))) 1.1329 + Abort(message) 1.1330 + 1.1331 + 1.1332 +class BuildContext(object): 1.1333 + 1.1334 + def __init__(self, options, env_overrides, samples): 1.1335 + self.library_targets = [] 1.1336 + self.mksnapshot_targets = [] 1.1337 + self.cctest_targets = [] 1.1338 + self.sample_targets = [] 1.1339 + self.d8_targets = [] 1.1340 + self.options = options 1.1341 + self.env_overrides = env_overrides 1.1342 + self.samples = samples 1.1343 + self.preparser_targets = [] 1.1344 + self.use_snapshot = (options['snapshot'] != 'off') 1.1345 + self.build_snapshot = (options['snapshot'] == 'on') 1.1346 + self.flags = None 1.1347 + 1.1348 + def AddRelevantFlags(self, initial, flags): 1.1349 + result = initial.copy() 1.1350 + toolchain = self.options['toolchain'] 1.1351 + if toolchain in flags: 1.1352 + self.AppendFlags(result, flags[toolchain].get('all')) 1.1353 + for option in sorted(self.options.keys()): 1.1354 + value = self.options[option] 1.1355 + self.AppendFlags(result, flags[toolchain].get(option + ':' + value)) 1.1356 + self.AppendFlags(result, flags.get('all')) 1.1357 + return result 1.1358 + 1.1359 + def AddRelevantSubFlags(self, options, flags): 1.1360 + self.AppendFlags(options, flags.get('all')) 1.1361 + for option in sorted(self.options.keys()): 1.1362 + value = self.options[option] 1.1363 + self.AppendFlags(options, flags.get(option + ':' + value)) 1.1364 + 1.1365 + def GetRelevantSources(self, source): 1.1366 + result = [] 1.1367 + result += source.get('all', []) 1.1368 + for (name, value) in self.options.iteritems(): 1.1369 + source_value = source.get(name + ':' + value, []) 1.1370 + if type(source_value) == dict: 1.1371 + result += self.GetRelevantSources(source_value) 1.1372 + else: 1.1373 + result += source_value 1.1374 + return sorted(result) 1.1375 + 1.1376 + def AppendFlags(self, options, added): 1.1377 + if not added: 1.1378 + return 1.1379 + for (key, value) in added.iteritems(): 1.1380 + if key.find(':') != -1: 1.1381 + self.AddRelevantSubFlags(options, { key: value }) 1.1382 + else: 1.1383 + if not key in options: 1.1384 + options[key] = value 1.1385 + else: 1.1386 + prefix = options[key] 1.1387 + if isinstance(prefix, StringTypes): prefix = prefix.split() 1.1388 + options[key] = prefix + value 1.1389 + 1.1390 + def ConfigureObject(self, env, input, **kw): 1.1391 + if (kw.has_key('CPPPATH') and env.has_key('CPPPATH')): 1.1392 + kw['CPPPATH'] += env['CPPPATH'] 1.1393 + if self.options['library'] == 'static': 1.1394 + return env.StaticObject(input, **kw) 1.1395 + else: 1.1396 + return env.SharedObject(input, **kw) 1.1397 + 1.1398 + def ApplyEnvOverrides(self, env): 1.1399 + if not self.env_overrides: 1.1400 + return 1.1401 + if type(env['ENV']) == DictType: 1.1402 + env['ENV'].update(**self.env_overrides) 1.1403 + else: 1.1404 + env['ENV'] = self.env_overrides 1.1405 + 1.1406 + 1.1407 +def PostprocessOptions(options, os): 1.1408 + # Adjust architecture if the simulator option has been set 1.1409 + if (options['simulator'] != 'none') and (options['arch'] != options['simulator']): 1.1410 + if 'arch' in ARGUMENTS: 1.1411 + # Print a warning if arch has explicitly been set 1.1412 + print "Warning: forcing architecture to match simulator (%s)" % options['simulator'] 1.1413 + options['arch'] = options['simulator'] 1.1414 + if (options['prof'] != 'off') and (options['profilingsupport'] == 'off'): 1.1415 + # Print a warning if profiling is enabled without profiling support 1.1416 + print "Warning: forcing profilingsupport on when prof is on" 1.1417 + options['profilingsupport'] = 'on' 1.1418 + if os == 'win32' and options['pgo'] != 'off' and options['msvcltcg'] == 'off': 1.1419 + if 'msvcltcg' in ARGUMENTS: 1.1420 + print "Warning: forcing msvcltcg on as it is required for pgo (%s)" % options['pgo'] 1.1421 + options['msvcltcg'] = 'on' 1.1422 + if (options['mipsabi'] != 'none') and (options['arch'] != 'mips') and (options['simulator'] != 'mips'): 1.1423 + options['mipsabi'] = 'none' 1.1424 + if options['liveobjectlist'] == 'on': 1.1425 + if (options['debuggersupport'] != 'on') or (options['mode'] == 'release'): 1.1426 + # Print a warning that liveobjectlist will implicitly enable the debugger 1.1427 + print "Warning: forcing debuggersupport on for liveobjectlist" 1.1428 + options['debuggersupport'] = 'on' 1.1429 + options['inspector'] = 'on' 1.1430 + options['objectprint'] = 'on' 1.1431 + 1.1432 + 1.1433 +def ParseEnvOverrides(arg, imports): 1.1434 + # The environment overrides are in the format NAME0:value0,NAME1:value1,... 1.1435 + # The environment imports are in the format NAME0,NAME1,... 1.1436 + overrides = {} 1.1437 + for var in imports.split(','): 1.1438 + if var in os.environ: 1.1439 + overrides[var] = os.environ[var] 1.1440 + for override in arg.split(','): 1.1441 + pos = override.find(':') 1.1442 + if pos == -1: 1.1443 + continue 1.1444 + overrides[override[:pos].strip()] = override[pos+1:].strip() 1.1445 + return overrides 1.1446 + 1.1447 + 1.1448 +def BuildSpecific(env, mode, env_overrides, tools): 1.1449 + options = {'mode': mode} 1.1450 + for option in ALL_OPTIONS: 1.1451 + options[option] = env[option] 1.1452 + PostprocessOptions(options, env['os']) 1.1453 + 1.1454 + context = BuildContext(options, env_overrides, samples=SplitList(env['sample'])) 1.1455 + 1.1456 + # Remove variables which can't be imported from the user's external 1.1457 + # environment into a construction environment. 1.1458 + user_environ = os.environ.copy() 1.1459 + try: 1.1460 + del user_environ['ENV'] 1.1461 + except KeyError: 1.1462 + pass 1.1463 + 1.1464 + library_flags = context.AddRelevantFlags(user_environ, LIBRARY_FLAGS) 1.1465 + v8_flags = context.AddRelevantFlags(library_flags, V8_EXTRA_FLAGS) 1.1466 + mksnapshot_flags = context.AddRelevantFlags(library_flags, MKSNAPSHOT_EXTRA_FLAGS) 1.1467 + dtoa_flags = context.AddRelevantFlags(library_flags, DTOA_EXTRA_FLAGS) 1.1468 + cctest_flags = context.AddRelevantFlags(v8_flags, CCTEST_EXTRA_FLAGS) 1.1469 + sample_flags = context.AddRelevantFlags(user_environ, SAMPLE_FLAGS) 1.1470 + preparser_flags = context.AddRelevantFlags(user_environ, PREPARSER_FLAGS) 1.1471 + d8_flags = context.AddRelevantFlags(library_flags, D8_FLAGS) 1.1472 + 1.1473 + context.flags = { 1.1474 + 'v8': v8_flags, 1.1475 + 'mksnapshot': mksnapshot_flags, 1.1476 + 'dtoa': dtoa_flags, 1.1477 + 'cctest': cctest_flags, 1.1478 + 'sample': sample_flags, 1.1479 + 'd8': d8_flags, 1.1480 + 'preparser': preparser_flags 1.1481 + } 1.1482 + 1.1483 + # Generate library base name. 1.1484 + target_id = mode 1.1485 + suffix = SUFFIXES[target_id] 1.1486 + library_name = 'v8' + suffix 1.1487 + preparser_library_name = 'v8preparser' + suffix 1.1488 + version = GetVersion() 1.1489 + if context.options['soname'] == 'on': 1.1490 + # When building shared object with SONAME version the library name. 1.1491 + library_name += '-' + version 1.1492 + 1.1493 + # Generate library SONAME if required by the build. 1.1494 + if context.options['soname'] == 'on': 1.1495 + soname = GetSpecificSONAME() 1.1496 + if soname == '': 1.1497 + soname = 'lib' + library_name + '.so' 1.1498 + env['SONAME'] = soname 1.1499 + 1.1500 + # Build the object files by invoking SCons recursively. 1.1501 + d8_env = Environment(tools=tools) 1.1502 + d8_env.Replace(**context.flags['d8']) 1.1503 + (object_files, shell_files, mksnapshot, preparser_files) = env.SConscript( 1.1504 + join('src', 'SConscript'), 1.1505 + build_dir=join('obj', target_id), 1.1506 + exports='context tools d8_env', 1.1507 + duplicate=False 1.1508 + ) 1.1509 + 1.1510 + context.mksnapshot_targets.append(mksnapshot) 1.1511 + 1.1512 + # Link the object files into a library. 1.1513 + env.Replace(**context.flags['v8']) 1.1514 + 1.1515 + context.ApplyEnvOverrides(env) 1.1516 + if context.options['library'] == 'static': 1.1517 + library = env.StaticLibrary(library_name, object_files) 1.1518 + preparser_library = env.StaticLibrary(preparser_library_name, 1.1519 + preparser_files) 1.1520 + else: 1.1521 + # There seems to be a glitch in the way scons decides where to put 1.1522 + # PDB files when compiling using MSVC so we specify it manually. 1.1523 + # This should not affect any other platforms. 1.1524 + pdb_name = library_name + '.dll.pdb' 1.1525 + library = env.SharedLibrary(library_name, object_files, PDB=pdb_name) 1.1526 + preparser_pdb_name = preparser_library_name + '.dll.pdb'; 1.1527 + preparser_soname = 'lib' + preparser_library_name + '.so'; 1.1528 + preparser_library = env.SharedLibrary(preparser_library_name, 1.1529 + preparser_files, 1.1530 + PDB=preparser_pdb_name, 1.1531 + SONAME=preparser_soname) 1.1532 + context.library_targets.append(library) 1.1533 + context.library_targets.append(preparser_library) 1.1534 + 1.1535 + context.ApplyEnvOverrides(d8_env) 1.1536 + if context.options['library'] == 'static': 1.1537 + shell = d8_env.Program('d8' + suffix, object_files + shell_files) 1.1538 + else: 1.1539 + shell = d8_env.Program('d8' + suffix, shell_files) 1.1540 + d8_env.Depends(shell, library) 1.1541 + context.d8_targets.append(shell) 1.1542 + 1.1543 + for sample in context.samples: 1.1544 + sample_env = Environment(tools=tools) 1.1545 + sample_env.Replace(**context.flags['sample']) 1.1546 + sample_env.Prepend(LIBS=[library_name]) 1.1547 + context.ApplyEnvOverrides(sample_env) 1.1548 + sample_object = sample_env.SConscript( 1.1549 + join('samples', 'SConscript'), 1.1550 + build_dir=join('obj', 'sample', sample, target_id), 1.1551 + exports='sample context tools', 1.1552 + duplicate=False 1.1553 + ) 1.1554 + sample_name = sample + suffix 1.1555 + sample_program = sample_env.Program(sample_name, sample_object) 1.1556 + sample_env.Depends(sample_program, library) 1.1557 + context.sample_targets.append(sample_program) 1.1558 + 1.1559 + cctest_env = env.Copy() 1.1560 + cctest_env.Prepend(LIBS=[library_name]) 1.1561 + cctest_program = cctest_env.SConscript( 1.1562 + join('test', 'cctest', 'SConscript'), 1.1563 + build_dir=join('obj', 'test', target_id), 1.1564 + exports='context object_files tools', 1.1565 + duplicate=False 1.1566 + ) 1.1567 + context.cctest_targets.append(cctest_program) 1.1568 + 1.1569 + preparser_env = env.Copy() 1.1570 + preparser_env.Replace(**context.flags['preparser']) 1.1571 + preparser_env.Prepend(LIBS=[preparser_library_name]) 1.1572 + context.ApplyEnvOverrides(preparser_env) 1.1573 + preparser_object = preparser_env.SConscript( 1.1574 + join('preparser', 'SConscript'), 1.1575 + build_dir=join('obj', 'preparser', target_id), 1.1576 + exports='context tools', 1.1577 + duplicate=False 1.1578 + ) 1.1579 + preparser_name = join('obj', 'preparser', target_id, 'preparser') 1.1580 + preparser_program = preparser_env.Program(preparser_name, preparser_object); 1.1581 + preparser_env.Depends(preparser_program, preparser_library) 1.1582 + context.preparser_targets.append(preparser_program) 1.1583 + 1.1584 + return context 1.1585 + 1.1586 + 1.1587 +def Build(): 1.1588 + opts = GetOptions() 1.1589 + tools = GetTools(opts) 1.1590 + env = Environment(options=opts, tools=tools) 1.1591 + 1.1592 + Help(opts.GenerateHelpText(env)) 1.1593 + VerifyOptions(env) 1.1594 + env_overrides = ParseEnvOverrides(env['env'], env['importenv']) 1.1595 + 1.1596 + SourceSignatures(env['sourcesignatures']) 1.1597 + 1.1598 + libraries = [] 1.1599 + mksnapshots = [] 1.1600 + cctests = [] 1.1601 + samples = [] 1.1602 + preparsers = [] 1.1603 + d8s = [] 1.1604 + modes = SplitList(env['mode']) 1.1605 + for mode in modes: 1.1606 + context = BuildSpecific(env.Copy(), mode, env_overrides, tools) 1.1607 + libraries += context.library_targets 1.1608 + mksnapshots += context.mksnapshot_targets 1.1609 + cctests += context.cctest_targets 1.1610 + samples += context.sample_targets 1.1611 + preparsers += context.preparser_targets 1.1612 + d8s += context.d8_targets 1.1613 + 1.1614 + env.Alias('library', libraries) 1.1615 + env.Alias('mksnapshot', mksnapshots) 1.1616 + env.Alias('cctests', cctests) 1.1617 + env.Alias('sample', samples) 1.1618 + env.Alias('d8', d8s) 1.1619 + env.Alias('preparser', preparsers) 1.1620 + 1.1621 + if env['sample']: 1.1622 + env.Default('sample') 1.1623 + else: 1.1624 + env.Default('library') 1.1625 + 1.1626 + if env['cache']: 1.1627 + CacheDir(env['cache']) 1.1628 + 1.1629 +# We disable deprecation warnings because we need to be able to use 1.1630 +# env.Copy without getting warnings for compatibility with older 1.1631 +# version of scons. Also, there's a bug in some revisions that 1.1632 +# doesn't allow this flag to be set, so we swallow any exceptions. 1.1633 +# Lovely. 1.1634 +try: 1.1635 + SetOption('warn', 'no-deprecated') 1.1636 +except: 1.1637 + pass 1.1638 + 1.1639 +Build()