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 """NEXE building script | 6 """NEXE building script |
| 7 | 7 |
| 8 This module will take a set of source files, include paths, library paths, and | 8 This module will take a set of source files, include paths, library paths, and |
| 9 additional arguments, and use them to build. | 9 additional arguments, and use them to build. |
| 10 """ | 10 """ |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 import time | 24 import time |
| 25 import traceback | 25 import traceback |
| 26 import urllib2 | 26 import urllib2 |
| 27 | 27 |
| 28 from build_nexe_tools import (CommandRunner, Error, FixPath, | 28 from build_nexe_tools import (CommandRunner, Error, FixPath, |
| 29 IsFile, MakeDir, RemoveFile) | 29 IsFile, MakeDir, RemoveFile) |
| 30 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) | 30 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
| 31 import pynacl.platform | 31 import pynacl.platform |
| 32 | 32 |
| 33 | 33 |
| 34 # When a header file defining NACL_BUILD_SUBARCH is introduced, | |
| 35 # we can simply remove this map. | |
| 36 # cf) https://code.google.com/p/chromium/issues/detail?id=440012. | |
| 37 NACL_BUILD_ARCH_MAP = { | |
| 38 'x86-32': ['NACL_BUILD_ARCH=x86', 'NACL_BUILD_SUBARCH=32'], | |
| 39 'x86-32-nonsfi': ['NACL_BUILD_ARCH=x86', 'NACL_BUILD_SUBARCH=32'], | |
| 40 'x86-64': ['NACL_BUILD_ARCH=x86', 'NACL_BUILD_SUBARCH=64'], | |
| 41 'arm': ['NACL_BUILD_ARCH=arm', 'NACL_BUILD_SUBARCH=32'], | |
| 42 'arm-nonsfi': ['NACL_BUILD_ARCH=arm', 'NACL_BUILD_SUBARCH=32'], | |
| 43 'mips': ['NACL_BUILD_ARCH=mips', 'NACL_BUILD_SUBARCH=32'], | |
| 44 'pnacl': ['NACL_BUILD_ARCH=pnacl'], | |
| 45 } | |
| 46 | |
| 47 | |
| 48 def RemoveQuotes(opt): | 34 def RemoveQuotes(opt): |
| 49 if opt and opt[0] == '"': | 35 if opt and opt[0] == '"': |
| 50 assert opt[-1] == '"', opt | 36 assert opt[-1] == '"', opt |
| 51 return opt[1:-1].replace('\\"', '"') | 37 return opt[1:-1].replace('\\"', '"') |
| 52 return opt | 38 return opt |
| 53 | 39 |
| 54 | 40 |
| 55 def ArgToList(opt): | 41 def ArgToList(opt): |
| 56 outlist = [] | 42 outlist = [] |
| 57 if opt is None: | 43 if opt is None: |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 344 define.startswith('NACL_BUILD_ARCH=') or | 330 define.startswith('NACL_BUILD_ARCH=') or |
| 345 define.startswith('NACL_BUILD_SUBARCH=') or | 331 define.startswith('NACL_BUILD_SUBARCH=') or |
| 346 define == 'COMPONENT_BUILD' or | 332 define == 'COMPONENT_BUILD' or |
| 347 'WIN32' in define or | 333 'WIN32' in define or |
| 348 'WINDOWS' in define or | 334 'WINDOWS' in define or |
| 349 'WINVER' in define)] | 335 'WINVER' in define)] |
| 350 define_list.extend(['NACL_WINDOWS=0', | 336 define_list.extend(['NACL_WINDOWS=0', |
| 351 'NACL_OSX=0', | 337 'NACL_OSX=0', |
| 352 'NACL_LINUX=0', | 338 'NACL_LINUX=0', |
| 353 'NACL_ANDROID=0']) | 339 'NACL_ANDROID=0']) |
| 354 define_list.extend(NACL_BUILD_ARCH_MAP[arch]) | 340 if arch == 'pnacl': |
| 341 define_list.extend(['NACL_BUILD_ARCH=pnacl']) | |
|
Nick Bray (chromium)
2015/03/31 00:25:23
I assume the header doesn't clobber this when it's
| |
| 355 options += ['-D' + define for define in define_list] | 342 options += ['-D' + define for define in define_list] |
| 356 self.compile_options = options + ['-I' + name for name in self.inc_paths] | 343 self.compile_options = options + ['-I' + name for name in self.inc_paths] |
| 357 | 344 |
| 358 def BuildLinkOptions(self, options): | 345 def BuildLinkOptions(self, options): |
| 359 """Generates link options, called once by __init__.""" | 346 """Generates link options, called once by __init__.""" |
| 360 options = ArgToList(options) | 347 options = ArgToList(options) |
| 361 if self.outtype == 'nso': | 348 if self.outtype == 'nso': |
| 362 options += ['-Wl,-rpath-link,' + name for name in self.lib_paths] | 349 options += ['-Wl,-rpath-link,' + name for name in self.lib_paths] |
| 363 options += ['-shared'] | 350 options += ['-shared'] |
| 364 options += ['-Wl,-soname,' + os.path.basename(self.Soname())] | 351 options += ['-Wl,-soname,' + os.path.basename(self.Soname())] |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1031 if build is not None: | 1018 if build is not None: |
| 1032 build.EmitDeferredLog() | 1019 build.EmitDeferredLog() |
| 1033 return 1 | 1020 return 1 |
| 1034 except: | 1021 except: |
| 1035 if build is not None: | 1022 if build is not None: |
| 1036 build.EmitDeferredLog() | 1023 build.EmitDeferredLog() |
| 1037 raise | 1024 raise |
| 1038 | 1025 |
| 1039 if __name__ == '__main__': | 1026 if __name__ == '__main__': |
| 1040 sys.exit(Main(sys.argv)) | 1027 sys.exit(Main(sys.argv)) |
| OLD | NEW |