| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright 2014 The Crashpad Authors. All rights reserved. | 3 # Copyright 2014 The Crashpad Authors. All rights reserved. |
| 4 # | 4 # |
| 5 # Licensed under the Apache License, Version 2.0 (the "License"); | 5 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 # you may not use this file except in compliance with the License. | 6 # you may not use this file except in compliance with the License. |
| 7 # You may obtain a copy of the License at | 7 # You may obtain a copy of the License at |
| 8 # | 8 # |
| 9 # http://www.apache.org/licenses/LICENSE-2.0 | 9 # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 # | 10 # |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 The local path, used in standalone builds, is preferred. If it is not present | 24 The local path, used in standalone builds, is preferred. If it is not present |
| 25 but the external path is, the external path will be used. If neither path is | 25 but the external path is, the external path will be used. If neither path is |
| 26 present, the local path will be used, so that error messages uniformly refer | 26 present, the local path will be used, so that error messages uniformly refer |
| 27 to the local path. | 27 to the local path. |
| 28 | 28 |
| 29 Args: | 29 Args: |
| 30 local_path: The preferred local path to use for a standalone build. | 30 local_path: The preferred local path to use for a standalone build. |
| 31 external_path: The external path to fall back to. | 31 external_path: The external path to fall back to. |
| 32 | 32 |
| 33 Returns: | 33 Returns: |
| 34 A 2-tuple. The first element is 'standalone' or 'external', depending on | 34 A 2-tuple. The first element is None or 'external', depending on whether |
| 35 whether local_path or external_path was chosen. The second element is the | 35 local_path or external_path was chosen. The second element is the chosen |
| 36 chosen path. | 36 path. |
| 37 """ | 37 """ |
| 38 if os.path.exists(local_path) or not os.path.exists(external_path): | 38 if os.path.exists(local_path) or not os.path.exists(external_path): |
| 39 return ('standalone', local_path) | 39 return (None, local_path) |
| 40 return ('external', external_path) | 40 return ('external', external_path) |
| 41 | 41 |
| 42 | 42 |
| 43 script_dir = os.path.dirname(__file__) | 43 script_dir = os.path.dirname(__file__) |
| 44 crashpad_dir = (os.path.dirname(script_dir) if script_dir not in ('', os.curdir) | 44 crashpad_dir = (os.path.dirname(script_dir) if script_dir not in ('', os.curdir) |
| 45 else os.pardir) | 45 else os.pardir) |
| 46 | 46 |
| 47 sys.path.insert(0, | 47 sys.path.insert(0, |
| 48 ChooseDependencyPath(os.path.join(crashpad_dir, 'third_party', 'gyp', 'gyp', | 48 ChooseDependencyPath(os.path.join(crashpad_dir, 'third_party', 'gyp', 'gyp', |
| 49 'pylib'), | 49 'pylib'), |
| 50 os.path.join(crashpad_dir, os.pardir, os.pardir, 'gyp', | 50 os.path.join(crashpad_dir, os.pardir, os.pardir, 'gyp', |
| 51 'pylib'))[1]) | 51 'pylib'))[1]) |
| 52 | 52 |
| 53 import gyp | 53 import gyp |
| 54 | 54 |
| 55 | 55 |
| 56 def main(args): | 56 def main(args): |
| 57 if 'GYP_GENERATORS' not in os.environ: | 57 if 'GYP_GENERATORS' not in os.environ: |
| 58 os.environ['GYP_GENERATORS'] = 'ninja' | 58 os.environ['GYP_GENERATORS'] = 'ninja' |
| 59 | 59 |
| 60 crashpad_dir_or_dot = crashpad_dir if crashpad_dir is not '' else os.curdir | 60 crashpad_dir_or_dot = crashpad_dir if crashpad_dir is not '' else os.curdir |
| 61 | 61 |
| 62 (dependencies, mini_chromium_dir) = (ChooseDependencyPath( | 62 (dependencies, mini_chromium_dir) = (ChooseDependencyPath( |
| 63 os.path.join(crashpad_dir, 'third_party', 'mini_chromium', | 63 os.path.join(crashpad_dir, 'third_party', 'mini_chromium', |
| 64 'mini_chromium', 'build', 'common.gypi'), | 64 'mini_chromium', 'build', 'common.gypi'), |
| 65 os.path.join(crashpad_dir, os.pardir, os.pardir, 'mini_chromium', | 65 os.path.join(crashpad_dir, os.pardir, os.pardir, 'mini_chromium', |
| 66 'mini_chromium', 'build', 'common.gypi'))) | 66 'mini_chromium', 'build', 'common.gypi'))) |
| 67 args.extend(['-D', 'crashpad_dependencies=%s' % dependencies]) | 67 if dependencies is not None: |
| 68 args.extend(['-D', 'crashpad_dependencies=%s' % dependencies]) |
| 68 args.extend(['--include', mini_chromium_dir]) | 69 args.extend(['--include', mini_chromium_dir]) |
| 69 args.extend(['--depth', crashpad_dir_or_dot]) | 70 args.extend(['--depth', crashpad_dir_or_dot]) |
| 70 args.append(os.path.join(crashpad_dir, 'crashpad.gyp')) | 71 args.append(os.path.join(crashpad_dir, 'crashpad.gyp')) |
| 71 | 72 |
| 72 result = gyp.main(args) | 73 result = gyp.main(args) |
| 73 if result != 0: | 74 if result != 0: |
| 74 return result | 75 return result |
| 75 | 76 |
| 76 if sys.platform == 'win32': | 77 if sys.platform == 'win32': |
| 77 # Also generate the x86 build. | 78 # Also generate the x86 build. |
| 78 result = gyp.main(args + ['-D', 'target_arch=ia32', '-G', 'config=Debug']) | 79 result = gyp.main(args + ['-D', 'target_arch=ia32', '-G', 'config=Debug']) |
| 79 if result != 0: | 80 if result != 0: |
| 80 return result | 81 return result |
| 81 result = gyp.main(args + ['-D', 'target_arch=ia32', '-G', 'config=Release']) | 82 result = gyp.main(args + ['-D', 'target_arch=ia32', '-G', 'config=Release']) |
| 82 | 83 |
| 83 return result | 84 return result |
| 84 | 85 |
| 85 | 86 |
| 86 if __name__ == '__main__': | 87 if __name__ == '__main__': |
| 87 sys.exit(main(sys.argv[1:])) | 88 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |