| OLD | NEW |
| (Empty) |
| 1 # Copyright 2012 the V8 project authors. All rights reserved. | |
| 2 # Redistribution and use in source and binary forms, with or without | |
| 3 # modification, are permitted provided that the following conditions are | |
| 4 # met: | |
| 5 # | |
| 6 # * Redistributions of source code must retain the above copyright | |
| 7 # notice, this list of conditions and the following disclaimer. | |
| 8 # * Redistributions in binary form must reproduce the above | |
| 9 # copyright notice, this list of conditions and the following | |
| 10 # disclaimer in the documentation and/or other materials provided | |
| 11 # with the distribution. | |
| 12 # * Neither the name of Google Inc. nor the names of its | |
| 13 # contributors may be used to endorse or promote products derived | |
| 14 # from this software without specific prior written permission. | |
| 15 # | |
| 16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 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. | |
| 27 | |
| 28 import platform | |
| 29 import re | |
| 30 import subprocess | |
| 31 import sys | |
| 32 import os | |
| 33 from os.path import join, dirname, abspath | |
| 34 from types import DictType, StringTypes | |
| 35 root_dir = dirname(File('SConstruct').rfile().abspath) | |
| 36 src_dir = join(root_dir, 'src') | |
| 37 sys.path.insert(0, join(root_dir, 'tools')) | |
| 38 import js2c, utils | |
| 39 | |
| 40 # ARM_TARGET_LIB is the path to the dynamic library to use on the target | |
| 41 # machine if cross-compiling to an arm machine. You will also need to set | |
| 42 # the additional cross-compiling environment variables to the cross compiler. | |
| 43 ARM_TARGET_LIB = os.environ.get('ARM_TARGET_LIB') | |
| 44 if ARM_TARGET_LIB: | |
| 45 ARM_LINK_FLAGS = ['-Wl,-rpath=' + ARM_TARGET_LIB + '/lib:' + | |
| 46 ARM_TARGET_LIB + '/usr/lib', | |
| 47 '-Wl,--dynamic-linker=' + ARM_TARGET_LIB + | |
| 48 '/lib/ld-linux.so.3'] | |
| 49 else: | |
| 50 ARM_LINK_FLAGS = [] | |
| 51 | |
| 52 GCC_EXTRA_CCFLAGS = [] | |
| 53 GCC_DTOA_EXTRA_CCFLAGS = [] | |
| 54 | |
| 55 LIBRARY_FLAGS = { | |
| 56 'all': { | |
| 57 'CPPPATH': [src_dir], | |
| 58 'regexp:interpreted': { | |
| 59 'CPPDEFINES': ['V8_INTERPRETED_REGEXP'] | |
| 60 }, | |
| 61 'mode:debug': { | |
| 62 'CPPDEFINES': ['V8_ENABLE_CHECKS', 'OBJECT_PRINT', 'VERIFY_HEAP'] | |
| 63 }, | |
| 64 'objectprint:on': { | |
| 65 'CPPDEFINES': ['OBJECT_PRINT'], | |
| 66 }, | |
| 67 'debuggersupport:on': { | |
| 68 'CPPDEFINES': ['ENABLE_DEBUGGER_SUPPORT'], | |
| 69 }, | |
| 70 'fasttls:off': { | |
| 71 'CPPDEFINES': ['V8_NO_FAST_TLS'], | |
| 72 }, | |
| 73 }, | |
| 74 'gcc': { | |
| 75 'all': { | |
| 76 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], | |
| 77 'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'], | |
| 78 }, | |
| 79 'visibility:hidden': { | |
| 80 # Use visibility=default to disable this. | |
| 81 'CXXFLAGS': ['-fvisibility=hidden'] | |
| 82 }, | |
| 83 'strictaliasing:off': { | |
| 84 'CCFLAGS': ['-fno-strict-aliasing'] | |
| 85 }, | |
| 86 'mode:debug': { | |
| 87 'CCFLAGS': ['-g', '-O0'], | |
| 88 'CPPDEFINES': ['ENABLE_DISASSEMBLER', 'DEBUG'], | |
| 89 }, | |
| 90 'mode:release': { | |
| 91 'CCFLAGS': ['-O3', '-fomit-frame-pointer', '-fdata-sections', | |
| 92 '-ffunction-sections'], | |
| 93 }, | |
| 94 'os:linux': { | |
| 95 'CCFLAGS': ['-ansi'] + GCC_EXTRA_CCFLAGS, | |
| 96 'library:shared': { | |
| 97 'CPPDEFINES': ['V8_SHARED', 'BUILDING_V8_SHARED'], | |
| 98 'LIBS': ['pthread'] | |
| 99 } | |
| 100 }, | |
| 101 'os:macos': { | |
| 102 'CCFLAGS': ['-ansi', '-mmacosx-version-min=10.4'], | |
| 103 'library:shared': { | |
| 104 'CPPDEFINES': ['V8_SHARED', 'BUILDING_V8_SHARED'], | |
| 105 } | |
| 106 }, | |
| 107 'os:freebsd': { | |
| 108 'CPPPATH' : [src_dir, '/usr/local/include'], | |
| 109 'LIBPATH' : ['/usr/local/lib'], | |
| 110 'CCFLAGS': ['-ansi'], | |
| 111 'LIBS': ['execinfo'] | |
| 112 }, | |
| 113 'os:openbsd': { | |
| 114 'CPPPATH' : [src_dir, '/usr/local/include'], | |
| 115 'LIBPATH' : ['/usr/local/lib'], | |
| 116 'CCFLAGS': ['-ansi'], | |
| 117 }, | |
| 118 'os:solaris': { | |
| 119 # On Solaris, to get isinf, INFINITY, fpclassify and other macros one | |
| 120 # needs to define __C99FEATURES__. | |
| 121 'CPPDEFINES': ['__C99FEATURES__'], | |
| 122 'CPPPATH' : [src_dir, '/usr/local/include'], | |
| 123 'LIBPATH' : ['/usr/local/lib'], | |
| 124 'CCFLAGS': ['-ansi'], | |
| 125 }, | |
| 126 'os:netbsd': { | |
| 127 'CPPPATH' : [src_dir, '/usr/pkg/include'], | |
| 128 'LIBPATH' : ['/usr/pkg/lib'], | |
| 129 }, | |
| 130 'os:win32': { | |
| 131 'CCFLAGS': ['-DWIN32'], | |
| 132 'CXXFLAGS': ['-DWIN32'], | |
| 133 }, | |
| 134 'arch:ia32': { | |
| 135 'CPPDEFINES': ['V8_TARGET_ARCH_IA32'], | |
| 136 'CCFLAGS': ['-m32'], | |
| 137 'LINKFLAGS': ['-m32'] | |
| 138 }, | |
| 139 'arch:arm': { | |
| 140 'CPPDEFINES': ['V8_TARGET_ARCH_ARM'], | |
| 141 'unalignedaccesses:on' : { | |
| 142 'CPPDEFINES' : ['CAN_USE_UNALIGNED_ACCESSES=1'] | |
| 143 }, | |
| 144 'unalignedaccesses:off' : { | |
| 145 'CPPDEFINES' : ['CAN_USE_UNALIGNED_ACCESSES=0'] | |
| 146 }, | |
| 147 'armeabi:soft' : { | |
| 148 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'], | |
| 149 'simulator:none': { | |
| 150 'CCFLAGS': ['-mfloat-abi=soft'], | |
| 151 } | |
| 152 }, | |
| 153 'armeabi:softfp' : { | |
| 154 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'], | |
| 155 'vfp3:on': { | |
| 156 'CPPDEFINES' : ['CAN_USE_VFP_INSTRUCTIONS'] | |
| 157 }, | |
| 158 'simulator:none': { | |
| 159 'CCFLAGS': ['-mfloat-abi=softfp'], | |
| 160 } | |
| 161 }, | |
| 162 'armeabi:hard' : { | |
| 163 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=1'], | |
| 164 'vfp3:on': { | |
| 165 'CPPDEFINES' : ['CAN_USE_VFP_INSTRUCTIONS'] | |
| 166 }, | |
| 167 'simulator:none': { | |
| 168 'CCFLAGS': ['-mfloat-abi=hard'], | |
| 169 } | |
| 170 } | |
| 171 }, | |
| 172 'simulator:arm': { | |
| 173 'CCFLAGS': ['-m32'], | |
| 174 'LINKFLAGS': ['-m32'], | |
| 175 }, | |
| 176 'arch:mips': { | |
| 177 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'], | |
| 178 'mips_arch_variant:mips32r2': { | |
| 179 'CPPDEFINES': ['_MIPS_ARCH_MIPS32R2'] | |
| 180 }, | |
| 181 'mips_arch_variant:loongson': { | |
| 182 'CPPDEFINES': ['_MIPS_ARCH_LOONGSON'] | |
| 183 }, | |
| 184 'simulator:none': { | |
| 185 'CCFLAGS': ['-EL'], | |
| 186 'LINKFLAGS': ['-EL'], | |
| 187 'mips_arch_variant:mips32r2': { | |
| 188 'CCFLAGS': ['-mips32r2', '-Wa,-mips32r2'] | |
| 189 }, | |
| 190 'mips_arch_variant:mips32r1': { | |
| 191 'CCFLAGS': ['-mips32', '-Wa,-mips32'] | |
| 192 }, | |
| 193 'mips_arch_variant:loongson': { | |
| 194 'CCFLAGS': ['-march=mips3', '-Wa,-march=mips3'] | |
| 195 }, | |
| 196 'library:static': { | |
| 197 'LINKFLAGS': ['-static', '-static-libgcc'] | |
| 198 }, | |
| 199 'mipsabi:softfloat': { | |
| 200 'CCFLAGS': ['-msoft-float'], | |
| 201 'LINKFLAGS': ['-msoft-float'] | |
| 202 }, | |
| 203 'mipsabi:hardfloat': { | |
| 204 'CCFLAGS': ['-mhard-float'], | |
| 205 'LINKFLAGS': ['-mhard-float'] | |
| 206 } | |
| 207 } | |
| 208 }, | |
| 209 'simulator:mips': { | |
| 210 'CCFLAGS': ['-m32'], | |
| 211 'LINKFLAGS': ['-m32'], | |
| 212 'mipsabi:softfloat': { | |
| 213 'CPPDEFINES': ['__mips_soft_float=1'], | |
| 214 'fpu:on': { | |
| 215 'CPPDEFINES' : ['CAN_USE_FPU_INSTRUCTIONS'] | |
| 216 } | |
| 217 }, | |
| 218 'mipsabi:hardfloat': { | |
| 219 'CPPDEFINES': ['__mips_hard_float=1', 'CAN_USE_FPU_INSTRUCTIONS'], | |
| 220 } | |
| 221 }, | |
| 222 'arch:x64': { | |
| 223 'CPPDEFINES': ['V8_TARGET_ARCH_X64'], | |
| 224 'CCFLAGS': ['-m64'], | |
| 225 'LINKFLAGS': ['-m64'], | |
| 226 }, | |
| 227 'gdbjit:on': { | |
| 228 'CPPDEFINES': ['ENABLE_GDB_JIT_INTERFACE'] | |
| 229 }, | |
| 230 'compress_startup_data:bz2': { | |
| 231 'CPPDEFINES': ['COMPRESS_STARTUP_DATA_BZ2'] | |
| 232 } | |
| 233 }, | |
| 234 'msvc': { | |
| 235 'all': { | |
| 236 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], | |
| 237 'CXXFLAGS': ['/GR-', '/Gy'], | |
| 238 'CPPDEFINES': ['WIN32'], | |
| 239 'LINKFLAGS': ['/INCREMENTAL:NO', '/NXCOMPAT', '/IGNORE:4221'], | |
| 240 'CCPDBFLAGS': ['/Zi'] | |
| 241 }, | |
| 242 'verbose:off': { | |
| 243 'DIALECTFLAGS': ['/nologo'], | |
| 244 'ARFLAGS': ['/NOLOGO'] | |
| 245 }, | |
| 246 'arch:ia32': { | |
| 247 'CPPDEFINES': ['V8_TARGET_ARCH_IA32', '_USE_32BIT_TIME_T'], | |
| 248 'LINKFLAGS': ['/MACHINE:X86'], | |
| 249 'ARFLAGS': ['/MACHINE:X86'] | |
| 250 }, | |
| 251 'arch:x64': { | |
| 252 'CPPDEFINES': ['V8_TARGET_ARCH_X64'], | |
| 253 'LINKFLAGS': ['/MACHINE:X64'], | |
| 254 'ARFLAGS': ['/MACHINE:X64'] | |
| 255 }, | |
| 256 'mode:debug': { | |
| 257 'CCFLAGS': ['/Od', '/Gm'], | |
| 258 'CPPDEFINES': ['_DEBUG', 'ENABLE_DISASSEMBLER', 'DEBUG'], | |
| 259 'LINKFLAGS': ['/DEBUG'], | |
| 260 'msvcrt:static': { | |
| 261 'CCFLAGS': ['/MTd'] | |
| 262 }, | |
| 263 'msvcrt:shared': { | |
| 264 'CCFLAGS': ['/MDd'] | |
| 265 } | |
| 266 }, | |
| 267 'mode:release': { | |
| 268 'CCFLAGS': ['/O2'], | |
| 269 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'], | |
| 270 'msvcrt:static': { | |
| 271 'CCFLAGS': ['/MT'] | |
| 272 }, | |
| 273 'msvcrt:shared': { | |
| 274 'CCFLAGS': ['/MD'] | |
| 275 }, | |
| 276 'msvcltcg:on': { | |
| 277 'CCFLAGS': ['/GL'], | |
| 278 'ARFLAGS': ['/LTCG'], | |
| 279 'pgo:off': { | |
| 280 'LINKFLAGS': ['/LTCG'], | |
| 281 }, | |
| 282 'pgo:instrument': { | |
| 283 'LINKFLAGS': ['/LTCG:PGI'] | |
| 284 }, | |
| 285 'pgo:optimize': { | |
| 286 'LINKFLAGS': ['/LTCG:PGO'] | |
| 287 } | |
| 288 } | |
| 289 } | |
| 290 } | |
| 291 } | |
| 292 | |
| 293 | |
| 294 V8_EXTRA_FLAGS = { | |
| 295 'gcc': { | |
| 296 'all': { | |
| 297 'WARNINGFLAGS': ['-Wall', | |
| 298 '-Werror', | |
| 299 '-W', | |
| 300 '-Wno-unused-parameter', | |
| 301 '-Woverloaded-virtual', | |
| 302 '-Wnon-virtual-dtor'] | |
| 303 }, | |
| 304 'os:win32': { | |
| 305 'WARNINGFLAGS': ['-pedantic', | |
| 306 '-Wno-long-long', | |
| 307 '-Wno-pedantic-ms-format'], | |
| 308 'library:shared': { | |
| 309 'LIBS': ['winmm', 'ws2_32'] | |
| 310 } | |
| 311 }, | |
| 312 'os:linux': { | |
| 313 'WARNINGFLAGS': ['-pedantic'], | |
| 314 'library:shared': { | |
| 315 'soname:on': { | |
| 316 'LINKFLAGS': ['-Wl,-soname,${SONAME}'] | |
| 317 } | |
| 318 } | |
| 319 }, | |
| 320 'os:macos': { | |
| 321 'WARNINGFLAGS': ['-pedantic'] | |
| 322 }, | |
| 323 'arch:arm': { | |
| 324 # This is to silence warnings about ABI changes that some versions of the | |
| 325 # CodeSourcery G++ tool chain produce for each occurrence of varargs. | |
| 326 'WARNINGFLAGS': ['-Wno-abi'] | |
| 327 }, | |
| 328 'disassembler:on': { | |
| 329 'CPPDEFINES': ['ENABLE_DISASSEMBLER'] | |
| 330 } | |
| 331 }, | |
| 332 'msvc': { | |
| 333 'all': { | |
| 334 'WARNINGFLAGS': ['/W3', '/WX', '/wd4351', '/wd4355', '/wd4800'] | |
| 335 }, | |
| 336 'library:shared': { | |
| 337 'CPPDEFINES': ['BUILDING_V8_SHARED'], | |
| 338 'LIBS': ['winmm', 'ws2_32'] | |
| 339 }, | |
| 340 'arch:arm': { | |
| 341 'CPPDEFINES': ['V8_TARGET_ARCH_ARM'], | |
| 342 # /wd4996 is to silence the warning about sscanf | |
| 343 # used by the arm simulator. | |
| 344 'WARNINGFLAGS': ['/wd4996'] | |
| 345 }, | |
| 346 'arch:mips': { | |
| 347 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'], | |
| 348 'mips_arch_variant:mips32r2': { | |
| 349 'CPPDEFINES': ['_MIPS_ARCH_MIPS32R2'] | |
| 350 }, | |
| 351 }, | |
| 352 'disassembler:on': { | |
| 353 'CPPDEFINES': ['ENABLE_DISASSEMBLER'] | |
| 354 } | |
| 355 } | |
| 356 } | |
| 357 | |
| 358 | |
| 359 MKSNAPSHOT_EXTRA_FLAGS = { | |
| 360 'gcc': { | |
| 361 'os:linux': { | |
| 362 'LIBS': ['pthread'], | |
| 363 }, | |
| 364 'os:macos': { | |
| 365 'LIBS': ['pthread'], | |
| 366 }, | |
| 367 'os:freebsd': { | |
| 368 'LIBS': ['execinfo', 'pthread'] | |
| 369 }, | |
| 370 'os:solaris': { | |
| 371 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], | |
| 372 'LINKFLAGS': ['-mt'] | |
| 373 }, | |
| 374 'os:openbsd': { | |
| 375 'LIBS': ['execinfo', 'pthread'] | |
| 376 }, | |
| 377 'os:win32': { | |
| 378 'LIBS': ['winmm', 'ws2_32'], | |
| 379 }, | |
| 380 'os:netbsd': { | |
| 381 'LIBS': ['execinfo', 'pthread'] | |
| 382 }, | |
| 383 'compress_startup_data:bz2': { | |
| 384 'os:linux': { | |
| 385 'LIBS': ['bz2'] | |
| 386 } | |
| 387 }, | |
| 388 }, | |
| 389 'msvc': { | |
| 390 'all': { | |
| 391 'CPPDEFINES': ['_HAS_EXCEPTIONS=0'], | |
| 392 'LIBS': ['winmm', 'ws2_32'] | |
| 393 } | |
| 394 } | |
| 395 } | |
| 396 | |
| 397 | |
| 398 DTOA_EXTRA_FLAGS = { | |
| 399 'gcc': { | |
| 400 'all': { | |
| 401 'WARNINGFLAGS': ['-Werror', '-Wno-uninitialized'], | |
| 402 'CCFLAGS': GCC_DTOA_EXTRA_CCFLAGS | |
| 403 } | |
| 404 }, | |
| 405 'msvc': { | |
| 406 'all': { | |
| 407 'WARNINGFLAGS': ['/WX', '/wd4018', '/wd4244'] | |
| 408 } | |
| 409 } | |
| 410 } | |
| 411 | |
| 412 | |
| 413 CCTEST_EXTRA_FLAGS = { | |
| 414 'all': { | |
| 415 'CPPPATH': [src_dir], | |
| 416 'library:shared': { | |
| 417 'CPPDEFINES': ['USING_V8_SHARED'] | |
| 418 }, | |
| 419 }, | |
| 420 'gcc': { | |
| 421 'all': { | |
| 422 'LIBPATH': [abspath('.')], | |
| 423 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], | |
| 424 'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'], | |
| 425 'LINKFLAGS': ['$CCFLAGS'], | |
| 426 }, | |
| 427 'os:linux': { | |
| 428 'LIBS': ['pthread'], | |
| 429 'CCFLAGS': ['-Wno-unused-but-set-variable'], | |
| 430 }, | |
| 431 'os:macos': { | |
| 432 'LIBS': ['pthread'], | |
| 433 }, | |
| 434 'os:freebsd': { | |
| 435 'LIBS': ['execinfo', 'pthread'] | |
| 436 }, | |
| 437 'os:solaris': { | |
| 438 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], | |
| 439 'LINKFLAGS': ['-mt'] | |
| 440 }, | |
| 441 'os:openbsd': { | |
| 442 'LIBS': ['execinfo', 'pthread'] | |
| 443 }, | |
| 444 'os:win32': { | |
| 445 'LIBS': ['winmm', 'ws2_32'] | |
| 446 }, | |
| 447 'os:netbsd': { | |
| 448 'LIBS': ['execinfo', 'pthread'] | |
| 449 }, | |
| 450 'arch:arm': { | |
| 451 'LINKFLAGS': ARM_LINK_FLAGS | |
| 452 }, | |
| 453 }, | |
| 454 'msvc': { | |
| 455 'all': { | |
| 456 'CPPDEFINES': ['_HAS_EXCEPTIONS=0'], | |
| 457 'LIBS': ['winmm', 'ws2_32'] | |
| 458 }, | |
| 459 'arch:ia32': { | |
| 460 'CPPDEFINES': ['V8_TARGET_ARCH_IA32'] | |
| 461 }, | |
| 462 'arch:x64': { | |
| 463 'CPPDEFINES': ['V8_TARGET_ARCH_X64'], | |
| 464 'LINKFLAGS': ['/STACK:2097152'] | |
| 465 }, | |
| 466 } | |
| 467 } | |
| 468 | |
| 469 | |
| 470 SAMPLE_FLAGS = { | |
| 471 'all': { | |
| 472 'CPPPATH': [join(root_dir, 'include')], | |
| 473 'library:shared': { | |
| 474 'CPPDEFINES': ['USING_V8_SHARED'] | |
| 475 }, | |
| 476 }, | |
| 477 'gcc': { | |
| 478 'all': { | |
| 479 'LIBPATH': ['.'], | |
| 480 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], | |
| 481 'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'], | |
| 482 'LINKFLAGS': ['$CCFLAGS'], | |
| 483 }, | |
| 484 'os:linux': { | |
| 485 'LIBS': ['pthread'], | |
| 486 }, | |
| 487 'os:macos': { | |
| 488 'LIBS': ['pthread'], | |
| 489 }, | |
| 490 'os:freebsd': { | |
| 491 'LIBPATH' : ['/usr/local/lib'], | |
| 492 'LIBS': ['execinfo', 'pthread'] | |
| 493 }, | |
| 494 'os:solaris': { | |
| 495 # On Solaris, to get isinf, INFINITY, fpclassify and other macros one | |
| 496 # needs to define __C99FEATURES__. | |
| 497 'CPPDEFINES': ['__C99FEATURES__'], | |
| 498 'LIBPATH' : ['/usr/local/lib'], | |
| 499 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], | |
| 500 'LINKFLAGS': ['-mt'] | |
| 501 }, | |
| 502 'os:openbsd': { | |
| 503 'LIBPATH' : ['/usr/local/lib'], | |
| 504 'LIBS': ['execinfo', 'pthread'] | |
| 505 }, | |
| 506 'os:win32': { | |
| 507 'LIBS': ['winmm', 'ws2_32'] | |
| 508 }, | |
| 509 'os:netbsd': { | |
| 510 'LIBPATH' : ['/usr/pkg/lib'], | |
| 511 'LIBS': ['execinfo', 'pthread'] | |
| 512 }, | |
| 513 'arch:arm': { | |
| 514 'LINKFLAGS': ARM_LINK_FLAGS, | |
| 515 'armeabi:soft' : { | |
| 516 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'], | |
| 517 'simulator:none': { | |
| 518 'CCFLAGS': ['-mfloat-abi=soft'], | |
| 519 } | |
| 520 }, | |
| 521 'armeabi:softfp' : { | |
| 522 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'], | |
| 523 'simulator:none': { | |
| 524 'CCFLAGS': ['-mfloat-abi=softfp'], | |
| 525 } | |
| 526 }, | |
| 527 'armeabi:hard' : { | |
| 528 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=1'], | |
| 529 'vfp3:on': { | |
| 530 'CPPDEFINES' : ['CAN_USE_VFP_INSTRUCTIONS'] | |
| 531 }, | |
| 532 'simulator:none': { | |
| 533 'CCFLAGS': ['-mfloat-abi=hard'], | |
| 534 } | |
| 535 } | |
| 536 }, | |
| 537 'arch:ia32': { | |
| 538 'CCFLAGS': ['-m32'], | |
| 539 'LINKFLAGS': ['-m32'] | |
| 540 }, | |
| 541 'arch:x64': { | |
| 542 'CCFLAGS': ['-m64'], | |
| 543 'LINKFLAGS': ['-m64'] | |
| 544 }, | |
| 545 'arch:mips': { | |
| 546 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'], | |
| 547 'mips_arch_variant:mips32r2': { | |
| 548 'CPPDEFINES': ['_MIPS_ARCH_MIPS32R2'] | |
| 549 }, | |
| 550 'mips_arch_variant:loongson': { | |
| 551 'CPPDEFINES': ['_MIPS_ARCH_LOONGSON'] | |
| 552 }, | |
| 553 'simulator:none': { | |
| 554 'CCFLAGS': ['-EL'], | |
| 555 'LINKFLAGS': ['-EL'], | |
| 556 'mips_arch_variant:mips32r2': { | |
| 557 'CCFLAGS': ['-mips32r2', '-Wa,-mips32r2'] | |
| 558 }, | |
| 559 'mips_arch_variant:mips32r1': { | |
| 560 'CCFLAGS': ['-mips32', '-Wa,-mips32'] | |
| 561 }, | |
| 562 'mips_arch_variant:loongson': { | |
| 563 'CCFLAGS': ['-march=mips3', '-Wa,-march=mips3'] | |
| 564 }, | |
| 565 'library:static': { | |
| 566 'LINKFLAGS': ['-static', '-static-libgcc'] | |
| 567 }, | |
| 568 'mipsabi:softfloat': { | |
| 569 'CCFLAGS': ['-msoft-float'], | |
| 570 'LINKFLAGS': ['-msoft-float'] | |
| 571 }, | |
| 572 'mipsabi:hardfloat': { | |
| 573 'CCFLAGS': ['-mhard-float'], | |
| 574 'LINKFLAGS': ['-mhard-float'], | |
| 575 'fpu:on': { | |
| 576 'CPPDEFINES' : ['CAN_USE_FPU_INSTRUCTIONS'] | |
| 577 } | |
| 578 } | |
| 579 } | |
| 580 }, | |
| 581 'simulator:arm': { | |
| 582 'CCFLAGS': ['-m32'], | |
| 583 'LINKFLAGS': ['-m32'] | |
| 584 }, | |
| 585 'simulator:mips': { | |
| 586 'CCFLAGS': ['-m32'], | |
| 587 'LINKFLAGS': ['-m32'] | |
| 588 }, | |
| 589 'mode:release': { | |
| 590 'CCFLAGS': ['-O2'] | |
| 591 }, | |
| 592 'mode:debug': { | |
| 593 'CCFLAGS': ['-g', '-O0'], | |
| 594 'CPPDEFINES': ['DEBUG'] | |
| 595 }, | |
| 596 'compress_startup_data:bz2': { | |
| 597 'CPPDEFINES': ['COMPRESS_STARTUP_DATA_BZ2'], | |
| 598 'os:linux': { | |
| 599 'LIBS': ['bz2'] | |
| 600 } | |
| 601 }, | |
| 602 }, | |
| 603 'msvc': { | |
| 604 'all': { | |
| 605 'LIBS': ['winmm', 'ws2_32'] | |
| 606 }, | |
| 607 'verbose:off': { | |
| 608 'CCFLAGS': ['/nologo'], | |
| 609 'LINKFLAGS': ['/NOLOGO'] | |
| 610 }, | |
| 611 'verbose:on': { | |
| 612 'LINKFLAGS': ['/VERBOSE'] | |
| 613 }, | |
| 614 'prof:on': { | |
| 615 'LINKFLAGS': ['/MAP'] | |
| 616 }, | |
| 617 'mode:release': { | |
| 618 'CCFLAGS': ['/O2'], | |
| 619 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'], | |
| 620 'msvcrt:static': { | |
| 621 'CCFLAGS': ['/MT'] | |
| 622 }, | |
| 623 'msvcrt:shared': { | |
| 624 'CCFLAGS': ['/MD'] | |
| 625 }, | |
| 626 'msvcltcg:on': { | |
| 627 'CCFLAGS': ['/GL'], | |
| 628 'pgo:off': { | |
| 629 'LINKFLAGS': ['/LTCG'], | |
| 630 }, | |
| 631 }, | |
| 632 'pgo:instrument': { | |
| 633 'LINKFLAGS': ['/LTCG:PGI'] | |
| 634 }, | |
| 635 'pgo:optimize': { | |
| 636 'LINKFLAGS': ['/LTCG:PGO'] | |
| 637 } | |
| 638 }, | |
| 639 'arch:ia32': { | |
| 640 'CPPDEFINES': ['V8_TARGET_ARCH_IA32', 'WIN32'], | |
| 641 'LINKFLAGS': ['/MACHINE:X86'] | |
| 642 }, | |
| 643 'arch:x64': { | |
| 644 'CPPDEFINES': ['V8_TARGET_ARCH_X64', 'WIN32'], | |
| 645 'LINKFLAGS': ['/MACHINE:X64', '/STACK:2097152'] | |
| 646 }, | |
| 647 'mode:debug': { | |
| 648 'CCFLAGS': ['/Od'], | |
| 649 'LINKFLAGS': ['/DEBUG'], | |
| 650 'CPPDEFINES': ['DEBUG'], | |
| 651 'msvcrt:static': { | |
| 652 'CCFLAGS': ['/MTd'] | |
| 653 }, | |
| 654 'msvcrt:shared': { | |
| 655 'CCFLAGS': ['/MDd'] | |
| 656 } | |
| 657 } | |
| 658 } | |
| 659 } | |
| 660 | |
| 661 | |
| 662 PREPARSER_FLAGS = { | |
| 663 'all': { | |
| 664 'CPPPATH': [join(root_dir, 'include'), src_dir], | |
| 665 'library:shared': { | |
| 666 'CPPDEFINES': ['USING_V8_SHARED'] | |
| 667 }, | |
| 668 }, | |
| 669 'gcc': { | |
| 670 'all': { | |
| 671 'LIBPATH': ['.'], | |
| 672 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], | |
| 673 'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'], | |
| 674 'LINKFLAGS': ['$CCFLAGS'], | |
| 675 }, | |
| 676 'os:win32': { | |
| 677 'LIBS': ['winmm', 'ws2_32'] | |
| 678 }, | |
| 679 'arch:arm': { | |
| 680 'LINKFLAGS': ARM_LINK_FLAGS, | |
| 681 'armeabi:soft' : { | |
| 682 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'], | |
| 683 'simulator:none': { | |
| 684 'CCFLAGS': ['-mfloat-abi=soft'], | |
| 685 } | |
| 686 }, | |
| 687 'armeabi:softfp' : { | |
| 688 'simulator:none': { | |
| 689 'CCFLAGS': ['-mfloat-abi=softfp'], | |
| 690 } | |
| 691 }, | |
| 692 'armeabi:hard' : { | |
| 693 'simulator:none': { | |
| 694 'CCFLAGS': ['-mfloat-abi=hard'], | |
| 695 } | |
| 696 } | |
| 697 }, | |
| 698 'arch:ia32': { | |
| 699 'CCFLAGS': ['-m32'], | |
| 700 'LINKFLAGS': ['-m32'] | |
| 701 }, | |
| 702 'arch:x64': { | |
| 703 'CCFLAGS': ['-m64'], | |
| 704 'LINKFLAGS': ['-m64'] | |
| 705 }, | |
| 706 'arch:mips': { | |
| 707 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'], | |
| 708 'mips_arch_variant:mips32r2': { | |
| 709 'CPPDEFINES': ['_MIPS_ARCH_MIPS32R2'] | |
| 710 }, | |
| 711 'mips_arch_variant:loongson': { | |
| 712 'CPPDEFINES': ['_MIPS_ARCH_LOONGSON'] | |
| 713 }, | |
| 714 'simulator:none': { | |
| 715 'CCFLAGS': ['-EL'], | |
| 716 'LINKFLAGS': ['-EL'], | |
| 717 'mips_arch_variant:mips32r2': { | |
| 718 'CCFLAGS': ['-mips32r2', '-Wa,-mips32r2'] | |
| 719 }, | |
| 720 'mips_arch_variant:mips32r1': { | |
| 721 'CCFLAGS': ['-mips32', '-Wa,-mips32'] | |
| 722 }, | |
| 723 'mips_arch_variant:loongson': { | |
| 724 'CCFLAGS': ['-march=mips3', '-Wa,-march=mips3'] | |
| 725 }, | |
| 726 'library:static': { | |
| 727 'LINKFLAGS': ['-static', '-static-libgcc'] | |
| 728 }, | |
| 729 'mipsabi:softfloat': { | |
| 730 'CCFLAGS': ['-msoft-float'], | |
| 731 'LINKFLAGS': ['-msoft-float'] | |
| 732 }, | |
| 733 'mipsabi:hardfloat': { | |
| 734 'CCFLAGS': ['-mhard-float'], | |
| 735 'LINKFLAGS': ['-mhard-float'] | |
| 736 } | |
| 737 } | |
| 738 }, | |
| 739 'simulator:arm': { | |
| 740 'CCFLAGS': ['-m32'], | |
| 741 'LINKFLAGS': ['-m32'] | |
| 742 }, | |
| 743 'simulator:mips': { | |
| 744 'CCFLAGS': ['-m32'], | |
| 745 'LINKFLAGS': ['-m32'], | |
| 746 'mipsabi:softfloat': { | |
| 747 'CPPDEFINES': ['__mips_soft_float=1'], | |
| 748 }, | |
| 749 'mipsabi:hardfloat': { | |
| 750 'CPPDEFINES': ['__mips_hard_float=1'], | |
| 751 } | |
| 752 }, | |
| 753 'mode:release': { | |
| 754 'CCFLAGS': ['-O2'] | |
| 755 }, | |
| 756 'mode:debug': { | |
| 757 'CCFLAGS': ['-g', '-O0'], | |
| 758 'CPPDEFINES': ['DEBUG'] | |
| 759 }, | |
| 760 'os:freebsd': { | |
| 761 'LIBPATH' : ['/usr/local/lib'], | |
| 762 }, | |
| 763 }, | |
| 764 'msvc': { | |
| 765 'all': { | |
| 766 'LIBS': ['winmm', 'ws2_32'] | |
| 767 }, | |
| 768 'verbose:off': { | |
| 769 'CCFLAGS': ['/nologo'], | |
| 770 'LINKFLAGS': ['/NOLOGO'] | |
| 771 }, | |
| 772 'verbose:on': { | |
| 773 'LINKFLAGS': ['/VERBOSE'] | |
| 774 }, | |
| 775 'prof:on': { | |
| 776 'LINKFLAGS': ['/MAP'] | |
| 777 }, | |
| 778 'mode:release': { | |
| 779 'CCFLAGS': ['/O2'], | |
| 780 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'], | |
| 781 'msvcrt:static': { | |
| 782 'CCFLAGS': ['/MT'] | |
| 783 }, | |
| 784 'msvcrt:shared': { | |
| 785 'CCFLAGS': ['/MD'] | |
| 786 }, | |
| 787 'msvcltcg:on': { | |
| 788 'CCFLAGS': ['/GL'], | |
| 789 'pgo:off': { | |
| 790 'LINKFLAGS': ['/LTCG'], | |
| 791 }, | |
| 792 }, | |
| 793 'pgo:instrument': { | |
| 794 'LINKFLAGS': ['/LTCG:PGI'] | |
| 795 }, | |
| 796 'pgo:optimize': { | |
| 797 'LINKFLAGS': ['/LTCG:PGO'] | |
| 798 } | |
| 799 }, | |
| 800 'arch:ia32': { | |
| 801 'CPPDEFINES': ['V8_TARGET_ARCH_IA32', 'WIN32'], | |
| 802 'LINKFLAGS': ['/MACHINE:X86'] | |
| 803 }, | |
| 804 'arch:x64': { | |
| 805 'CPPDEFINES': ['V8_TARGET_ARCH_X64', 'WIN32'], | |
| 806 'LINKFLAGS': ['/MACHINE:X64', '/STACK:2097152'] | |
| 807 }, | |
| 808 'mode:debug': { | |
| 809 'CCFLAGS': ['/Od'], | |
| 810 'LINKFLAGS': ['/DEBUG'], | |
| 811 'CPPDEFINES': ['DEBUG'], | |
| 812 'msvcrt:static': { | |
| 813 'CCFLAGS': ['/MTd'] | |
| 814 }, | |
| 815 'msvcrt:shared': { | |
| 816 'CCFLAGS': ['/MDd'] | |
| 817 } | |
| 818 } | |
| 819 } | |
| 820 } | |
| 821 | |
| 822 | |
| 823 D8_FLAGS = { | |
| 824 'all': { | |
| 825 'library:shared': { | |
| 826 'CPPDEFINES': ['V8_SHARED'], | |
| 827 'LIBS': ['v8'], | |
| 828 'LIBPATH': ['.'] | |
| 829 }, | |
| 830 }, | |
| 831 'gcc': { | |
| 832 'all': { | |
| 833 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], | |
| 834 'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'], | |
| 835 'LINKFLAGS': ['$CCFLAGS'], | |
| 836 }, | |
| 837 'console:readline': { | |
| 838 'LIBS': ['readline'] | |
| 839 }, | |
| 840 'os:linux': { | |
| 841 'LIBS': ['pthread'], | |
| 842 }, | |
| 843 'os:macos': { | |
| 844 'LIBS': ['pthread'], | |
| 845 }, | |
| 846 'os:freebsd': { | |
| 847 'LIBS': ['pthread'], | |
| 848 }, | |
| 849 'os:solaris': { | |
| 850 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], | |
| 851 'LINKFLAGS': ['-mt'] | |
| 852 }, | |
| 853 'os:openbsd': { | |
| 854 'LIBS': ['pthread'], | |
| 855 }, | |
| 856 'os:win32': { | |
| 857 'LIBS': ['winmm', 'ws2_32'], | |
| 858 }, | |
| 859 'os:netbsd': { | |
| 860 'LIBS': ['pthread'], | |
| 861 }, | |
| 862 'arch:arm': { | |
| 863 'LINKFLAGS': ARM_LINK_FLAGS | |
| 864 }, | |
| 865 'compress_startup_data:bz2': { | |
| 866 'CPPDEFINES': ['COMPRESS_STARTUP_DATA_BZ2'], | |
| 867 'os:linux': { | |
| 868 'LIBS': ['bz2'] | |
| 869 } | |
| 870 } | |
| 871 }, | |
| 872 'msvc': { | |
| 873 'all': { | |
| 874 'LIBS': ['winmm', 'ws2_32'] | |
| 875 }, | |
| 876 'verbose:off': { | |
| 877 'CCFLAGS': ['/nologo'], | |
| 878 'LINKFLAGS': ['/NOLOGO'] | |
| 879 }, | |
| 880 'verbose:on': { | |
| 881 'LINKFLAGS': ['/VERBOSE'] | |
| 882 }, | |
| 883 'prof:on': { | |
| 884 'LINKFLAGS': ['/MAP'] | |
| 885 }, | |
| 886 'mode:release': { | |
| 887 'CCFLAGS': ['/O2'], | |
| 888 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'], | |
| 889 'msvcrt:static': { | |
| 890 'CCFLAGS': ['/MT'] | |
| 891 }, | |
| 892 'msvcrt:shared': { | |
| 893 'CCFLAGS': ['/MD'] | |
| 894 }, | |
| 895 'msvcltcg:on': { | |
| 896 'CCFLAGS': ['/GL'], | |
| 897 'pgo:off': { | |
| 898 'LINKFLAGS': ['/LTCG'], | |
| 899 }, | |
| 900 }, | |
| 901 'pgo:instrument': { | |
| 902 'LINKFLAGS': ['/LTCG:PGI'] | |
| 903 }, | |
| 904 'pgo:optimize': { | |
| 905 'LINKFLAGS': ['/LTCG:PGO'] | |
| 906 } | |
| 907 }, | |
| 908 'arch:ia32': { | |
| 909 'CPPDEFINES': ['V8_TARGET_ARCH_IA32', 'WIN32'], | |
| 910 'LINKFLAGS': ['/MACHINE:X86'] | |
| 911 }, | |
| 912 'arch:x64': { | |
| 913 'CPPDEFINES': ['V8_TARGET_ARCH_X64', 'WIN32'], | |
| 914 'LINKFLAGS': ['/MACHINE:X64', '/STACK:2097152'] | |
| 915 }, | |
| 916 'mode:debug': { | |
| 917 'CCFLAGS': ['/Od'], | |
| 918 'LINKFLAGS': ['/DEBUG'], | |
| 919 'CPPDEFINES': ['DEBUG'], | |
| 920 'msvcrt:static': { | |
| 921 'CCFLAGS': ['/MTd'] | |
| 922 }, | |
| 923 'msvcrt:shared': { | |
| 924 'CCFLAGS': ['/MDd'] | |
| 925 } | |
| 926 } | |
| 927 } | |
| 928 } | |
| 929 | |
| 930 | |
| 931 SUFFIXES = { | |
| 932 'release': '', | |
| 933 'debug': '_g' | |
| 934 } | |
| 935 | |
| 936 | |
| 937 def Abort(message): | |
| 938 print message | |
| 939 sys.exit(1) | |
| 940 | |
| 941 | |
| 942 def GuessOS(env): | |
| 943 return utils.GuessOS() | |
| 944 | |
| 945 | |
| 946 def GuessArch(env): | |
| 947 return utils.GuessArchitecture() | |
| 948 | |
| 949 | |
| 950 def GuessToolchain(env): | |
| 951 tools = env['TOOLS'] | |
| 952 if 'gcc' in tools: | |
| 953 return 'gcc' | |
| 954 elif 'msvc' in tools: | |
| 955 return 'msvc' | |
| 956 else: | |
| 957 return None | |
| 958 | |
| 959 | |
| 960 def GuessVisibility(env): | |
| 961 os = env['os'] | |
| 962 toolchain = env['toolchain']; | |
| 963 if (os == 'win32' or os == 'cygwin') and toolchain == 'gcc': | |
| 964 # MinGW / Cygwin can't do it. | |
| 965 return 'default' | |
| 966 elif os == 'solaris': | |
| 967 return 'default' | |
| 968 else: | |
| 969 return 'hidden' | |
| 970 | |
| 971 | |
| 972 def GuessStrictAliasing(env): | |
| 973 # There seems to be a problem with gcc 4.5.x. | |
| 974 # See http://code.google.com/p/v8/issues/detail?id=884 | |
| 975 # It can be worked around by disabling strict aliasing. | |
| 976 toolchain = env['toolchain']; | |
| 977 if toolchain == 'gcc': | |
| 978 env = Environment(tools=['gcc']) | |
| 979 # The gcc version should be available in env['CCVERSION'], | |
| 980 # but when scons detects msvc this value is not set. | |
| 981 version = subprocess.Popen([env['CC'], '-dumpversion'], | |
| 982 stdout=subprocess.PIPE).communicate()[0] | |
| 983 if version.find('4.5') == 0: | |
| 984 return 'off' | |
| 985 return 'default' | |
| 986 | |
| 987 | |
| 988 PLATFORM_OPTIONS = { | |
| 989 'arch': { | |
| 990 'values': ['arm', 'ia32', 'x64', 'mips'], | |
| 991 'guess': GuessArch, | |
| 992 'help': 'the architecture to build for' | |
| 993 }, | |
| 994 'os': { | |
| 995 'values': ['freebsd', 'linux', 'macos', 'win32', 'openbsd', 'solaris', 'cygw
in', 'netbsd'], | |
| 996 'guess': GuessOS, | |
| 997 'help': 'the os to build for' | |
| 998 }, | |
| 999 'toolchain': { | |
| 1000 'values': ['gcc', 'msvc'], | |
| 1001 'guess': GuessToolchain, | |
| 1002 'help': 'the toolchain to use' | |
| 1003 } | |
| 1004 } | |
| 1005 | |
| 1006 SIMPLE_OPTIONS = { | |
| 1007 'regexp': { | |
| 1008 'values': ['native', 'interpreted'], | |
| 1009 'default': 'native', | |
| 1010 'help': 'Whether to use native or interpreted regexp implementation' | |
| 1011 }, | |
| 1012 'snapshot': { | |
| 1013 'values': ['on', 'off', 'nobuild'], | |
| 1014 'default': 'off', | |
| 1015 'help': 'build using snapshots for faster start-up' | |
| 1016 }, | |
| 1017 'prof': { | |
| 1018 'values': ['on', 'off'], | |
| 1019 'default': 'off', | |
| 1020 'help': 'enable profiling of build target' | |
| 1021 }, | |
| 1022 'gdbjit': { | |
| 1023 'values': ['on', 'off'], | |
| 1024 'default': 'off', | |
| 1025 'help': 'enable GDB JIT interface' | |
| 1026 }, | |
| 1027 'library': { | |
| 1028 'values': ['static', 'shared'], | |
| 1029 'default': 'static', | |
| 1030 'help': 'the type of library to produce' | |
| 1031 }, | |
| 1032 'objectprint': { | |
| 1033 'values': ['on', 'off'], | |
| 1034 'default': 'off', | |
| 1035 'help': 'enable object printing' | |
| 1036 }, | |
| 1037 'profilingsupport': { | |
| 1038 'values': ['on', 'off'], | |
| 1039 'default': 'on', | |
| 1040 'help': 'enable profiling of JavaScript code' | |
| 1041 }, | |
| 1042 'debuggersupport': { | |
| 1043 'values': ['on', 'off'], | |
| 1044 'default': 'on', | |
| 1045 'help': 'enable debugging of JavaScript code' | |
| 1046 }, | |
| 1047 'soname': { | |
| 1048 'values': ['on', 'off'], | |
| 1049 'default': 'off', | |
| 1050 'help': 'turn on setting soname for Linux shared library' | |
| 1051 }, | |
| 1052 'msvcrt': { | |
| 1053 'values': ['static', 'shared'], | |
| 1054 'default': 'static', | |
| 1055 'help': 'the type of Microsoft Visual C++ runtime library to use' | |
| 1056 }, | |
| 1057 'msvcltcg': { | |
| 1058 'values': ['on', 'off'], | |
| 1059 'default': 'on', | |
| 1060 'help': 'use Microsoft Visual C++ link-time code generation' | |
| 1061 }, | |
| 1062 'simulator': { | |
| 1063 'values': ['arm', 'mips', 'none'], | |
| 1064 'default': 'none', | |
| 1065 'help': 'build with simulator' | |
| 1066 }, | |
| 1067 'unalignedaccesses': { | |
| 1068 'values': ['default', 'on', 'off'], | |
| 1069 'default': 'default', | |
| 1070 'help': 'set whether the ARM target supports unaligned accesses' | |
| 1071 }, | |
| 1072 'disassembler': { | |
| 1073 'values': ['on', 'off'], | |
| 1074 'default': 'off', | |
| 1075 'help': 'enable the disassembler to inspect generated code' | |
| 1076 }, | |
| 1077 'fasttls': { | |
| 1078 'values': ['on', 'off'], | |
| 1079 'default': 'on', | |
| 1080 'help': 'enable fast thread local storage support ' | |
| 1081 '(if available on the current architecture/platform)' | |
| 1082 }, | |
| 1083 'sourcesignatures': { | |
| 1084 'values': ['MD5', 'timestamp'], | |
| 1085 'default': 'MD5', | |
| 1086 'help': 'set how the build system detects file changes' | |
| 1087 }, | |
| 1088 'console': { | |
| 1089 'values': ['dumb', 'readline'], | |
| 1090 'default': 'dumb', | |
| 1091 'help': 'the console to use for the d8 shell' | |
| 1092 }, | |
| 1093 'verbose': { | |
| 1094 'values': ['on', 'off'], | |
| 1095 'default': 'off', | |
| 1096 'help': 'more output from compiler and linker' | |
| 1097 }, | |
| 1098 'visibility': { | |
| 1099 'values': ['default', 'hidden'], | |
| 1100 'guess': GuessVisibility, | |
| 1101 'help': 'shared library symbol visibility' | |
| 1102 }, | |
| 1103 'strictaliasing': { | |
| 1104 'values': ['default', 'off'], | |
| 1105 'guess': GuessStrictAliasing, | |
| 1106 'help': 'assume strict aliasing while optimizing' | |
| 1107 }, | |
| 1108 'pgo': { | |
| 1109 'values': ['off', 'instrument', 'optimize'], | |
| 1110 'default': 'off', | |
| 1111 'help': 'select profile guided optimization variant', | |
| 1112 }, | |
| 1113 'armeabi': { | |
| 1114 'values': ['hard', 'softfp', 'soft'], | |
| 1115 'default': 'softfp', | |
| 1116 'help': 'generate calling conventiont according to selected ARM EABI variant
' | |
| 1117 }, | |
| 1118 'mipsabi': { | |
| 1119 'values': ['hardfloat', 'softfloat', 'none'], | |
| 1120 'default': 'hardfloat', | |
| 1121 'help': 'generate calling conventiont according to selected mips ABI' | |
| 1122 }, | |
| 1123 'mips_arch_variant': { | |
| 1124 'values': ['mips32r2', 'mips32r1', 'loongson'], | |
| 1125 'default': 'mips32r2', | |
| 1126 'help': 'mips variant' | |
| 1127 }, | |
| 1128 'compress_startup_data': { | |
| 1129 'values': ['off', 'bz2'], | |
| 1130 'default': 'off', | |
| 1131 'help': 'compress startup data (snapshot) [Linux only]' | |
| 1132 }, | |
| 1133 'vfp3': { | |
| 1134 'values': ['on', 'off'], | |
| 1135 'default': 'on', | |
| 1136 'help': 'use vfp3 instructions when building the snapshot [Arm only]' | |
| 1137 }, | |
| 1138 'fpu': { | |
| 1139 'values': ['on', 'off'], | |
| 1140 'default': 'on', | |
| 1141 'help': 'use fpu instructions when building the snapshot [MIPS only]' | |
| 1142 }, | |
| 1143 'I_know_I_should_build_with_GYP': { | |
| 1144 'values': ['yes', 'no'], | |
| 1145 'default': 'no', | |
| 1146 'help': 'grace period: temporarily override SCons deprecation' | |
| 1147 } | |
| 1148 | |
| 1149 } | |
| 1150 | |
| 1151 ALL_OPTIONS = dict(PLATFORM_OPTIONS, **SIMPLE_OPTIONS) | |
| 1152 | |
| 1153 | |
| 1154 def AddOptions(options, result): | |
| 1155 guess_env = Environment(options=result) | |
| 1156 for (name, option) in options.iteritems(): | |
| 1157 if 'guess' in option: | |
| 1158 # Option has a guess function | |
| 1159 guess = option.get('guess') | |
| 1160 default = guess(guess_env) | |
| 1161 else: | |
| 1162 # Option has a fixed default | |
| 1163 default = option.get('default') | |
| 1164 help = '%s (%s)' % (option.get('help'), ", ".join(option['values'])) | |
| 1165 result.Add(name, help, default) | |
| 1166 | |
| 1167 | |
| 1168 def GetOptions(): | |
| 1169 result = Options() | |
| 1170 result.Add('mode', 'compilation mode (debug, release)', 'release') | |
| 1171 result.Add('sample', 'build sample (shell, process, lineprocessor)', '') | |
| 1172 result.Add('cache', 'directory to use for scons build cache', '') | |
| 1173 result.Add('env', 'override environment settings (NAME0:value0,NAME1:value1,..
.)', '') | |
| 1174 result.Add('importenv', 'import environment settings (NAME0,NAME1,...)', '') | |
| 1175 AddOptions(PLATFORM_OPTIONS, result) | |
| 1176 AddOptions(SIMPLE_OPTIONS, result) | |
| 1177 return result | |
| 1178 | |
| 1179 | |
| 1180 def GetTools(opts): | |
| 1181 env = Environment(options=opts) | |
| 1182 os = env['os'] | |
| 1183 toolchain = env['toolchain'] | |
| 1184 if os == 'win32' and toolchain == 'gcc': | |
| 1185 return ['mingw'] | |
| 1186 elif os == 'win32' and toolchain == 'msvc': | |
| 1187 return ['msvc', 'mslink', 'mslib', 'msvs'] | |
| 1188 else: | |
| 1189 return ['default'] | |
| 1190 | |
| 1191 | |
| 1192 def GetVersionComponents(): | |
| 1193 MAJOR_VERSION_PATTERN = re.compile(r"#define\s+MAJOR_VERSION\s+(.*)") | |
| 1194 MINOR_VERSION_PATTERN = re.compile(r"#define\s+MINOR_VERSION\s+(.*)") | |
| 1195 BUILD_NUMBER_PATTERN = re.compile(r"#define\s+BUILD_NUMBER\s+(.*)") | |
| 1196 PATCH_LEVEL_PATTERN = re.compile(r"#define\s+PATCH_LEVEL\s+(.*)") | |
| 1197 | |
| 1198 patterns = [MAJOR_VERSION_PATTERN, | |
| 1199 MINOR_VERSION_PATTERN, | |
| 1200 BUILD_NUMBER_PATTERN, | |
| 1201 PATCH_LEVEL_PATTERN] | |
| 1202 | |
| 1203 source = open(join(root_dir, 'src', 'version.cc')).read() | |
| 1204 version_components = [] | |
| 1205 for pattern in patterns: | |
| 1206 match = pattern.search(source) | |
| 1207 if match: | |
| 1208 version_components.append(match.group(1).strip()) | |
| 1209 else: | |
| 1210 version_components.append('0') | |
| 1211 | |
| 1212 return version_components | |
| 1213 | |
| 1214 | |
| 1215 def GetVersion(): | |
| 1216 version_components = GetVersionComponents() | |
| 1217 | |
| 1218 if version_components[len(version_components) - 1] == '0': | |
| 1219 version_components.pop() | |
| 1220 return '.'.join(version_components) | |
| 1221 | |
| 1222 | |
| 1223 def GetSpecificSONAME(): | |
| 1224 SONAME_PATTERN = re.compile(r"#define\s+SONAME\s+\"(.*)\"") | |
| 1225 | |
| 1226 source = open(join(root_dir, 'src', 'version.cc')).read() | |
| 1227 match = SONAME_PATTERN.search(source) | |
| 1228 | |
| 1229 if match: | |
| 1230 return match.group(1).strip() | |
| 1231 else: | |
| 1232 return '' | |
| 1233 | |
| 1234 | |
| 1235 def SplitList(str): | |
| 1236 return [ s for s in str.split(",") if len(s) > 0 ] | |
| 1237 | |
| 1238 | |
| 1239 def IsLegal(env, option, values): | |
| 1240 str = env[option] | |
| 1241 for s in SplitList(str): | |
| 1242 if not s in values: | |
| 1243 Abort("Illegal value for option %s '%s'." % (option, s)) | |
| 1244 return False | |
| 1245 return True | |
| 1246 | |
| 1247 | |
| 1248 def WarnAboutDeprecation(): | |
| 1249 print """ | |
| 1250 ##################################################################### | |
| 1251 # # | |
| 1252 # LAST WARNING: Building V8 with SCons is deprecated. # | |
| 1253 # # | |
| 1254 # This only works because you have overridden the kill switch. # | |
| 1255 # # | |
| 1256 # MIGRATE TO THE GYP-BASED BUILD NOW! # | |
| 1257 # # | |
| 1258 # Instructions: http://code.google.com/p/v8/wiki/BuildingWithGYP. # | |
| 1259 # # | |
| 1260 ##################################################################### | |
| 1261 """ | |
| 1262 | |
| 1263 | |
| 1264 def VerifyOptions(env): | |
| 1265 if env['I_know_I_should_build_with_GYP'] != 'yes': | |
| 1266 Abort("Building V8 with SCons is no longer supported. Please use GYP " | |
| 1267 "instead; you can find instructions are at " | |
| 1268 "http://code.google.com/p/v8/wiki/BuildingWithGYP.\n\n" | |
| 1269 "Quitting.\n\n" | |
| 1270 "For a limited grace period, you can specify " | |
| 1271 "\"I_know_I_should_build_with_GYP=yes\" to override.") | |
| 1272 else: | |
| 1273 WarnAboutDeprecation() | |
| 1274 import atexit | |
| 1275 atexit.register(WarnAboutDeprecation) | |
| 1276 | |
| 1277 if not IsLegal(env, 'mode', ['debug', 'release']): | |
| 1278 return False | |
| 1279 if not IsLegal(env, 'sample', ["shell", "process", "lineprocessor"]): | |
| 1280 return False | |
| 1281 if not IsLegal(env, 'regexp', ["native", "interpreted"]): | |
| 1282 return False | |
| 1283 if env['os'] == 'win32' and env['library'] == 'shared' and env['prof'] == 'on'
: | |
| 1284 Abort("Profiling on windows only supported for static library.") | |
| 1285 if env['gdbjit'] == 'on' and ((env['os'] != 'linux' and env['os'] != 'macos')
or (env['arch'] != 'ia32' and env['arch'] != 'x64' and env['arch'] != 'arm')): | |
| 1286 Abort("GDBJIT interface is supported only for Intel-compatible (ia32 or x64)
Linux/OSX target.") | |
| 1287 if env['os'] == 'win32' and env['soname'] == 'on': | |
| 1288 Abort("Shared Object soname not applicable for Windows.") | |
| 1289 if env['soname'] == 'on' and env['library'] == 'static': | |
| 1290 Abort("Shared Object soname not applicable for static library.") | |
| 1291 if env['os'] != 'win32' and env['pgo'] != 'off': | |
| 1292 Abort("Profile guided optimization only supported on Windows.") | |
| 1293 if env['cache'] and not os.path.isdir(env['cache']): | |
| 1294 Abort("The specified cache directory does not exist.") | |
| 1295 if not (env['arch'] == 'arm' or env['simulator'] == 'arm') and ('unalignedacce
sses' in ARGUMENTS): | |
| 1296 print env['arch'] | |
| 1297 print env['simulator'] | |
| 1298 Abort("Option unalignedaccesses only supported for the ARM architecture.") | |
| 1299 if env['os'] != 'linux' and env['compress_startup_data'] != 'off': | |
| 1300 Abort("Startup data compression is only available on Linux") | |
| 1301 for (name, option) in ALL_OPTIONS.iteritems(): | |
| 1302 if (not name in env): | |
| 1303 message = ("A value for option %s must be specified (%s)." % | |
| 1304 (name, ", ".join(option['values']))) | |
| 1305 Abort(message) | |
| 1306 if not env[name] in option['values']: | |
| 1307 message = ("Unknown %s value '%s'. Possible values are (%s)." % | |
| 1308 (name, env[name], ", ".join(option['values']))) | |
| 1309 Abort(message) | |
| 1310 | |
| 1311 | |
| 1312 class BuildContext(object): | |
| 1313 | |
| 1314 def __init__(self, options, env_overrides, samples): | |
| 1315 self.library_targets = [] | |
| 1316 self.mksnapshot_targets = [] | |
| 1317 self.cctest_targets = [] | |
| 1318 self.sample_targets = [] | |
| 1319 self.d8_targets = [] | |
| 1320 self.options = options | |
| 1321 self.env_overrides = env_overrides | |
| 1322 self.samples = samples | |
| 1323 self.preparser_targets = [] | |
| 1324 self.use_snapshot = (options['snapshot'] != 'off') | |
| 1325 self.build_snapshot = (options['snapshot'] == 'on') | |
| 1326 self.flags = None | |
| 1327 | |
| 1328 def AddRelevantFlags(self, initial, flags): | |
| 1329 result = initial.copy() | |
| 1330 toolchain = self.options['toolchain'] | |
| 1331 if toolchain in flags: | |
| 1332 self.AppendFlags(result, flags[toolchain].get('all')) | |
| 1333 for option in sorted(self.options.keys()): | |
| 1334 value = self.options[option] | |
| 1335 self.AppendFlags(result, flags[toolchain].get(option + ':' + value)) | |
| 1336 self.AppendFlags(result, flags.get('all')) | |
| 1337 return result | |
| 1338 | |
| 1339 def AddRelevantSubFlags(self, options, flags): | |
| 1340 self.AppendFlags(options, flags.get('all')) | |
| 1341 for option in sorted(self.options.keys()): | |
| 1342 value = self.options[option] | |
| 1343 self.AppendFlags(options, flags.get(option + ':' + value)) | |
| 1344 | |
| 1345 def GetRelevantSources(self, source): | |
| 1346 result = [] | |
| 1347 result += source.get('all', []) | |
| 1348 for (name, value) in self.options.iteritems(): | |
| 1349 source_value = source.get(name + ':' + value, []) | |
| 1350 if type(source_value) == dict: | |
| 1351 result += self.GetRelevantSources(source_value) | |
| 1352 else: | |
| 1353 result += source_value | |
| 1354 return sorted(result) | |
| 1355 | |
| 1356 def AppendFlags(self, options, added): | |
| 1357 if not added: | |
| 1358 return | |
| 1359 for (key, value) in added.iteritems(): | |
| 1360 if key.find(':') != -1: | |
| 1361 self.AddRelevantSubFlags(options, { key: value }) | |
| 1362 else: | |
| 1363 if not key in options: | |
| 1364 options[key] = value | |
| 1365 else: | |
| 1366 prefix = options[key] | |
| 1367 if isinstance(prefix, StringTypes): prefix = prefix.split() | |
| 1368 options[key] = prefix + value | |
| 1369 | |
| 1370 def ConfigureObject(self, env, input, **kw): | |
| 1371 if (kw.has_key('CPPPATH') and env.has_key('CPPPATH')): | |
| 1372 kw['CPPPATH'] += env['CPPPATH'] | |
| 1373 if self.options['library'] == 'static': | |
| 1374 return env.StaticObject(input, **kw) | |
| 1375 else: | |
| 1376 return env.SharedObject(input, **kw) | |
| 1377 | |
| 1378 def ApplyEnvOverrides(self, env): | |
| 1379 if not self.env_overrides: | |
| 1380 return | |
| 1381 if type(env['ENV']) == DictType: | |
| 1382 env['ENV'].update(**self.env_overrides) | |
| 1383 else: | |
| 1384 env['ENV'] = self.env_overrides | |
| 1385 | |
| 1386 | |
| 1387 def PostprocessOptions(options, os): | |
| 1388 # Adjust architecture if the simulator option has been set | |
| 1389 if (options['simulator'] != 'none') and (options['arch'] != options['simulator
']): | |
| 1390 if 'arch' in ARGUMENTS: | |
| 1391 # Print a warning if arch has explicitly been set | |
| 1392 print "Warning: forcing architecture to match simulator (%s)" % options['s
imulator'] | |
| 1393 options['arch'] = options['simulator'] | |
| 1394 if (options['prof'] != 'off') and (options['profilingsupport'] == 'off'): | |
| 1395 # Print a warning if profiling is enabled without profiling support | |
| 1396 print "Warning: forcing profilingsupport on when prof is on" | |
| 1397 options['profilingsupport'] = 'on' | |
| 1398 if os == 'win32' and options['pgo'] != 'off' and options['msvcltcg'] == 'off': | |
| 1399 if 'msvcltcg' in ARGUMENTS: | |
| 1400 print "Warning: forcing msvcltcg on as it is required for pgo (%s)" % opti
ons['pgo'] | |
| 1401 options['msvcltcg'] = 'on' | |
| 1402 if (options['mipsabi'] != 'none') and (options['arch'] != 'mips') and (options
['simulator'] != 'mips'): | |
| 1403 options['mipsabi'] = 'none' | |
| 1404 | |
| 1405 | |
| 1406 def ParseEnvOverrides(arg, imports): | |
| 1407 # The environment overrides are in the format NAME0:value0,NAME1:value1,... | |
| 1408 # The environment imports are in the format NAME0,NAME1,... | |
| 1409 overrides = {} | |
| 1410 for var in imports.split(','): | |
| 1411 if var in os.environ: | |
| 1412 overrides[var] = os.environ[var] | |
| 1413 for override in arg.split(','): | |
| 1414 pos = override.find(':') | |
| 1415 if pos == -1: | |
| 1416 continue | |
| 1417 overrides[override[:pos].strip()] = override[pos+1:].strip() | |
| 1418 return overrides | |
| 1419 | |
| 1420 | |
| 1421 def BuildSpecific(env, mode, env_overrides, tools): | |
| 1422 options = {'mode': mode} | |
| 1423 for option in ALL_OPTIONS: | |
| 1424 options[option] = env[option] | |
| 1425 PostprocessOptions(options, env['os']) | |
| 1426 | |
| 1427 context = BuildContext(options, env_overrides, samples=SplitList(env['sample']
)) | |
| 1428 | |
| 1429 # Remove variables which can't be imported from the user's external | |
| 1430 # environment into a construction environment. | |
| 1431 user_environ = os.environ.copy() | |
| 1432 try: | |
| 1433 del user_environ['ENV'] | |
| 1434 except KeyError: | |
| 1435 pass | |
| 1436 | |
| 1437 library_flags = context.AddRelevantFlags(user_environ, LIBRARY_FLAGS) | |
| 1438 v8_flags = context.AddRelevantFlags(library_flags, V8_EXTRA_FLAGS) | |
| 1439 mksnapshot_flags = context.AddRelevantFlags(library_flags, MKSNAPSHOT_EXTRA_FL
AGS) | |
| 1440 dtoa_flags = context.AddRelevantFlags(library_flags, DTOA_EXTRA_FLAGS) | |
| 1441 cctest_flags = context.AddRelevantFlags(v8_flags, CCTEST_EXTRA_FLAGS) | |
| 1442 sample_flags = context.AddRelevantFlags(user_environ, SAMPLE_FLAGS) | |
| 1443 preparser_flags = context.AddRelevantFlags(user_environ, PREPARSER_FLAGS) | |
| 1444 d8_flags = context.AddRelevantFlags(library_flags, D8_FLAGS) | |
| 1445 | |
| 1446 context.flags = { | |
| 1447 'v8': v8_flags, | |
| 1448 'mksnapshot': mksnapshot_flags, | |
| 1449 'dtoa': dtoa_flags, | |
| 1450 'cctest': cctest_flags, | |
| 1451 'sample': sample_flags, | |
| 1452 'd8': d8_flags, | |
| 1453 'preparser': preparser_flags | |
| 1454 } | |
| 1455 | |
| 1456 # Generate library base name. | |
| 1457 target_id = mode | |
| 1458 suffix = SUFFIXES[target_id] | |
| 1459 library_name = 'v8' + suffix | |
| 1460 preparser_library_name = 'v8preparser' + suffix | |
| 1461 version = GetVersion() | |
| 1462 if context.options['soname'] == 'on': | |
| 1463 # When building shared object with SONAME version the library name. | |
| 1464 library_name += '-' + version | |
| 1465 | |
| 1466 # Generate library SONAME if required by the build. | |
| 1467 if context.options['soname'] == 'on': | |
| 1468 soname = GetSpecificSONAME() | |
| 1469 if soname == '': | |
| 1470 soname = 'lib' + library_name + '.so' | |
| 1471 env['SONAME'] = soname | |
| 1472 | |
| 1473 # Build the object files by invoking SCons recursively. | |
| 1474 d8_env = Environment(tools=tools) | |
| 1475 d8_env.Replace(**context.flags['d8']) | |
| 1476 (object_files, shell_files, mksnapshot, preparser_files) = env.SConscript( | |
| 1477 join('src', 'SConscript'), | |
| 1478 build_dir=join('obj', target_id), | |
| 1479 exports='context tools d8_env', | |
| 1480 duplicate=False | |
| 1481 ) | |
| 1482 | |
| 1483 context.mksnapshot_targets.append(mksnapshot) | |
| 1484 | |
| 1485 # Link the object files into a library. | |
| 1486 env.Replace(**context.flags['v8']) | |
| 1487 | |
| 1488 context.ApplyEnvOverrides(env) | |
| 1489 if context.options['library'] == 'static': | |
| 1490 library = env.StaticLibrary(library_name, object_files) | |
| 1491 preparser_library = env.StaticLibrary(preparser_library_name, | |
| 1492 preparser_files) | |
| 1493 else: | |
| 1494 # There seems to be a glitch in the way scons decides where to put | |
| 1495 # PDB files when compiling using MSVC so we specify it manually. | |
| 1496 # This should not affect any other platforms. | |
| 1497 pdb_name = library_name + '.dll.pdb' | |
| 1498 library = env.SharedLibrary(library_name, object_files, PDB=pdb_name) | |
| 1499 preparser_pdb_name = preparser_library_name + '.dll.pdb'; | |
| 1500 preparser_soname = 'lib' + preparser_library_name + '.so'; | |
| 1501 preparser_library = env.SharedLibrary(preparser_library_name, | |
| 1502 preparser_files, | |
| 1503 PDB=preparser_pdb_name, | |
| 1504 SONAME=preparser_soname) | |
| 1505 context.library_targets.append(library) | |
| 1506 context.library_targets.append(preparser_library) | |
| 1507 | |
| 1508 context.ApplyEnvOverrides(d8_env) | |
| 1509 if context.options['library'] == 'static': | |
| 1510 shell = d8_env.Program('d8' + suffix, object_files + shell_files) | |
| 1511 else: | |
| 1512 shell = d8_env.Program('d8' + suffix, shell_files) | |
| 1513 d8_env.Depends(shell, library) | |
| 1514 context.d8_targets.append(shell) | |
| 1515 | |
| 1516 for sample in context.samples: | |
| 1517 sample_env = Environment(tools=tools) | |
| 1518 sample_env.Replace(**context.flags['sample']) | |
| 1519 sample_env.Prepend(LIBS=[library_name]) | |
| 1520 context.ApplyEnvOverrides(sample_env) | |
| 1521 sample_object = sample_env.SConscript( | |
| 1522 join('samples', 'SConscript'), | |
| 1523 build_dir=join('obj', 'sample', sample, target_id), | |
| 1524 exports='sample context tools', | |
| 1525 duplicate=False | |
| 1526 ) | |
| 1527 sample_name = sample + suffix | |
| 1528 sample_program = sample_env.Program(sample_name, sample_object) | |
| 1529 sample_env.Depends(sample_program, library) | |
| 1530 context.sample_targets.append(sample_program) | |
| 1531 | |
| 1532 cctest_env = env.Copy() | |
| 1533 cctest_env.Prepend(LIBS=[library_name]) | |
| 1534 cctest_program = cctest_env.SConscript( | |
| 1535 join('test', 'cctest', 'SConscript'), | |
| 1536 build_dir=join('obj', 'test', target_id), | |
| 1537 exports='context object_files tools', | |
| 1538 duplicate=False | |
| 1539 ) | |
| 1540 context.cctest_targets.append(cctest_program) | |
| 1541 | |
| 1542 preparser_env = env.Copy() | |
| 1543 preparser_env.Replace(**context.flags['preparser']) | |
| 1544 preparser_env.Prepend(LIBS=[preparser_library_name]) | |
| 1545 context.ApplyEnvOverrides(preparser_env) | |
| 1546 preparser_object = preparser_env.SConscript( | |
| 1547 join('preparser', 'SConscript'), | |
| 1548 build_dir=join('obj', 'preparser', target_id), | |
| 1549 exports='context tools', | |
| 1550 duplicate=False | |
| 1551 ) | |
| 1552 preparser_name = join('obj', 'preparser', target_id, 'preparser') | |
| 1553 preparser_program = preparser_env.Program(preparser_name, preparser_object); | |
| 1554 preparser_env.Depends(preparser_program, preparser_library) | |
| 1555 context.preparser_targets.append(preparser_program) | |
| 1556 | |
| 1557 return context | |
| 1558 | |
| 1559 | |
| 1560 def Build(): | |
| 1561 opts = GetOptions() | |
| 1562 tools = GetTools(opts) | |
| 1563 env = Environment(options=opts, tools=tools) | |
| 1564 | |
| 1565 Help(opts.GenerateHelpText(env)) | |
| 1566 VerifyOptions(env) | |
| 1567 env_overrides = ParseEnvOverrides(env['env'], env['importenv']) | |
| 1568 | |
| 1569 SourceSignatures(env['sourcesignatures']) | |
| 1570 | |
| 1571 libraries = [] | |
| 1572 mksnapshots = [] | |
| 1573 cctests = [] | |
| 1574 samples = [] | |
| 1575 preparsers = [] | |
| 1576 d8s = [] | |
| 1577 modes = SplitList(env['mode']) | |
| 1578 for mode in modes: | |
| 1579 context = BuildSpecific(env.Copy(), mode, env_overrides, tools) | |
| 1580 libraries += context.library_targets | |
| 1581 mksnapshots += context.mksnapshot_targets | |
| 1582 cctests += context.cctest_targets | |
| 1583 samples += context.sample_targets | |
| 1584 preparsers += context.preparser_targets | |
| 1585 d8s += context.d8_targets | |
| 1586 | |
| 1587 env.Alias('library', libraries) | |
| 1588 env.Alias('mksnapshot', mksnapshots) | |
| 1589 env.Alias('cctests', cctests) | |
| 1590 env.Alias('sample', samples) | |
| 1591 env.Alias('d8', d8s) | |
| 1592 env.Alias('preparser', preparsers) | |
| 1593 | |
| 1594 if env['sample']: | |
| 1595 env.Default('sample') | |
| 1596 else: | |
| 1597 env.Default('library') | |
| 1598 | |
| 1599 if env['cache']: | |
| 1600 CacheDir(env['cache']) | |
| 1601 | |
| 1602 # We disable deprecation warnings because we need to be able to use | |
| 1603 # env.Copy without getting warnings for compatibility with older | |
| 1604 # version of scons. Also, there's a bug in some revisions that | |
| 1605 # doesn't allow this flag to be set, so we swallow any exceptions. | |
| 1606 # Lovely. | |
| 1607 try: | |
| 1608 SetOption('warn', 'no-deprecated') | |
| 1609 except: | |
| 1610 pass | |
| 1611 | |
| 1612 Build() | |
| OLD | NEW |