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 """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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 # passes arguments to scons | 109 # passes arguments to scons |
| 110 NACL_SDK_INCLUDE='%s/%s/include' % (sdk_path, tool_prefix), | 110 NACL_SDK_INCLUDE='%s/%s/include' % (sdk_path, tool_prefix), |
| 111 # where to find/put nacl generic extra sdk libraries | 111 # where to find/put nacl generic extra sdk libraries |
| 112 NACL_SDK_LIB='%s/%s' % (sdk_path, libdir), | 112 NACL_SDK_LIB='%s/%s' % (sdk_path, libdir), |
| 113 # Replace the normal unix tools with the NaCl ones. | 113 # Replace the normal unix tools with the NaCl ones. |
| 114 CC=os.path.join(bin_path, '%s-%s' % (tool_prefix, cc)), | 114 CC=os.path.join(bin_path, '%s-%s' % (tool_prefix, cc)), |
| 115 CXX=os.path.join(bin_path, '%s-%s' % (tool_prefix, cxx)), | 115 CXX=os.path.join(bin_path, '%s-%s' % (tool_prefix, cxx)), |
| 116 AR=os.path.join(bin_path, '%s-ar' % tool_prefix), | 116 AR=os.path.join(bin_path, '%s-ar' % tool_prefix), |
| 117 AS=os.path.join(bin_path, '%s-as' % tool_prefix), | 117 AS=os.path.join(bin_path, '%s-as' % tool_prefix), |
| 118 ASPP=os.path.join(bin_path, '%s-%s' % (tool_prefix, cc)), | 118 ASPP=os.path.join(bin_path, '%s-%s' % (tool_prefix, cc)), |
| 119 FILECHECK=os.path.join(bin_path, '%s-FileCheck' % tool_prefix), | |
|
Derek Schuff
2015/03/23 16:25:07
The util binaries don't have the tool_prefix on th
Mircea Trofin
2015/03/23 17:27:20
Done.
| |
| 119 GDB=os.path.join(bin_path, '%s-gdb' % tool_prefix), | 120 GDB=os.path.join(bin_path, '%s-gdb' % tool_prefix), |
| 120 # NOTE: use g++ for linking so we can handle C AND C++. | 121 # NOTE: use g++ for linking so we can handle C AND C++. |
| 121 LINK=os.path.join(bin_path, '%s-%s' % (tool_prefix, cxx)), | 122 LINK=os.path.join(bin_path, '%s-%s' % (tool_prefix, cxx)), |
| 122 # Grrr... and sometimes we really need ld. | 123 # Grrr... and sometimes we really need ld. |
| 123 LD=os.path.join(bin_path, '%s-ld' % tool_prefix) + ld_mode_flag, | 124 LD=os.path.join(bin_path, '%s-ld' % tool_prefix) + ld_mode_flag, |
| 124 RANLIB=os.path.join(bin_path, '%s-ranlib' % tool_prefix), | 125 RANLIB=os.path.join(bin_path, '%s-ranlib' % tool_prefix), |
| 125 NM=os.path.join(bin_path, '%s-nm' % tool_prefix), | 126 NM=os.path.join(bin_path, '%s-nm' % tool_prefix), |
| 126 OBJDUMP=os.path.join(bin_path, '%s-objdump' % tool_prefix), | 127 OBJDUMP=os.path.join(bin_path, '%s-objdump' % tool_prefix), |
| 127 OBJCOPY=os.path.join(bin_path, '%s-objcopy' % tool_prefix), | 128 OBJCOPY=os.path.join(bin_path, '%s-objcopy' % tool_prefix), |
| 128 STRIP=os.path.join(bin_path, '%s-strip' % tool_prefix), | 129 STRIP=os.path.join(bin_path, '%s-strip' % tool_prefix), |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 186 elif env.Bit('build_x86_64'): | 187 elif env.Bit('build_x86_64'): |
| 187 llc_cpu = 'x86_64' | 188 llc_cpu = 'x86_64' |
| 188 | 189 |
| 189 if env.Bit('host_linux'): | 190 if env.Bit('host_linux'): |
| 190 llc_mtriple_flag = ' -mtriple=%s-linux-gnu' % llc_cpu | 191 llc_mtriple_flag = ' -mtriple=%s-linux-gnu' % llc_cpu |
| 191 elif env.Bit('host_mac'): | 192 elif env.Bit('host_mac'): |
| 192 llc_mtriple_flag = ' -mtriple=%s-apple-darwin' % llc_cpu | 193 llc_mtriple_flag = ' -mtriple=%s-apple-darwin' % llc_cpu |
| 193 | 194 |
| 194 translator_root = os.path.join(os.path.dirname(root), 'pnacl_translator') | 195 translator_root = os.path.join(os.path.dirname(root), 'pnacl_translator') |
| 195 | 196 |
| 196 binprefix = os.path.join(root, 'bin', 'pnacl-') | 197 binroot = os.path.join(root, 'bin') |
| 198 binprefix = os.path.join(binroot, 'pnacl-') | |
| 197 binext = '' | 199 binext = '' |
| 198 if env.Bit('host_windows'): | 200 if env.Bit('host_windows'): |
| 199 binext = '.bat' | 201 binext = '.bat' |
| 200 | 202 |
| 201 pnacl_ar = binprefix + 'ar' + binext | 203 pnacl_ar = binprefix + 'ar' + binext |
| 202 pnacl_as = binprefix + 'as' + binext | 204 pnacl_as = binprefix + 'as' + binext |
| 203 pnacl_nm = binprefix + 'nm' + binext | 205 pnacl_nm = binprefix + 'nm' + binext |
| 204 pnacl_ranlib = binprefix + 'ranlib' + binext | 206 pnacl_ranlib = binprefix + 'ranlib' + binext |
| 205 # Use the standalone sandboxed translator in sbtc mode | 207 # Use the standalone sandboxed translator in sbtc mode |
| 206 if env.Bit('use_sandboxed_translator'): | 208 if env.Bit('use_sandboxed_translator'): |
| 207 pnacl_translate = os.path.join(translator_root, 'bin', | 209 pnacl_translate = os.path.join(translator_root, 'bin', |
| 208 'pnacl-translate' + binext) | 210 'pnacl-translate' + binext) |
| 209 else: | 211 else: |
| 210 pnacl_translate = binprefix + 'translate' + binext | 212 pnacl_translate = binprefix + 'translate' + binext |
| 211 | 213 |
| 212 pnacl_cc = binprefix + 'clang' + binext | 214 pnacl_cc = binprefix + 'clang' + binext |
| 213 pnacl_cxx = binprefix + 'clang++' + binext | 215 pnacl_cxx = binprefix + 'clang++' + binext |
| 214 | 216 |
| 215 pnacl_ld = binprefix + 'ld' + binext | 217 pnacl_ld = binprefix + 'ld' + binext |
| 216 pnacl_disass = binprefix + 'dis' + binext | 218 pnacl_disass = binprefix + 'dis' + binext |
| 219 pnacl_filecheck = os.path.join(binroot, 'FileCheck') | |
| 217 pnacl_finalize = binprefix + 'finalize' + binext | 220 pnacl_finalize = binprefix + 'finalize' + binext |
| 218 pnacl_opt = binprefix + 'opt' + binext | 221 pnacl_opt = binprefix + 'opt' + binext |
| 219 pnacl_strip = binprefix + 'strip' + binext | 222 pnacl_strip = binprefix + 'strip' + binext |
| 220 pnacl_llc = binprefix + 'llc' + binext | 223 pnacl_llc = binprefix + 'llc' + binext |
| 221 | 224 |
| 222 # NOTE: XXX_flags start with space for easy concatenation | 225 # NOTE: XXX_flags start with space for easy concatenation |
| 223 # The flags generated here get baked into the commands (CC, CXX, LINK) | 226 # The flags generated here get baked into the commands (CC, CXX, LINK) |
| 224 # instead of CFLAGS etc to keep them from getting blown away by some | 227 # instead of CFLAGS etc to keep them from getting blown away by some |
| 225 # tests. Don't add flags here unless they always need to be preserved. | 228 # tests. Don't add flags here unless they always need to be preserved. |
| 226 pnacl_cxx_flags = '' | 229 pnacl_cxx_flags = '' |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 282 LINK=pnacl_cxx + ld_arch_flag + pnacl_ld_flags, | 285 LINK=pnacl_cxx + ld_arch_flag + pnacl_ld_flags, |
| 283 # Although we are currently forced to produce native output | 286 # Although we are currently forced to produce native output |
| 284 # for LINK, we are free to produce bitcode for SHLINK | 287 # for LINK, we are free to produce bitcode for SHLINK |
| 285 # (SharedLibrary linking) because scons doesn't do anything | 288 # (SharedLibrary linking) because scons doesn't do anything |
| 286 # with shared libraries except use them with the toolchain. | 289 # with shared libraries except use them with the toolchain. |
| 287 SHLINK=pnacl_cxx + ld_arch_flag + pnacl_ld_flags, | 290 SHLINK=pnacl_cxx + ld_arch_flag + pnacl_ld_flags, |
| 288 LD=pnacl_ld, | 291 LD=pnacl_ld, |
| 289 AR=pnacl_ar, | 292 AR=pnacl_ar, |
| 290 AS=pnacl_as + ld_arch_flag, | 293 AS=pnacl_as + ld_arch_flag, |
| 291 RANLIB=pnacl_ranlib, | 294 RANLIB=pnacl_ranlib, |
| 295 FILECHECK=pnacl_filecheck, | |
| 292 DISASS=pnacl_disass, | 296 DISASS=pnacl_disass, |
| 293 OBJDUMP=pnacl_disass, | 297 OBJDUMP=pnacl_disass, |
| 294 STRIP=pnacl_strip, | 298 STRIP=pnacl_strip, |
| 295 TRANSLATE=pnacl_translate + arch_flag + pnacl_translate_flags, | 299 TRANSLATE=pnacl_translate + arch_flag + pnacl_translate_flags, |
| 296 PNACLFINALIZE=pnacl_finalize, | 300 PNACLFINALIZE=pnacl_finalize, |
| 297 PNACLOPT=pnacl_opt, | 301 PNACLOPT=pnacl_opt, |
| 298 LLC=pnacl_llc + llc_mtriple_flag + pnacl_llc_flags, | 302 LLC=pnacl_llc + llc_mtriple_flag + pnacl_llc_flags, |
| 299 ) | 303 ) |
| 300 | 304 |
| 301 if env.Bit('built_elsewhere'): | 305 if env.Bit('built_elsewhere'): |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 727 # translation. | 731 # translation. |
| 728 if not os.path.exists(version_file) or env.Bit('use_sandboxed_translator'): | 732 if not os.path.exists(version_file) or env.Bit('use_sandboxed_translator'): |
| 729 version_file = os.path.join(os.path.dirname(root), 'pnacl_translator', | 733 version_file = os.path.join(os.path.dirname(root), 'pnacl_translator', |
| 730 'FEATURE_VERSION') | 734 'FEATURE_VERSION') |
| 731 if os.path.exists(version_file): | 735 if os.path.exists(version_file): |
| 732 with open(version_file, 'r') as fh: | 736 with open(version_file, 'r') as fh: |
| 733 version = int(fh.read()) | 737 version = int(fh.read()) |
| 734 else: | 738 else: |
| 735 version = 0 | 739 version = 0 |
| 736 env.Replace(TOOLCHAIN_FEATURE_VERSION=version) | 740 env.Replace(TOOLCHAIN_FEATURE_VERSION=version) |
| OLD | NEW |