| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 the V8 project authors. All rights reserved. | 2 # Copyright 2014 the V8 project authors. All rights reserved. |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following | 10 # copyright notice, this list of conditions and the following |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 | 35 |
| 36 def main(): | 36 def main(): |
| 37 print DoMain([]) | 37 print DoMain([]) |
| 38 return 0 | 38 return 0 |
| 39 | 39 |
| 40 def DoMain(_): | 40 def DoMain(_): |
| 41 """Hook to be called from gyp without starting a separate python | 41 """Hook to be called from gyp without starting a separate python |
| 42 interpreter.""" | 42 interpreter.""" |
| 43 host_arch = platform.machine() | 43 host_arch = platform.machine() |
| 44 host_system = platform.system(); |
| 44 | 45 |
| 45 # Convert machine type to format recognized by gyp. | 46 # Convert machine type to format recognized by gyp. |
| 46 if re.match(r'i.86', host_arch) or host_arch == 'i86pc': | 47 if re.match(r'i.86', host_arch) or host_arch == 'i86pc': |
| 47 host_arch = 'ia32' | 48 host_arch = 'ia32' |
| 48 elif host_arch in ['x86_64', 'amd64']: | 49 elif host_arch in ['x86_64', 'amd64']: |
| 49 host_arch = 'x64' | 50 host_arch = 'x64' |
| 50 elif host_arch.startswith('arm'): | 51 elif host_arch.startswith('arm'): |
| 51 host_arch = 'arm' | 52 host_arch = 'arm' |
| 52 elif host_arch == 'aarch64': | 53 elif host_arch == 'aarch64': |
| 53 host_arch = 'arm64' | 54 host_arch = 'arm64' |
| 54 elif host_arch == 'mips64': | 55 elif host_arch == 'mips64': |
| 55 host_arch = 'mips64el' | 56 host_arch = 'mips64el' |
| 56 elif host_arch.startswith('mips'): | 57 elif host_arch.startswith('mips'): |
| 57 host_arch = 'mipsel' | 58 host_arch = 'mipsel' |
| 58 | 59 |
| 60 # Under AIX the value returned by platform.machine is not |
| 61 # the best indicator of the host architecture |
| 62 # AIX 6.1 which is the lowest level supported only provides |
| 63 # a 64 bit kernel |
| 64 if host_system == 'AIX': |
| 65 host_arch = 'ppc64' |
| 66 |
| 59 # platform.machine is based on running kernel. It's possible to use 64-bit | 67 # platform.machine is based on running kernel. It's possible to use 64-bit |
| 60 # kernel with 32-bit userland, e.g. to give linker slightly more memory. | 68 # kernel with 32-bit userland, e.g. to give linker slightly more memory. |
| 61 # Distinguish between different userland bitness by querying | 69 # Distinguish between different userland bitness by querying |
| 62 # the python binary. | 70 # the python binary. |
| 63 if host_arch == 'x64' and platform.architecture()[0] == '32bit': | 71 if host_arch == 'x64' and platform.architecture()[0] == '32bit': |
| 64 host_arch = 'ia32' | 72 host_arch = 'ia32' |
| 65 | 73 |
| 66 return host_arch | 74 return host_arch |
| 67 | 75 |
| 68 if __name__ == '__main__': | 76 if __name__ == '__main__': |
| 69 sys.exit(main()) | 77 sys.exit(main()) |
| OLD | NEW |