Chromium Code Reviews| 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 # Global environment and expression parsing for the PNaCl driver | 6 # Global environment and expression parsing for the PNaCl driver |
| 7 | 7 |
| 8 | 8 |
| 9 # This dictionary initializes a shell-like environment. | 9 # This dictionary initializes a shell-like environment. |
| 10 # Shell escaping and ${} substitution are provided. | 10 # Shell escaping and ${} substitution are provided. |
| 11 # See "class Environment" defined later for the implementation. | 11 # See "class Environment" defined later for the implementation. |
| 12 | 12 |
| 13 from driver_log import Log, DriverExit | 13 from driver_log import Log, DriverExit |
| 14 from shelltools import shell | 14 from shelltools import shell |
| 15 import types | 15 import types |
| 16 | 16 |
| 17 INITIAL_ENV = { | 17 INITIAL_ENV = { |
| 18 # Set by DriverMain | 18 # Set by DriverMain |
| 19 'DRIVER_PATH' : '', # Absolute path to this driver invocation | 19 'DRIVER_PATH' : '', # Absolute path to this driver invocation |
| 20 'DRIVER_BIN' : '', # PNaCl driver bin/ directory | 20 'DRIVER_BIN' : '', # PNaCl driver bin/ directory |
| 21 'DRIVER_REV_FILE' : '${BASE}/REV', | 21 'DRIVER_REV_FILE' : '${BASE}/REV', |
| 22 | 22 |
| 23 'BASE_NACL' : '${@FindBaseNaCl}', # Absolute path of native_client/ | 23 'BASE_NACL' : '${@FindBaseNaCl}', # Absolute path of native_client/ |
| 24 'BASE_TOOLCHAIN' : '${@FindBaseToolchain}', # Absolute path to toolchain/OS_A RCH/ | 24 'BASE_TOOLCHAIN' : '${@FindBaseToolchain}', # Absolute path to toolchain/OS_A RCH/ |
| 25 'BASE' : '${@FindBasePNaCl}', # Absolute path to PNaCl | 25 'BASE' : '${@FindBasePNaCl}', # Absolute path to PNaCl |
| 26 'BUILD_OS' : '${@GetBuildOS}', # "linux", "darwin" or "windows" | 26 'BUILD_OS' : '${@GetBuildOS}', # "linux", "darwin" or "windows" |
| 27 'BUILD_ARCH' : '${@GetBuildArch}', # "x86_64" or "i686" or "i386" | 27 'BUILD_ARCH' : '${@GetBuildArch}', # "x86_64" or "i686" or "i386" |
| 28 | 28 |
| 29 # Directories | 29 # Directories |
| 30 'CLANG_VER' : '3.4', # Included in path to compiler-owned libs/headers. | |
| 30 'BPREFIXES' : '', # Prefixes specified using the -B flag. | 31 'BPREFIXES' : '', # Prefixes specified using the -B flag. |
| 31 'BASE_LLVM' : '${@FindBaseHost:clang}', | 32 'BASE_LLVM' : '${@FindBaseHost:clang}', |
| 32 'BASE_BINUTILS' : '${@FindBaseHost:le32-nacl-ar}', | 33 'BASE_BINUTILS' : '${@FindBaseHost:le32-nacl-ar}', |
| 33 | 34 |
| 34 'BASE_LIB_NATIVE' : '${BASE}/lib-', | 35 'BASE_LIB_NATIVE' : '${BASE}/translator/', |
| 35 | 36 |
| 36 'BASE_USR' : '${BASE}/usr', | 37 'BASE_USR' : '${BASE}/le32-nacl', |
| 37 'BASE_SDK' : '${BASE}/sdk', | 38 'BASE_SDK' : '${BASE}/sdk', |
| 38 'BASE_LIB' : '${BASE}/lib', | 39 'BASE_LIB' : '${BASE}/lib/clang/3.4/lib/le32-nacl', |
|
jvoung (off chromium)
2014/09/19 16:29:02
3.4 -> ${CLANG_VER} here too
Derek Schuff
2014/09/19 16:39:48
Done.
| |
| 39 'BASE_USR_ARCH' : '${BASE_USR_%BCLIB_ARCH%}', | 40 'BASE_USR_ARCH' : '${BASE_USR_%BCLIB_ARCH%}', |
| 40 'BASE_USR_X8632' : '${BASE}/usr-bc-x86-32', | 41 'BASE_USR_X8632' : '${BASE}/x86-32_bc-nacl', |
| 41 'BASE_USR_X8664' : '${BASE}/usr-bc-x86-64', | 42 'BASE_USR_X8664' : '${BASE}/x86-64_bc-nacl', |
| 42 'BASE_USR_ARM' : '${BASE}/usr-bc-arm', | 43 'BASE_USR_ARM' : '${BASE}/arm_bc-nacl', |
| 43 'BASE_LIB_ARCH' : '${BASE_LIB_%BCLIB_ARCH%}', | 44 'BASE_LIB_ARCH' : '${BASE_LIB_%BCLIB_ARCH%}', |
| 44 'BASE_LIB_X8632' : '${BASE}/lib-bc-x86-32', | 45 'BASE_LIB_X8632' : '${BASE}/lib/clang/${CLANG_VER}/lib/x86-32_bc-nacl', |
| 45 'BASE_LIB_X8664' : '${BASE}/lib-bc-x86-64', | 46 'BASE_LIB_X8664' : '${BASE}/lib/clang/${CLANG_VER}/lib/x86-64_bc-nacl', |
| 46 'BASE_LIB_ARM' : '${BASE}/lib-bc-arm', | 47 'BASE_LIB_ARM' : '${BASE}/lib/clang/${CLANG_VER}/lib/arm_bc-nacl', |
| 47 | 48 |
| 48 'LIBS_NATIVE_ARCH' : '${LIBS_NATIVE_%ARCH%}', | 49 'LIBS_NATIVE_ARCH' : '${LIBS_NATIVE_%ARCH%}', |
| 49 'LIBS_NATIVE_ARM' : '${BASE_LIB_NATIVE}arm', | 50 'LIBS_NATIVE_ARM' : '${BASE_LIB_NATIVE}arm/lib', |
| 50 'LIBS_NATIVE_ARM_NONSFI' : '${BASE_LIB_NATIVE}arm-nonsfi', | 51 'LIBS_NATIVE_ARM_NONSFI' : '${BASE_LIB_NATIVE}arm-nonsfi/lib', |
| 51 'LIBS_NATIVE_X8632' : '${BASE_LIB_NATIVE}x86-32', | 52 'LIBS_NATIVE_X8632' : '${BASE_LIB_NATIVE}x86-32/lib', |
| 52 'LIBS_NATIVE_X8632_NONSFI' : '${BASE_LIB_NATIVE}x86-32-nonsfi', | 53 'LIBS_NATIVE_X8632_NONSFI' : '${BASE_LIB_NATIVE}x86-32-nonsfi/lib', |
| 53 'LIBS_NATIVE_X8664' : '${BASE_LIB_NATIVE}x86-64', | 54 'LIBS_NATIVE_X8664' : '${BASE_LIB_NATIVE}x86-64/lib', |
| 54 'LIBS_NATIVE_MIPS32' : '${BASE_LIB_NATIVE}mips32', | 55 'LIBS_NATIVE_MIPS32' : '${BASE_LIB_NATIVE}mips32/lib', |
| 55 | 56 |
| 56 'BASE_LLVM_BIN' : '${BASE_LLVM}/bin', | 57 'BASE_LLVM_BIN' : '${BASE_LLVM}/bin', |
| 57 'TRANSLATOR_BIN' : | 58 'TRANSLATOR_BIN' : |
| 58 '${BASE_TOOLCHAIN}/pnacl_translator/${STANDARD_ARCH}/bin', | 59 '${BASE_TOOLCHAIN}/pnacl_translator/translator/${TRANSLATOR_ARCH}/bin', |
| 59 | 60 |
| 60 # TODO(pdox): Unify this with ARCH. | 61 # TODO(dschuff): Switch these directories to be triple-style arches, |
| 61 'STANDARD_ARCH' : '${STANDARD_ARCH_%ARCH%}', | 62 # to match the main toolchain? |
| 62 'STANDARD_ARCH_X8632' : 'i686', | 63 'TRANSLATOR_ARCH' : '${TRANSLATOR_ARCH_%ARCH%}', |
| 63 'STANDARD_ARCH_X8664' : 'x86_64', | 64 'TRANSLATOR_ARCH_X8632' : 'x86-32', |
| 64 'STANDARD_ARCH_ARM' : 'armv7', | 65 'TRANSLATOR_ARCH_X8664' : 'x86-64', |
| 65 'STANDARD_ARCH_MIPS32': 'mips32', | 66 'TRANSLATOR_ARCH_ARM' : 'arm', |
| 67 'TRANSLATOR_ARCH_MIPS32': 'mips32', | |
| 66 | 68 |
| 67 'SCONS_OUT' : '${BASE_NACL}/scons-out', | 69 'SCONS_OUT' : '${BASE_NACL}/scons-out', |
| 68 | 70 |
| 69 # Driver settings | 71 # Driver settings |
| 70 'ARCH' : '', # Target architecture, including optional | 72 'ARCH' : '', # Target architecture, including optional |
| 71 # suffixes such as '_NONSFI' or '_LINUX'. | 73 # suffixes such as '_NONSFI' or '_LINUX'. |
| 72 'BASE_ARCH' : '', # Target architecture without any '_NONSFI' suffix. | 74 'BASE_ARCH' : '', # Target architecture without any '_NONSFI' suffix. |
| 73 # Derived from ARCH field. | 75 # Derived from ARCH field. |
| 74 'NONSFI_NACL' : '0', # Whether targeting Non-SFI Mode. Derived from | 76 'NONSFI_NACL' : '0', # Whether targeting Non-SFI Mode. Derived from |
| 75 # ARCH field. | 77 # ARCH field. |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 506 | 508 |
| 507 | 509 |
| 508 env = Environment() | 510 env = Environment() |
| 509 | 511 |
| 510 def override_env(meth_name, func): | 512 def override_env(meth_name, func): |
| 511 """Override a method in the global |env|, given the method name | 513 """Override a method in the global |env|, given the method name |
| 512 and the new function. | 514 and the new function. |
| 513 """ | 515 """ |
| 514 global env | 516 global env |
| 515 setattr(env, meth_name, types.MethodType(func, env, Environment)) | 517 setattr(env, meth_name, types.MethodType(func, env, Environment)) |
| OLD | NEW |