| OLD | NEW |
| 1 # Copyright 2008 the V8 project authors. All rights reserved. | 1 # Copyright 2008 the V8 project authors. All rights reserved. |
| 2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
| 3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
| 4 # met: | 4 # met: |
| 5 # | 5 # |
| 6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
| 9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
| 10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'], | 47 'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'], |
| 48 'LIBS': ['pthread'] | 48 'LIBS': ['pthread'] |
| 49 }, | 49 }, |
| 50 'mode:debug': { | 50 'mode:debug': { |
| 51 'CCFLAGS': ['-g', '-O0'], | 51 'CCFLAGS': ['-g', '-O0'], |
| 52 'CPPDEFINES': ['ENABLE_DISASSEMBLER', 'DEBUG'] | 52 'CPPDEFINES': ['ENABLE_DISASSEMBLER', 'DEBUG'] |
| 53 }, | 53 }, |
| 54 'mode:release': { | 54 'mode:release': { |
| 55 'CCFLAGS': ['-O3', '-fomit-frame-pointer'] | 55 'CCFLAGS': ['-O3', '-fomit-frame-pointer'] |
| 56 }, | 56 }, |
| 57 'os:freebsd': { |
| 58 'LIBS': ['execinfo'] |
| 59 }, |
| 57 'wordsize:64': { | 60 'wordsize:64': { |
| 58 'CCFLAGS': ['-m32'], | 61 'CCFLAGS': ['-m32'], |
| 59 'LINKFLAGS': ['-m32'] | 62 'LINKFLAGS': ['-m32'] |
| 60 } | 63 } |
| 61 }, | 64 }, |
| 62 'msvc': { | 65 'msvc': { |
| 63 'all': { | 66 'all': { |
| 64 'DIALECTFLAGS': ['/nologo'], | 67 'DIALECTFLAGS': ['/nologo'], |
| 65 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], | 68 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], |
| 66 'CXXFLAGS': ['$CCFLAGS', '/GR-', '/Gy'], | 69 'CXXFLAGS': ['$CCFLAGS', '/GR-', '/Gy'], |
| 67 'CPPDEFINES': ['WIN32', '_USE_32BIT_TIME_T', 'PCRE_STATIC'], | 70 'CPPDEFINES': ['WIN32', '_USE_32BIT_TIME_T', 'PCRE_STATIC'], |
| 68 'LINKFLAGS': ['/NOLOGO', '/MACHINE:X86', '/INCREMENTAL:NO', | 71 'LINKFLAGS': ['/NOLOGO', '/MACHINE:X86', '/INCREMENTAL:NO', |
| 69 '/NXCOMPAT', '/IGNORE:4221'], | 72 '/NXCOMPAT', '/IGNORE:4221'], |
| 70 'ARFLAGS': ['/NOLOGO'], | 73 'ARFLAGS': ['/NOLOGO'], |
| 71 'CCPDBFLAGS': ['/Zi'] | 74 'CCPDBFLAGS': ['/Zi'] |
| 72 }, | 75 }, |
| 73 'mode:debug': { | 76 'mode:debug': { |
| 74 'CCFLAGS': ['/Od', '/Gm', '/MTd'], | 77 'CCFLAGS': ['/Od', '/Gm'], |
| 75 'CPPDEFINES': ['_DEBUG', 'ENABLE_DISASSEMBLER', 'DEBUG'], | 78 'CPPDEFINES': ['_DEBUG', 'ENABLE_DISASSEMBLER', 'DEBUG'], |
| 76 'LINKFLAGS': ['/DEBUG'] | 79 'LINKFLAGS': ['/DEBUG'], |
| 80 'msvcrt:static': { |
| 81 'CCFLAGS': ['/MTd'] |
| 82 }, |
| 83 'msvcrt:shared': { |
| 84 'CCFLAGS': ['/MDd'] |
| 85 } |
| 77 }, | 86 }, |
| 78 'mode:release': { | 87 'mode:release': { |
| 79 'CCFLAGS': ['/O2', '/MT', '/GL'], | 88 'CCFLAGS': ['/O2', '/GL'], |
| 80 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF', '/LTCG'], | 89 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF', '/LTCG'], |
| 81 'ARFLAGS': ['/LTCG'] | 90 'ARFLAGS': ['/LTCG'], |
| 82 } | 91 'msvcrt:static': { |
| 92 'CCFLAGS': ['/MT'] |
| 93 }, |
| 94 'msvcrt:shared': { |
| 95 'CCFLAGS': ['/MD'] |
| 96 } |
| 97 }, |
| 83 } | 98 } |
| 84 } | 99 } |
| 85 | 100 |
| 86 | 101 |
| 87 V8_EXTRA_FLAGS = { | 102 V8_EXTRA_FLAGS = { |
| 88 'gcc': { | 103 'gcc': { |
| 89 'all': { | 104 'all': { |
| 90 'CXXFLAGS': [], #['-fvisibility=hidden'], | 105 'CXXFLAGS': [], #['-fvisibility=hidden'], |
| 91 'WARNINGFLAGS': ['-pedantic', '-Wall', '-Werror', '-W', | 106 'WARNINGFLAGS': ['-pedantic', '-Wall', '-Werror', '-W', |
| 92 '-Wno-unused-parameter'] | 107 '-Wno-unused-parameter'] |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 SAMPLE_FLAGS = { | 194 SAMPLE_FLAGS = { |
| 180 'all': { | 195 'all': { |
| 181 'CPPPATH': [join(abspath('.'), 'include')], | 196 'CPPPATH': [join(abspath('.'), 'include')], |
| 182 'LIBS': ['$LIBRARY'], | 197 'LIBS': ['$LIBRARY'], |
| 183 }, | 198 }, |
| 184 'gcc': { | 199 'gcc': { |
| 185 'all': { | 200 'all': { |
| 186 'LIBS': ['pthread'], | 201 'LIBS': ['pthread'], |
| 187 'LIBPATH': ['.'] | 202 'LIBPATH': ['.'] |
| 188 }, | 203 }, |
| 204 'os:freebsd': { |
| 205 'LIBS': ['execinfo'] |
| 206 }, |
| 189 'wordsize:64': { | 207 'wordsize:64': { |
| 190 'CCFLAGS': ['-m32'], | 208 'CCFLAGS': ['-m32'], |
| 191 'LINKFLAGS': ['-m32'] | 209 'LINKFLAGS': ['-m32'] |
| 192 }, | 210 }, |
| 193 'mode:release': { | 211 'mode:release': { |
| 194 'CCFLAGS': ['-O2'] | 212 'CCFLAGS': ['-O2'] |
| 195 }, | 213 }, |
| 196 'mode:debug': { | 214 'mode:debug': { |
| 197 'CCFLAGS': ['-g', '-O0'] | 215 'CCFLAGS': ['-g', '-O0'] |
| 198 } | 216 } |
| 199 }, | 217 }, |
| 200 'msvc': { | 218 'msvc': { |
| 201 'all': { | 219 'all': { |
| 202 'CCFLAGS': ['/nologo'], | 220 'CCFLAGS': ['/nologo'], |
| 203 'LINKFLAGS': ['/nologo'], | 221 'LINKFLAGS': ['/nologo'], |
| 204 }, | 222 }, |
| 205 'library:shared': { | 223 'library:shared': { |
| 206 'CPPDEFINES': ['USING_V8_SHARED'] | 224 'CPPDEFINES': ['USING_V8_SHARED'] |
| 207 }, | 225 }, |
| 208 'prof:on': { | 226 'prof:on': { |
| 209 'LINKFLAGS': ['/MAP'] | 227 'LINKFLAGS': ['/MAP'] |
| 210 }, | 228 }, |
| 211 'mode:release': { | 229 'mode:release': { |
| 212 'CCFLAGS': ['/O2', '/MT'], | 230 'CCFLAGS': ['/O2'], |
| 213 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF', '/LTCG'] | 231 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF', '/LTCG'], |
| 232 'msvcrt:static': { |
| 233 'CCFLAGS': ['/MT'] |
| 234 }, |
| 235 'msvcrt:shared': { |
| 236 'CCFLAGS': ['/MD'] |
| 237 } |
| 214 }, | 238 }, |
| 215 'mode:debug': { | 239 'mode:debug': { |
| 216 'CCFLAGS': ['/Od', '/MTd'], | 240 'CCFLAGS': ['/Od'], |
| 217 'LINKFLAGS': ['/DEBUG'] | 241 'LINKFLAGS': ['/DEBUG'], |
| 242 'msvcrt:static': { |
| 243 'CCFLAGS': ['/MTd'] |
| 244 }, |
| 245 'msvcrt:shared': { |
| 246 'CCFLAGS': ['/MDd'] |
| 247 } |
| 218 } | 248 } |
| 219 } | 249 } |
| 220 } | 250 } |
| 221 | 251 |
| 222 | 252 |
| 223 D8_FLAGS = { | 253 D8_FLAGS = { |
| 224 'gcc': { | 254 'gcc': { |
| 225 'console:readline': { | 255 'console:readline': { |
| 226 'LIBS': ['readline'] | 256 'LIBS': ['readline'] |
| 227 } | 257 } |
| 228 }, | 258 }, |
| 229 'msvc': { } | |
| 230 } | 259 } |
| 231 | 260 |
| 232 | 261 |
| 233 SUFFIXES = { | 262 SUFFIXES = { |
| 234 'release': '', | 263 'release': '', |
| 235 'debug': '_g' | 264 'debug': '_g' |
| 236 } | 265 } |
| 237 | 266 |
| 238 | 267 |
| 239 def Abort(message): | 268 def Abort(message): |
| (...skipping 17 matching lines...) Expand all Loading... |
| 257 WORDSIZE_GUESS = utils.GuessWordsize() | 286 WORDSIZE_GUESS = utils.GuessWordsize() |
| 258 | 287 |
| 259 | 288 |
| 260 SIMPLE_OPTIONS = { | 289 SIMPLE_OPTIONS = { |
| 261 'toolchain': { | 290 'toolchain': { |
| 262 'values': ['gcc', 'msvc'], | 291 'values': ['gcc', 'msvc'], |
| 263 'default': TOOLCHAIN_GUESS, | 292 'default': TOOLCHAIN_GUESS, |
| 264 'help': 'the toolchain to use' | 293 'help': 'the toolchain to use' |
| 265 }, | 294 }, |
| 266 'os': { | 295 'os': { |
| 267 'values': ['linux', 'macos', 'win32'], | 296 'values': ['freebsd', 'linux', 'macos', 'win32'], |
| 268 'default': OS_GUESS, | 297 'default': OS_GUESS, |
| 269 'help': 'the os to build for' | 298 'help': 'the os to build for' |
| 270 }, | 299 }, |
| 271 'arch': { | 300 'arch': { |
| 272 'values':['arm', 'ia32'], | 301 'values':['arm', 'ia32'], |
| 273 'default': ARCH_GUESS, | 302 'default': ARCH_GUESS, |
| 274 'help': 'the architecture to build for' | 303 'help': 'the architecture to build for' |
| 275 }, | 304 }, |
| 276 'snapshot': { | 305 'snapshot': { |
| 277 'values': ['on', 'off'], | 306 'values': ['on', 'off'], |
| 278 'default': 'off', | 307 'default': 'off', |
| 279 'help': 'build using snapshots for faster start-up' | 308 'help': 'build using snapshots for faster start-up' |
| 280 }, | 309 }, |
| 281 'prof': { | 310 'prof': { |
| 282 'values': ['on', 'off'], | 311 'values': ['on', 'off'], |
| 283 'default': 'off', | 312 'default': 'off', |
| 284 'help': 'enable profiling of build target' | 313 'help': 'enable profiling of build target' |
| 285 }, | 314 }, |
| 286 'library': { | 315 'library': { |
| 287 'values': ['static', 'shared'], | 316 'values': ['static', 'shared'], |
| 288 'default': 'static', | 317 'default': 'static', |
| 289 'help': 'the type of library to produce' | 318 'help': 'the type of library to produce' |
| 290 }, | 319 }, |
| 320 'msvcrt': { |
| 321 'values': ['static', 'shared'], |
| 322 'default': 'static', |
| 323 'help': 'the type of MSVCRT library to use' |
| 324 }, |
| 291 'wordsize': { | 325 'wordsize': { |
| 292 'values': ['64', '32'], | 326 'values': ['64', '32'], |
| 293 'default': WORDSIZE_GUESS, | 327 'default': WORDSIZE_GUESS, |
| 294 'help': 'the word size' | 328 'help': 'the word size' |
| 295 }, | 329 }, |
| 296 'simulator': { | 330 'simulator': { |
| 297 'values': ['arm', 'none'], | 331 'values': ['arm', 'none'], |
| 298 'default': 'none', | 332 'default': 'none', |
| 299 'help': 'build with simulator' | 333 'help': 'build with simulator' |
| 300 }, | 334 }, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 self.options = options | 402 self.options = options |
| 369 self.env_overrides = env_overrides | 403 self.env_overrides = env_overrides |
| 370 self.samples = samples | 404 self.samples = samples |
| 371 self.use_snapshot = (options['snapshot'] == 'on') | 405 self.use_snapshot = (options['snapshot'] == 'on') |
| 372 self.flags = None | 406 self.flags = None |
| 373 | 407 |
| 374 def AddRelevantFlags(self, initial, flags): | 408 def AddRelevantFlags(self, initial, flags): |
| 375 result = initial.copy() | 409 result = initial.copy() |
| 376 self.AppendFlags(result, flags.get('all')) | 410 self.AppendFlags(result, flags.get('all')) |
| 377 toolchain = self.options['toolchain'] | 411 toolchain = self.options['toolchain'] |
| 378 self.AppendFlags(result, flags[toolchain].get('all')) | 412 if toolchain in flags: |
| 413 self.AppendFlags(result, flags[toolchain].get('all')) |
| 414 for option in sorted(self.options.keys()): |
| 415 value = self.options[option] |
| 416 self.AppendFlags(result, flags[toolchain].get(option + ':' + value)) |
| 417 return result |
| 418 |
| 419 def AddRelevantSubFlags(self, options, flags): |
| 420 self.AppendFlags(options, flags.get('all')) |
| 379 for option in sorted(self.options.keys()): | 421 for option in sorted(self.options.keys()): |
| 380 value = self.options[option] | 422 value = self.options[option] |
| 381 self.AppendFlags(result, flags[toolchain].get(option + ':' + value)) | 423 self.AppendFlags(options, flags.get(option + ':' + value)) |
| 382 return result | |
| 383 | 424 |
| 384 def GetRelevantSources(self, source): | 425 def GetRelevantSources(self, source): |
| 385 result = [] | 426 result = [] |
| 386 result += source.get('all', []) | 427 result += source.get('all', []) |
| 387 for (name, value) in self.options.iteritems(): | 428 for (name, value) in self.options.iteritems(): |
| 388 result += source.get(name + ':' + value, []) | 429 result += source.get(name + ':' + value, []) |
| 389 return sorted(result) | 430 return sorted(result) |
| 390 | 431 |
| 391 def AppendFlags(self, options, added): | 432 def AppendFlags(self, options, added): |
| 392 if not added: | 433 if not added: |
| 393 return | 434 return |
| 394 for (key, value) in added.iteritems(): | 435 for (key, value) in added.iteritems(): |
| 395 if not key in options: | 436 if key.find(':') != -1: |
| 396 options[key] = value | 437 self.AddRelevantSubFlags(options, { key: value }) |
| 397 else: | 438 else: |
| 398 prefix = options[key] | 439 if not key in options: |
| 399 if isinstance(prefix, StringTypes): prefix = prefix.split() | 440 options[key] = value |
| 400 options[key] = prefix + value | 441 else: |
| 442 prefix = options[key] |
| 443 if isinstance(prefix, StringTypes): prefix = prefix.split() |
| 444 options[key] = prefix + value |
| 401 | 445 |
| 402 def ConfigureObject(self, env, input, **kw): | 446 def ConfigureObject(self, env, input, **kw): |
| 403 if self.options['library'] == 'static': | 447 if self.options['library'] == 'static': |
| 404 return env.StaticObject(input, **kw) | 448 return env.StaticObject(input, **kw) |
| 405 else: | 449 else: |
| 406 return env.SharedObject(input, **kw) | 450 return env.SharedObject(input, **kw) |
| 407 | 451 |
| 408 def ApplyEnvOverrides(self, env): | 452 def ApplyEnvOverrides(self, env): |
| 409 if not self.env_overrides: | 453 if not self.env_overrides: |
| 410 return | 454 return |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 context = BuildSpecific(env.Copy(), mode, env_overrides) | 578 context = BuildSpecific(env.Copy(), mode, env_overrides) |
| 535 libraries += context.library_targets | 579 libraries += context.library_targets |
| 536 cctests += context.cctest_targets | 580 cctests += context.cctest_targets |
| 537 samples += context.sample_targets | 581 samples += context.sample_targets |
| 538 d8s += context.d8_targets | 582 d8s += context.d8_targets |
| 539 | 583 |
| 540 env.Alias('library', libraries) | 584 env.Alias('library', libraries) |
| 541 env.Alias('cctests', cctests) | 585 env.Alias('cctests', cctests) |
| 542 env.Alias('sample', samples) | 586 env.Alias('sample', samples) |
| 543 env.Alias('d8', d8s) | 587 env.Alias('d8', d8s) |
| 544 | 588 |
| 545 if env['sample']: | 589 if env['sample']: |
| 546 env.Default('sample') | 590 env.Default('sample') |
| 547 else: | 591 else: |
| 548 env.Default('library') | 592 env.Default('library') |
| 549 | 593 |
| 550 | 594 |
| 551 # We disable deprecation warnings because we need to be able to use | 595 # We disable deprecation warnings because we need to be able to use |
| 552 # env.Copy without getting warnings for compatibility with older | 596 # env.Copy without getting warnings for compatibility with older |
| 553 # version of scons. Also, there's a bug in some revisions that | 597 # version of scons. Also, there's a bug in some revisions that |
| 554 # doesn't allow this flag to be set, so we swallow any exceptions. | 598 # doesn't allow this flag to be set, so we swallow any exceptions. |
| 555 # Lovely. | 599 # Lovely. |
| 556 try: | 600 try: |
| 557 SetOption('warn', 'no-deprecated') | 601 SetOption('warn', 'no-deprecated') |
| 558 except: | 602 except: |
| 559 pass | 603 pass |
| 560 | 604 |
| 561 | 605 |
| 562 Build() | 606 Build() |
| OLD | NEW |