OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 The Chromium 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 """A helper script to print paths of NaCl binaries, includes, libs, etc. | 6 """A helper script to print paths of NaCl binaries, includes, libs, etc. |
7 | 7 |
8 It is similar in behavior to pkg-config or sdl-config. | 8 It is similar in behavior to pkg-config or sdl-config. |
9 """ | 9 """ |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 'x86_64': 'x86_64' | 37 'x86_64': 'x86_64' |
38 } | 38 } |
39 | 39 |
40 ARCH_BASE_NAME = { | 40 ARCH_BASE_NAME = { |
41 'arm': 'arm', | 41 'arm': 'arm', |
42 'x86_32': 'x86', | 42 'x86_32': 'x86', |
43 'i686': 'x86', | 43 'i686': 'x86', |
44 'x86_64': 'x86' | 44 'x86_64': 'x86' |
45 } | 45 } |
46 | 46 |
47 NACL_TOOLCHAINS = ('newlib', 'glibc', 'pnacl', 'bionic', 'clang-newlib') | 47 NACL_TOOLCHAINS = ('glibc', 'pnacl', 'bionic', 'clang-newlib') |
48 HOST_TOOLCHAINS = ('linux', 'mac', 'win') | 48 HOST_TOOLCHAINS = ('linux', 'mac', 'win') |
49 VALID_TOOLCHAINS = list(HOST_TOOLCHAINS) + list(NACL_TOOLCHAINS) + ['host'] | 49 VALID_TOOLCHAINS = list(HOST_TOOLCHAINS) + list(NACL_TOOLCHAINS) + ['host'] |
50 | 50 |
51 # This is not an exhaustive list of tools, just the ones that need to be | 51 # This is not an exhaustive list of tools, just the ones that need to be |
52 # special-cased. | 52 # special-cased. |
53 | 53 |
54 # e.g. For PNaCL cc => pnacl-clang | 54 # e.g. For PNaCL cc => pnacl-clang |
55 # For NaCl cc => pnacl-gcc | 55 # For NaCl cc => pnacl-gcc |
56 # | 56 # |
57 # Most tools will be passed through directly. | 57 # Most tools will be passed through directly. |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 return posixpath.join(GetPosixSDKPath(), 'lib') | 183 return posixpath.join(GetPosixSDKPath(), 'lib') |
184 | 184 |
185 | 185 |
186 # Commands | 186 # Commands |
187 | 187 |
188 def GetToolPath(toolchain, arch, tool): | 188 def GetToolPath(toolchain, arch, tool): |
189 if tool == 'gdb': | 189 if tool == 'gdb': |
190 # Always use the same gdb; it supports multiple toolchains/architectures. | 190 # Always use the same gdb; it supports multiple toolchains/architectures. |
191 # NOTE: this is always a i686 executable. i686-nacl-gdb is a symlink to | 191 # NOTE: this is always a i686 executable. i686-nacl-gdb is a symlink to |
192 # x86_64-nacl-gdb. | 192 # x86_64-nacl-gdb. |
193 return posixpath.join(GetToolchainBinDir('newlib', 'x86_64'), | 193 return posixpath.join(GetToolchainBinDir('glibc', 'x86_64'), |
194 'x86_64-nacl-gdb') | 194 'x86_64-nacl-gdb') |
195 | 195 |
196 if toolchain == 'pnacl': | 196 if toolchain == 'pnacl': |
197 CheckValidToolchainArch(toolchain, arch) | 197 CheckValidToolchainArch(toolchain, arch) |
198 tool = CLANG_TOOLS.get(tool, tool) | 198 tool = CLANG_TOOLS.get(tool, tool) |
199 full_tool_name = 'pnacl-%s' % tool | 199 full_tool_name = 'pnacl-%s' % tool |
200 else: | 200 else: |
201 CheckValidToolchainArch(toolchain, arch, arch_required=True) | 201 CheckValidToolchainArch(toolchain, arch, arch_required=True) |
202 ExpectArch(arch, VALID_ARCHES) | 202 ExpectArch(arch, VALID_ARCHES) |
203 if toolchain == 'clang-newlib': | 203 if toolchain == 'clang-newlib': |
204 tool = CLANG_TOOLS.get(tool, tool) | 204 tool = CLANG_TOOLS.get(tool, tool) |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 | 263 |
264 return 0 | 264 return 0 |
265 | 265 |
266 | 266 |
267 if __name__ == '__main__': | 267 if __name__ == '__main__': |
268 try: | 268 try: |
269 sys.exit(main(sys.argv[1:])) | 269 sys.exit(main(sys.argv[1:])) |
270 except Error as e: | 270 except Error as e: |
271 sys.stderr.write(str(e) + '\n') | 271 sys.stderr.write(str(e) + '\n') |
272 sys.exit(1) | 272 sys.exit(1) |
OLD | NEW |