| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 """Bootstraps gn. | 6 """Bootstraps gn. |
| 7 | 7 |
| 8 It is done by first building it manually in a temporary directory, then building | 8 It is done by first building it manually in a temporary directory, then building |
| 9 it with its own BUILD.gn to the final destination. | 9 it with its own BUILD.gn to the final destination. |
| 10 """ | 10 """ |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 print 'Building gn manually in a temporary directory for bootstrapping...' | 58 print 'Building gn manually in a temporary directory for bootstrapping...' |
| 59 build_gn_with_ninja_manually(tempdir, options) | 59 build_gn_with_ninja_manually(tempdir, options) |
| 60 temp_gn = os.path.join(tempdir, 'gn') | 60 temp_gn = os.path.join(tempdir, 'gn') |
| 61 out_gn = os.path.join(build_root, 'gn') | 61 out_gn = os.path.join(build_root, 'gn') |
| 62 | 62 |
| 63 if options.no_rebuild: | 63 if options.no_rebuild: |
| 64 mkdir_p(build_root) | 64 mkdir_p(build_root) |
| 65 shutil.copy2(temp_gn, out_gn) | 65 shutil.copy2(temp_gn, out_gn) |
| 66 else: | 66 else: |
| 67 print 'Building gn using itself to %s...' % build_rel | 67 print 'Building gn using itself to %s...' % build_rel |
| 68 build_gn_with_gn(temp_gn, build_rel, options) | 68 build_gn_with_gn(temp_gn, build_root, options) |
| 69 | 69 |
| 70 if options.output: | 70 if options.output: |
| 71 # Preserve the executable permission bit. | 71 # Preserve the executable permission bit. |
| 72 shutil.copy2(out_gn, options.output) | 72 shutil.copy2(out_gn, options.output) |
| 73 | 73 |
| 74 | 74 |
| 75 def main(argv): | 75 def main(argv): |
| 76 parser = optparse.OptionParser(description=sys.modules[__name__].__doc__) | 76 parser = optparse.OptionParser(description=sys.modules[__name__].__doc__) |
| 77 parser.add_option('-d', '--debug', action='store_true', | 77 parser.add_option('-d', '--debug', action='store_true', |
| 78 help='Do a debug build. Defaults to release build.') | 78 help='Do a debug build. Defaults to release build.') |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 continue | 149 continue |
| 150 full_path = os.path.join(GN_ROOT, name) | 150 full_path = os.path.join(GN_ROOT, name) |
| 151 static_libraries['gn']['sources'].append( | 151 static_libraries['gn']['sources'].append( |
| 152 os.path.relpath(full_path, SRC_ROOT)) | 152 os.path.relpath(full_path, SRC_ROOT)) |
| 153 | 153 |
| 154 static_libraries['dynamic_annotations']['sources'].extend([ | 154 static_libraries['dynamic_annotations']['sources'].extend([ |
| 155 'base/third_party/dynamic_annotations/dynamic_annotations.c', | 155 'base/third_party/dynamic_annotations/dynamic_annotations.c', |
| 156 'base/third_party/superfasthash/superfasthash.c', | 156 'base/third_party/superfasthash/superfasthash.c', |
| 157 ]) | 157 ]) |
| 158 static_libraries['base']['sources'].extend([ | 158 static_libraries['base']['sources'].extend([ |
| 159 'base/allocator/allocator_extension_thunks.cc', |
| 159 'base/at_exit.cc', | 160 'base/at_exit.cc', |
| 160 'base/base_paths.cc', | 161 'base/base_paths.cc', |
| 161 'base/base_switches.cc', | 162 'base/base_switches.cc', |
| 162 'base/callback_internal.cc', | 163 'base/callback_internal.cc', |
| 163 'base/command_line.cc', | 164 'base/command_line.cc', |
| 164 'base/debug/alias.cc', | 165 'base/debug/alias.cc', |
| 165 'base/debug/stack_trace.cc', | 166 'base/debug/stack_trace.cc', |
| 166 'base/debug/task_annotator.cc', | 167 'base/debug/task_annotator.cc', |
| 167 'base/environment.cc', | 168 'base/environment.cc', |
| 168 'base/files/file.cc', | 169 'base/files/file.cc', |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 cmd.append('-v') | 445 cmd.append('-v') |
| 445 cmd.append('gn') | 446 cmd.append('gn') |
| 446 check_call(cmd) | 447 check_call(cmd) |
| 447 | 448 |
| 448 if not options.debug: | 449 if not options.debug: |
| 449 check_call(['strip', os.path.join(build_dir, 'gn')]) | 450 check_call(['strip', os.path.join(build_dir, 'gn')]) |
| 450 | 451 |
| 451 | 452 |
| 452 if __name__ == '__main__': | 453 if __name__ == '__main__': |
| 453 sys.exit(main(sys.argv[1:])) | 454 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |