Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: tools/gn/bootstrap/bootstrap.py

Issue 1832073002: Fix GN bootstrap on Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 build_gn_with_ninja_manually(tempdir, options): 117 def build_gn_with_ninja_manually(tempdir, options):
118 root_gen_dir = os.path.join(tempdir, 'gen') 118 root_gen_dir = os.path.join(tempdir, 'gen')
119 mkdir_p(root_gen_dir) 119 mkdir_p(root_gen_dir)
120 120
121 if is_linux:
122 mkdir_p(os.path.join(root_gen_dir, 'base', 'allocator'))
123 with tempfile.NamedTemporaryFile() as f:
124 f.write('--flags USE_EXPERIMENTAL_ALLOCATOR_SHIM=true')
125 f.flush()
126
127 check_call([
128 os.path.join(SRC_ROOT, 'build', 'write_buildflag_header.py'),
129 '--output', 'base/allocator/features.h',
130 '--gen-dir', root_gen_dir,
131 '--definitions', f.name,
132 ])
133
121 if is_mac: 134 if is_mac:
122 # //base/build_time.cc needs base/generated_build_date.h, 135 # //base/build_time.cc needs base/generated_build_date.h,
123 # and this file is only included for Mac builds. 136 # and this file is only included for Mac builds.
124 mkdir_p(os.path.join(root_gen_dir, 'base')) 137 mkdir_p(os.path.join(root_gen_dir, 'base'))
125 check_call([ 138 check_call([
126 os.path.join(SRC_ROOT, 'build', 'write_build_date_header.py'), 139 os.path.join(SRC_ROOT, 'build', 'write_build_date_header.py'),
127 os.path.join(root_gen_dir, 'base', 'generated_build_date.h'), 140 os.path.join(root_gen_dir, 'base', 'generated_build_date.h'),
128 'default' 141 'default'
129 ]) 142 ])
130 143
(...skipping 17 matching lines...) Expand all
148 # //base/allocator/allocator_extension.cc needs this macro defined, 161 # //base/allocator/allocator_extension.cc needs this macro defined,
149 # otherwise there would be link errors. 162 # otherwise there would be link errors.
150 cflags.extend(['-DNO_TCMALLOC']) 163 cflags.extend(['-DNO_TCMALLOC'])
151 164
152 if is_posix: 165 if is_posix:
153 if options.debug: 166 if options.debug:
154 cflags.extend(['-O0', '-g']) 167 cflags.extend(['-O0', '-g'])
155 else: 168 else:
156 cflags.extend(['-O2', '-g0']) 169 cflags.extend(['-O2', '-g0'])
157 170
158 cflags.extend(['-D_FILE_OFFSET_BITS=64', '-pthread', '-pipe']) 171 cflags.extend([
172 '-D_FILE_OFFSET_BITS=64',
173 '-pthread',
174 '-pipe',
175 '-fno-exceptions'
176 ])
159 cflags_cc.extend(['-std=c++11', '-Wno-c++11-narrowing']) 177 cflags_cc.extend(['-std=c++11', '-Wno-c++11-narrowing'])
160 178
161 static_libraries = { 179 static_libraries = {
162 'base': {'sources': [], 'tool': 'cxx'}, 180 'base': {'sources': [], 'tool': 'cxx', 'include_dirs': []},
163 'dynamic_annotations': {'sources': [], 'tool': 'cc'}, 181 'dynamic_annotations': {'sources': [], 'tool': 'cc', 'include_dirs': []},
164 'gn': {'sources': [], 'tool': 'cxx'}, 182 'gn': {'sources': [], 'tool': 'cxx', 'include_dirs': []},
165 } 183 }
166 184
167 for name in os.listdir(GN_ROOT): 185 for name in os.listdir(GN_ROOT):
168 if not name.endswith('.cc'): 186 if not name.endswith('.cc'):
169 continue 187 continue
170 if name.endswith('_unittest.cc'): 188 if name.endswith('_unittest.cc'):
171 continue 189 continue
172 if name == 'run_all_unittests.cc': 190 if name == 'run_all_unittests.cc':
173 continue 191 continue
174 full_path = os.path.join(GN_ROOT, name) 192 full_path = os.path.join(GN_ROOT, name)
175 static_libraries['gn']['sources'].append( 193 static_libraries['gn']['sources'].append(
176 os.path.relpath(full_path, SRC_ROOT)) 194 os.path.relpath(full_path, SRC_ROOT))
177 195
178 static_libraries['dynamic_annotations']['sources'].extend([ 196 static_libraries['dynamic_annotations']['sources'].extend([
179 'base/third_party/dynamic_annotations/dynamic_annotations.c', 197 'base/third_party/dynamic_annotations/dynamic_annotations.c',
180 'base/third_party/superfasthash/superfasthash.c', 198 'base/third_party/superfasthash/superfasthash.c',
181 ]) 199 ])
182 static_libraries['base']['sources'].extend([ 200 static_libraries['base']['sources'].extend([
183 'base/allocator/allocator_extension.cc', 201 'base/allocator/allocator_extension.cc',
202 'base/allocator/allocator_shim.cc',
184 'base/at_exit.cc', 203 'base/at_exit.cc',
185 'base/base_paths.cc', 204 'base/base_paths.cc',
186 'base/base_switches.cc', 205 'base/base_switches.cc',
187 'base/callback_internal.cc', 206 'base/callback_internal.cc',
188 'base/command_line.cc', 207 'base/command_line.cc',
189 'base/debug/alias.cc', 208 'base/debug/alias.cc',
190 'base/debug/stack_trace.cc', 209 'base/debug/stack_trace.cc',
191 'base/debug/task_annotator.cc', 210 'base/debug/task_annotator.cc',
192 'base/environment.cc', 211 'base/environment.cc',
193 'base/files/file.cc', 212 'base/files/file.cc',
(...skipping 19 matching lines...) Expand all
213 'base/memory/singleton.cc', 232 'base/memory/singleton.cc',
214 'base/memory/weak_ptr.cc', 233 'base/memory/weak_ptr.cc',
215 'base/message_loop/incoming_task_queue.cc', 234 'base/message_loop/incoming_task_queue.cc',
216 'base/message_loop/message_loop.cc', 235 'base/message_loop/message_loop.cc',
217 'base/message_loop/message_loop_task_runner.cc', 236 'base/message_loop/message_loop_task_runner.cc',
218 'base/message_loop/message_pump.cc', 237 'base/message_loop/message_pump.cc',
219 'base/message_loop/message_pump_default.cc', 238 'base/message_loop/message_pump_default.cc',
220 'base/metrics/bucket_ranges.cc', 239 'base/metrics/bucket_ranges.cc',
221 'base/metrics/histogram.cc', 240 'base/metrics/histogram.cc',
222 'base/metrics/histogram_base.cc', 241 'base/metrics/histogram_base.cc',
223 'base/metrics/histogram_persistence.cc',
224 'base/metrics/histogram_samples.cc', 242 'base/metrics/histogram_samples.cc',
225 'base/metrics/metrics_hashes.cc', 243 'base/metrics/metrics_hashes.cc',
244 'base/metrics/persistent_histogram_allocator.cc',
226 'base/metrics/persistent_memory_allocator.cc', 245 'base/metrics/persistent_memory_allocator.cc',
246 'base/metrics/persistent_sample_map.cc',
227 'base/metrics/sample_map.cc', 247 'base/metrics/sample_map.cc',
228 'base/metrics/sample_vector.cc', 248 'base/metrics/sample_vector.cc',
229 'base/metrics/sparse_histogram.cc', 249 'base/metrics/sparse_histogram.cc',
230 'base/metrics/statistics_recorder.cc', 250 'base/metrics/statistics_recorder.cc',
231 'base/path_service.cc', 251 'base/path_service.cc',
232 'base/pending_task.cc', 252 'base/pending_task.cc',
233 'base/pickle.cc', 253 'base/pickle.cc',
234 'base/process/kill.cc', 254 'base/process/kill.cc',
235 'base/process/process_iterator.cc', 255 'base/process/process_iterator.cc',
236 'base/process/process_metrics.cc', 256 'base/process/process_metrics.cc',
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 'base/threading/thread_collision_warner.cc', 289 'base/threading/thread_collision_warner.cc',
270 'base/threading/thread_id_name_manager.cc', 290 'base/threading/thread_id_name_manager.cc',
271 'base/threading/thread_local_storage.cc', 291 'base/threading/thread_local_storage.cc',
272 'base/threading/thread_restrictions.cc', 292 'base/threading/thread_restrictions.cc',
273 'base/threading/worker_pool.cc', 293 'base/threading/worker_pool.cc',
274 'base/time/time.cc', 294 'base/time/time.cc',
275 'base/timer/elapsed_timer.cc', 295 'base/timer/elapsed_timer.cc',
276 'base/timer/timer.cc', 296 'base/timer/timer.cc',
277 'base/trace_event/heap_profiler_allocation_context.cc', 297 'base/trace_event/heap_profiler_allocation_context.cc',
278 'base/trace_event/heap_profiler_allocation_context_tracker.cc', 298 'base/trace_event/heap_profiler_allocation_context_tracker.cc',
299 'base/trace_event/heap_profiler_allocation_register.cc',
300 'base/trace_event/heap_profiler_heap_dump_writer.cc',
279 'base/trace_event/heap_profiler_stack_frame_deduplicator.cc', 301 'base/trace_event/heap_profiler_stack_frame_deduplicator.cc',
280 'base/trace_event/heap_profiler_type_name_deduplicator.cc', 302 'base/trace_event/heap_profiler_type_name_deduplicator.cc',
281 'base/trace_event/memory_allocator_dump.cc', 303 'base/trace_event/memory_allocator_dump.cc',
282 'base/trace_event/memory_allocator_dump_guid.cc', 304 'base/trace_event/memory_allocator_dump_guid.cc',
283 'base/trace_event/memory_dump_manager.cc', 305 'base/trace_event/memory_dump_manager.cc',
284 'base/trace_event/memory_dump_request_args.cc', 306 'base/trace_event/memory_dump_request_args.cc',
285 'base/trace_event/memory_dump_session_state.cc', 307 'base/trace_event/memory_dump_session_state.cc',
286 'base/trace_event/process_memory_dump.cc', 308 'base/trace_event/process_memory_dump.cc',
287 'base/trace_event/process_memory_maps.cc', 309 'base/trace_event/process_memory_maps.cc',
288 'base/trace_event/process_memory_totals.cc', 310 'base/trace_event/process_memory_totals.cc',
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 'base/synchronization/condition_variable_posix.cc', 343 'base/synchronization/condition_variable_posix.cc',
322 'base/synchronization/lock_impl_posix.cc', 344 'base/synchronization/lock_impl_posix.cc',
323 'base/synchronization/waitable_event_posix.cc', 345 'base/synchronization/waitable_event_posix.cc',
324 'base/sys_info_posix.cc', 346 'base/sys_info_posix.cc',
325 'base/threading/platform_thread_internal_posix.cc', 347 'base/threading/platform_thread_internal_posix.cc',
326 'base/threading/platform_thread_posix.cc', 348 'base/threading/platform_thread_posix.cc',
327 'base/threading/thread_local_posix.cc', 349 'base/threading/thread_local_posix.cc',
328 'base/threading/thread_local_storage_posix.cc', 350 'base/threading/thread_local_storage_posix.cc',
329 'base/threading/worker_pool_posix.cc', 351 'base/threading/worker_pool_posix.cc',
330 'base/time/time_posix.cc', 352 'base/time/time_posix.cc',
353 'base/trace_event/heap_profiler_allocation_register_posix.cc',
331 ]) 354 ])
332 static_libraries['libevent'] = { 355 static_libraries['libevent'] = {
333 'sources': [ 356 'sources': [
334 'base/third_party/libevent/buffer.c', 357 'base/third_party/libevent/buffer.c',
335 'base/third_party/libevent/evbuffer.c', 358 'base/third_party/libevent/evbuffer.c',
336 'base/third_party/libevent/evdns.c', 359 'base/third_party/libevent/evdns.c',
337 'base/third_party/libevent/event.c', 360 'base/third_party/libevent/event.c',
338 'base/third_party/libevent/event_tagging.c', 361 'base/third_party/libevent/event_tagging.c',
339 'base/third_party/libevent/evrpc.c', 362 'base/third_party/libevent/evrpc.c',
340 'base/third_party/libevent/evutil.c', 363 'base/third_party/libevent/evutil.c',
(...skipping 14 matching lines...) Expand all
355 libs.extend(['-lrt']) 378 libs.extend(['-lrt'])
356 ldflags.extend(['-pthread']) 379 ldflags.extend(['-pthread'])
357 380
358 static_libraries['xdg_user_dirs'] = { 381 static_libraries['xdg_user_dirs'] = {
359 'sources': [ 382 'sources': [
360 'base/third_party/xdg_user_dirs/xdg_user_dir_lookup.cc', 383 'base/third_party/xdg_user_dirs/xdg_user_dir_lookup.cc',
361 ], 384 ],
362 'tool': 'cxx', 385 'tool': 'cxx',
363 } 386 }
364 static_libraries['base']['sources'].extend([ 387 static_libraries['base']['sources'].extend([
388 'base/allocator/allocator_shim_default_dispatch_to_glibc.cc',
365 'base/memory/shared_memory_posix.cc', 389 'base/memory/shared_memory_posix.cc',
366 'base/nix/xdg_util.cc', 390 'base/nix/xdg_util.cc',
367 'base/process/internal_linux.cc', 391 'base/process/internal_linux.cc',
368 'base/process/process_handle_linux.cc', 392 'base/process/process_handle_linux.cc',
369 'base/process/process_iterator_linux.cc', 393 'base/process/process_iterator_linux.cc',
370 'base/process/process_linux.cc', 394 'base/process/process_linux.cc',
371 'base/process/process_metrics_linux.cc', 395 'base/process/process_metrics_linux.cc',
372 'base/strings/sys_string_conversions_posix.cc', 396 'base/strings/sys_string_conversions_posix.cc',
373 'base/sys_info_linux.cc', 397 'base/sys_info_linux.cc',
374 'base/threading/platform_thread_linux.cc', 398 'base/threading/platform_thread_linux.cc',
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 cmd.append('-v') 512 cmd.append('-v')
489 cmd.append('gn') 513 cmd.append('gn')
490 check_call(cmd) 514 check_call(cmd)
491 515
492 if not options.debug: 516 if not options.debug:
493 check_call(['strip', os.path.join(build_dir, 'gn')]) 517 check_call(['strip', os.path.join(build_dir, 'gn')])
494 518
495 519
496 if __name__ == '__main__': 520 if __name__ == '__main__':
497 sys.exit(main(sys.argv[1:])) 521 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698