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 # This file isn't officially supported by the Chromium project. It's maintained | 6 # This file isn't officially supported by the Chromium project. It's maintained |
7 # on a best-effort basis by volunteers, so some things may be broken from time | 7 # on a best-effort basis by volunteers, so some things may be broken from time |
8 # to time. If you encounter errors, it's most often due to files in base that | 8 # to time. If you encounter errors, it's most often due to files in base that |
9 # have been added or moved since somebody last tried this script. Generally | 9 # have been added or moved since somebody last tried this script. Generally |
10 # such errors are easy to diagnose. | 10 # such errors are easy to diagnose. |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 return run_build(build_dir, options) | 107 return run_build(build_dir, options) |
108 else: | 108 else: |
109 with scoped_tempdir() as tempdir: | 109 with scoped_tempdir() as tempdir: |
110 return run_build(tempdir, options) | 110 return run_build(tempdir, options) |
111 except subprocess.CalledProcessError as e: | 111 except subprocess.CalledProcessError as e: |
112 print >> sys.stderr, str(e) | 112 print >> sys.stderr, str(e) |
113 return 1 | 113 return 1 |
114 return 0 | 114 return 0 |
115 | 115 |
116 | 116 |
| 117 def write_buildflag_header_manually(root_gen_dir, header, flags): |
| 118 mkdir_p(os.path.join(root_gen_dir, os.path.dirname(header))) |
| 119 with tempfile.NamedTemporaryFile() as f: |
| 120 f.write('--flags') |
| 121 for name,value in flags.items(): |
| 122 f.write(' ' + name + '=' + value) |
| 123 f.flush() |
| 124 |
| 125 check_call([ |
| 126 os.path.join(SRC_ROOT, 'build', 'write_buildflag_header.py'), |
| 127 '--output', header, |
| 128 '--gen-dir', root_gen_dir, |
| 129 '--definitions', f.name, |
| 130 ]) |
| 131 |
| 132 |
117 def build_gn_with_ninja_manually(tempdir, options): | 133 def build_gn_with_ninja_manually(tempdir, options): |
118 root_gen_dir = os.path.join(tempdir, 'gen') | 134 root_gen_dir = os.path.join(tempdir, 'gen') |
119 mkdir_p(root_gen_dir) | 135 mkdir_p(root_gen_dir) |
120 | 136 |
121 mkdir_p(os.path.join(root_gen_dir, 'base', 'allocator')) | 137 write_buildflag_header_manually(root_gen_dir, 'base/allocator/features.h', |
122 with tempfile.NamedTemporaryFile() as f: | 138 {'USE_EXPERIMENTAL_ALLOCATOR_SHIM': 'true' if is_linux else 'false'}) |
123 f.write('--flags USE_EXPERIMENTAL_ALLOCATOR_SHIM=%s' | |
124 % ('true' if is_linux else 'false')) | |
125 f.flush() | |
126 | 139 |
127 check_call([ | 140 write_buildflag_header_manually(root_gen_dir, 'base/debug/debugging_flags.h', |
128 os.path.join(SRC_ROOT, 'build', 'write_buildflag_header.py'), | 141 {'ENABLE_PROFILING': 'false'}) |
129 '--output', 'base/allocator/features.h', | |
130 '--gen-dir', root_gen_dir, | |
131 '--definitions', f.name, | |
132 ]) | |
133 | 142 |
134 if is_mac: | 143 if is_mac: |
135 # //base/build_time.cc needs base/generated_build_date.h, | 144 # //base/build_time.cc needs base/generated_build_date.h, |
136 # and this file is only included for Mac builds. | 145 # and this file is only included for Mac builds. |
137 mkdir_p(os.path.join(root_gen_dir, 'base')) | 146 mkdir_p(os.path.join(root_gen_dir, 'base')) |
138 check_call([ | 147 check_call([ |
139 os.path.join(SRC_ROOT, 'build', 'write_build_date_header.py'), | 148 os.path.join(SRC_ROOT, 'build', 'write_build_date_header.py'), |
140 os.path.join(root_gen_dir, 'base', 'generated_build_date.h'), | 149 os.path.join(root_gen_dir, 'base', 'generated_build_date.h'), |
141 'default' | 150 'default' |
142 ]) | 151 ]) |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 cmd.append('-v') | 522 cmd.append('-v') |
514 cmd.append('gn') | 523 cmd.append('gn') |
515 check_call(cmd) | 524 check_call(cmd) |
516 | 525 |
517 if not options.debug: | 526 if not options.debug: |
518 check_call(['strip', os.path.join(build_dir, 'gn')]) | 527 check_call(['strip', os.path.join(build_dir, 'gn')]) |
519 | 528 |
520 | 529 |
521 if __name__ == '__main__': | 530 if __name__ == '__main__': |
522 sys.exit(main(sys.argv[1:])) | 531 sys.exit(main(sys.argv[1:])) |
OLD | NEW |