wok annotate node/stuff/SConstruct @ rev 16509

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