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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 build_rel = os.path.join('out', 'Release') | 71 build_rel = os.path.join('out', 'Release') |
72 build_root = os.path.join(SRC_ROOT, build_rel) | 72 build_root = os.path.join(SRC_ROOT, build_rel) |
73 | 73 |
74 try: | 74 try: |
75 with scoped_tempdir() as tempdir: | 75 with scoped_tempdir() as tempdir: |
76 print 'Building gn manually in a temporary directory for bootstrapping...' | 76 print 'Building gn manually in a temporary directory for bootstrapping...' |
77 build_gn_with_ninja_manually(tempdir, options) | 77 build_gn_with_ninja_manually(tempdir, options) |
78 temp_gn = os.path.join(tempdir, 'gn') | 78 temp_gn = os.path.join(tempdir, 'gn') |
79 out_gn = os.path.join(build_root, 'gn') | 79 out_gn = os.path.join(build_root, 'gn') |
80 | 80 |
81 if options.no_bootstrap: | 81 if options.no_rebuild: |
82 mkdir_p(build_root) | 82 mkdir_p(build_root) |
83 shutil.copy2(temp_gn, out_gn) | 83 shutil.copy2(temp_gn, out_gn) |
84 else: | 84 else: |
85 print 'Building gn using itself to %s...' % build_rel | 85 print 'Building gn using itself to %s...' % build_rel |
86 build_gn_with_gn(temp_gn, build_rel, options) | 86 build_gn_with_gn(temp_gn, build_rel, options) |
87 | 87 |
88 if options.output: | 88 if options.output: |
89 # Preserve the executable permission bit. | 89 # Preserve the executable permission bit. |
90 shutil.copy2(out_gn, options.output) | 90 shutil.copy2(out_gn, options.output) |
91 except subprocess.CalledProcessError as e: | 91 except subprocess.CalledProcessError as e: |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 cmd.append('-v') | 398 cmd.append('-v') |
399 cmd.append('gn') | 399 cmd.append('gn') |
400 check_call(cmd) | 400 check_call(cmd) |
401 | 401 |
402 if not debug: | 402 if not debug: |
403 check_call(['strip', os.path.join(build_dir, 'gn')]) | 403 check_call(['strip', os.path.join(build_dir, 'gn')]) |
404 | 404 |
405 | 405 |
406 if __name__ == '__main__': | 406 if __name__ == '__main__': |
407 sys.exit(main(sys.argv[1:])) | 407 sys.exit(main(sys.argv[1:])) |
OLD | NEW |