Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """This script lays out the PNaCl translator files for a | 6 """This script lays out the PNaCl translator files for a |
| 7 normal Chrome installer, for one platform. Once run num-of-arches times, | 7 normal Chrome installer, for one platform. Once run num-of-arches times, |
| 8 the result can then be packed into a multi-CRX zip file. | 8 the result can then be packed into a multi-CRX zip file. |
| 9 | 9 |
| 10 This script depends on and pulls in the translator nexes and libraries | 10 This script depends on and pulls in the translator nexes and libraries |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 # This is based on the machine "building" this extension. | 31 # This is based on the machine "building" this extension. |
| 32 # We also used this to identify the arch-specific different versions of | 32 # We also used this to identify the arch-specific different versions of |
| 33 # this extension. | 33 # this extension. |
| 34 | 34 |
| 35 def CanonicalArch(arch): | 35 def CanonicalArch(arch): |
| 36 if arch in ('x86_64', 'x86-64', 'x64', 'amd64'): | 36 if arch in ('x86_64', 'x86-64', 'x64', 'amd64'): |
| 37 return 'x86-64' | 37 return 'x86-64' |
| 38 # TODO(jvoung): be more specific about the arm architecture version? | 38 # TODO(jvoung): be more specific about the arm architecture version? |
| 39 if arch in ('arm', 'armv7'): | 39 if arch in ('arm', 'armv7'): |
| 40 return 'arm' | 40 return 'arm' |
| 41 if arch in ('mips', 'mipsel'): | |
| 42 return 'mips' | |
|
jvoung (off chromium)
2014/02/06 00:39:56
can you just make the canonical arch "mips32" put
petarj
2014/02/20 00:23:18
Done.
| |
| 41 if re.match('^i.86$', arch) or arch in ('x86_32', 'x86-32', 'ia32', 'x86'): | 43 if re.match('^i.86$', arch) or arch in ('x86_32', 'x86-32', 'ia32', 'x86'): |
| 42 return 'x86-32' | 44 return 'x86-32' |
| 43 return None | 45 return None |
| 44 | 46 |
| 45 def GetBuildArch(): | 47 def GetBuildArch(): |
| 46 arch = platform.machine() | 48 arch = platform.machine() |
| 47 return CanonicalArch(arch) | 49 return CanonicalArch(arch) |
| 48 | 50 |
| 49 BUILD_ARCH = GetBuildArch() | 51 BUILD_ARCH = GetBuildArch() |
| 50 ARCHES = ['x86-32', 'x86-64', 'arm'] | 52 ARCHES = ['x86-32', 'x86-64', 'arm', 'mips'] |
| 51 | 53 |
| 52 def IsValidArch(arch): | 54 def IsValidArch(arch): |
| 53 return arch in ARCHES | 55 return arch in ARCHES |
| 54 | 56 |
| 55 # The version of the arch used by configure and pnacl's build.sh. | 57 # The version of the arch used by configure and pnacl's build.sh. |
| 56 def StandardArch(arch): | 58 def StandardArch(arch): |
| 57 return {'x86-32': 'i686', | 59 return {'x86-32': 'i686', |
| 58 'x86-64': 'x86_64', | 60 'x86-64': 'x86_64', |
| 59 'arm' : 'armv7'}[arch] | 61 'arm' : 'armv7', |
| 62 'mips' : 'mips'}[arch] | |
| 60 | 63 |
| 61 | 64 |
| 62 ###################################################################### | 65 ###################################################################### |
| 63 | 66 |
| 64 def GetNaClRoot(): | 67 def GetNaClRoot(): |
| 65 """ Find the native_client path, relative to this script. | 68 """ Find the native_client path, relative to this script. |
| 66 This script is in ppapi/... and native_client is a sibling of ppapi. | 69 This script is in ppapi/... and native_client is a sibling of ppapi. |
| 67 """ | 70 """ |
| 68 script_file = os.path.abspath(__file__) | 71 script_file = os.path.abspath(__file__) |
| 69 def SearchForNaCl(cur_dir): | 72 def SearchForNaCl(cur_dir): |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 class PnaclDirs(object): | 182 class PnaclDirs(object): |
| 180 toolchain_dir = J(NACL_ROOT, 'toolchain') | 183 toolchain_dir = J(NACL_ROOT, 'toolchain') |
| 181 output_dir = J(toolchain_dir, 'pnacl-package') | 184 output_dir = J(toolchain_dir, 'pnacl-package') |
| 182 | 185 |
| 183 @staticmethod | 186 @staticmethod |
| 184 def TranslatorRoot(): | 187 def TranslatorRoot(): |
| 185 return J(PnaclDirs.toolchain_dir, 'pnacl_translator') | 188 return J(PnaclDirs.toolchain_dir, 'pnacl_translator') |
| 186 | 189 |
| 187 @staticmethod | 190 @staticmethod |
| 188 def LibDir(target_arch): | 191 def LibDir(target_arch): |
| 192 # Libraries for MIPS are located in lib-mips32 directory. | |
| 193 if (target_arch == "mips"): | |
| 194 return J(PnaclDirs.TranslatorRoot(), 'lib-mips32') | |
|
dmichael (off chromium)
2014/02/05 23:55:22
I'm not very familiar with this code, but... why
petarj
2014/02/06 00:38:48
PNaCl uses mips32 to refer to 32bit MIPS LE. This
| |
| 189 return J(PnaclDirs.TranslatorRoot(), 'lib-%s' % target_arch) | 195 return J(PnaclDirs.TranslatorRoot(), 'lib-%s' % target_arch) |
| 190 | 196 |
| 191 @staticmethod | 197 @staticmethod |
| 192 def SandboxedCompilerDir(target_arch): | 198 def SandboxedCompilerDir(target_arch): |
| 193 return J(PnaclDirs.toolchain_dir, | 199 return J(PnaclDirs.toolchain_dir, |
| 194 'pnacl_translator', StandardArch(target_arch), 'bin') | 200 'pnacl_translator', StandardArch(target_arch), 'bin') |
| 195 | 201 |
| 196 @staticmethod | 202 @staticmethod |
| 197 def SetOutputDir(d): | 203 def SetOutputDir(d): |
| 198 PnaclDirs.output_dir = d | 204 PnaclDirs.output_dir = d |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 372 | 378 |
| 373 abi_version = int(args[0]) | 379 abi_version = int(args[0]) |
| 374 | 380 |
| 375 arches = DetermineInstallerArches(options.target_arch) | 381 arches = DetermineInstallerArches(options.target_arch) |
| 376 BuildInstallerStyle(abi_version, lib_overrides, arches) | 382 BuildInstallerStyle(abi_version, lib_overrides, arches) |
| 377 return 0 | 383 return 0 |
| 378 | 384 |
| 379 | 385 |
| 380 if __name__ == '__main__': | 386 if __name__ == '__main__': |
| 381 sys.exit(Main()) | 387 sys.exit(Main()) |
| OLD | NEW |