| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """NaCl SDK tool SCons.""" | 6 """NaCl SDK tool SCons.""" |
| 7 | 7 |
| 8 import __builtin__ | 8 import __builtin__ |
| 9 import re | 9 import re |
| 10 import os | 10 import os |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 pnacl_translate = binprefix + 'translate' + binext | 286 pnacl_translate = binprefix + 'translate' + binext |
| 287 | 287 |
| 288 pnacl_cc = binprefix + 'clang' + binext | 288 pnacl_cc = binprefix + 'clang' + binext |
| 289 pnacl_cxx = binprefix + 'clang++' + binext | 289 pnacl_cxx = binprefix + 'clang++' + binext |
| 290 | 290 |
| 291 pnacl_ld = binprefix + 'ld' + binext | 291 pnacl_ld = binprefix + 'ld' + binext |
| 292 pnacl_nativeld = binprefix + 'nativeld' + binext | 292 pnacl_nativeld = binprefix + 'nativeld' + binext |
| 293 pnacl_disass = binprefix + 'dis' + binext | 293 pnacl_disass = binprefix + 'dis' + binext |
| 294 pnacl_finalize = binprefix + 'finalize' + binext | 294 pnacl_finalize = binprefix + 'finalize' + binext |
| 295 pnacl_strip = binprefix + 'strip' + binext | 295 pnacl_strip = binprefix + 'strip' + binext |
| 296 pnacl_link_and_translate = os.path.join(subroot, | |
| 297 'bin', | |
| 298 'wrapper-link-and-translate') + binext | |
| 299 | 296 |
| 300 # NOTE: XXX_flags start with space for easy concatenation | 297 # NOTE: XXX_flags start with space for easy concatenation |
| 301 # The flags generated here get baked into the commands (CC, CXX, LINK) | 298 # The flags generated here get baked into the commands (CC, CXX, LINK) |
| 302 # instead of CFLAGS etc to keep them from getting blown away by some | 299 # instead of CFLAGS etc to keep them from getting blown away by some |
| 303 # tests. Don't add flags here unless they always need to be preserved. | 300 # tests. Don't add flags here unless they always need to be preserved. |
| 304 pnacl_cxx_flags = '' | 301 pnacl_cxx_flags = '' |
| 305 pnacl_cc_flags = ' -std=gnu99' | 302 pnacl_cc_flags = ' -std=gnu99' |
| 306 pnacl_ld_flags = ' ' + ' '.join(env['PNACL_BCLDFLAGS']) | 303 pnacl_ld_flags = ' ' + ' '.join(env['PNACL_BCLDFLAGS']) |
| 307 pnacl_translate_flags = '' | 304 pnacl_translate_flags = '' |
| 308 | 305 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 AR=pnacl_ar, | 344 AR=pnacl_ar, |
| 348 AS=pnacl_as + ld_arch_flag, | 345 AS=pnacl_as + ld_arch_flag, |
| 349 RANLIB=pnacl_ranlib, | 346 RANLIB=pnacl_ranlib, |
| 350 DISASS=pnacl_disass, | 347 DISASS=pnacl_disass, |
| 351 OBJDUMP=pnacl_disass, | 348 OBJDUMP=pnacl_disass, |
| 352 STRIP=pnacl_strip, | 349 STRIP=pnacl_strip, |
| 353 TRANSLATE=pnacl_translate + arch_flag + pnacl_translate_flags, | 350 TRANSLATE=pnacl_translate + arch_flag + pnacl_translate_flags, |
| 354 PNACLFINALIZE=pnacl_finalize, | 351 PNACLFINALIZE=pnacl_finalize, |
| 355 ) | 352 ) |
| 356 | 353 |
| 357 if env.Bit('pnacl_shared_newlib'): | |
| 358 def shlibemitter(target, source, env): | |
| 359 """when building a .so also notify scons that we care about | |
| 360 the .pso which gets generated as a side-effect and which should | |
| 361 also be installed. | |
| 362 This is a not very well documented scons API. | |
| 363 """ | |
| 364 if env.Bit('pnacl_generate_pexe'): | |
| 365 return (target, source) | |
| 366 assert len(target) == 1 | |
| 367 lib = env.GetBuildPath(target[0]) | |
| 368 assert lib.endswith(".so") | |
| 369 return (target + [lib[:-2] + 'pso'], source) | |
| 370 | |
| 371 env.Replace(LINK=pnacl_link_and_translate + arch_flag + ' -dynamic', | |
| 372 SHLINK=pnacl_link_and_translate + arch_flag, | |
| 373 SHLIBEMITTER=shlibemitter) | |
| 374 | |
| 375 | |
| 376 if env.Bit('built_elsewhere'): | 354 if env.Bit('built_elsewhere'): |
| 377 def FakeInstall(dest, source, env): | 355 def FakeInstall(dest, source, env): |
| 378 print 'Not installing', dest | 356 print 'Not installing', dest |
| 379 _StubOutEnvToolsForBuiltElsewhere(env) | 357 _StubOutEnvToolsForBuiltElsewhere(env) |
| 380 env.Replace(INSTALL=FakeInstall) | 358 env.Replace(INSTALL=FakeInstall) |
| 381 if env.Bit('translate_in_build_step'): | 359 if env.Bit('translate_in_build_step'): |
| 382 env.Replace(TRANSLATE='true') | 360 env.Replace(TRANSLATE='true') |
| 383 env.Replace(PNACLFINALIZE='true') | 361 env.Replace(PNACLFINALIZE='true') |
| 384 | 362 |
| 385 | 363 |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 # Dependency files it produces are to be found in ${LIBPATH}. | 785 # Dependency files it produces are to be found in ${LIBPATH}. |
| 808 # It is applied recursively to those dependencies in case | 786 # It is applied recursively to those dependencies in case |
| 809 # some of them are linker scripts too. | 787 # some of them are linker scripts too. |
| 810 ldscript_scanner = SCons.Scanner.Base( | 788 ldscript_scanner = SCons.Scanner.Base( |
| 811 function=ScanLinkerScript, | 789 function=ScanLinkerScript, |
| 812 skeys=['.a', '.so', '.pso'], | 790 skeys=['.a', '.so', '.pso'], |
| 813 path_function=SCons.Scanner.FindPathDirs('LIBPATH'), | 791 path_function=SCons.Scanner.FindPathDirs('LIBPATH'), |
| 814 recursive=True | 792 recursive=True |
| 815 ) | 793 ) |
| 816 env.Append(SCANNERS=ldscript_scanner) | 794 env.Append(SCANNERS=ldscript_scanner) |
| OLD | NEW |