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

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

Issue 1692303004: Update GN bootstrap build (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add description to generated_build_date.h Created 4 years, 10 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
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.
11 11
12 """Bootstraps gn. 12 """Bootstraps gn.
13 13
14 It is done by first building it manually in a temporary directory, then building 14 It is done by first building it manually in a temporary directory, then building
15 it with its own BUILD.gn to the final destination. 15 it with its own BUILD.gn to the final destination.
16 """ 16 """
17 17
18 import contextlib 18 import contextlib
19 import datetime
19 import errno 20 import errno
21 import locale
20 import logging 22 import logging
21 import optparse 23 import optparse
22 import os 24 import os
23 import shutil 25 import shutil
24 import subprocess 26 import subprocess
25 import sys 27 import sys
26 import tempfile 28 import tempfile
27 29
28 BOOTSTRAP_DIR = os.path.dirname(os.path.abspath(__file__)) 30 BOOTSTRAP_DIR = os.path.dirname(os.path.abspath(__file__))
29 GN_ROOT = os.path.dirname(BOOTSTRAP_DIR) 31 GN_ROOT = os.path.dirname(BOOTSTRAP_DIR)
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 cmd.append('gn') 124 cmd.append('gn')
123 check_call(cmd) 125 check_call(cmd)
124 126
125 def write_ninja(path, options): 127 def write_ninja(path, options):
126 cc = os.environ.get('CC', '') 128 cc = os.environ.get('CC', '')
127 cxx = os.environ.get('CXX', '') 129 cxx = os.environ.get('CXX', '')
128 cflags = os.environ.get('CFLAGS', '').split() 130 cflags = os.environ.get('CFLAGS', '').split()
129 cflags_cc = os.environ.get('CXXFLAGS', '').split() 131 cflags_cc = os.environ.get('CXXFLAGS', '').split()
130 ld = os.environ.get('LD', cxx) 132 ld = os.environ.get('LD', cxx)
131 ldflags = os.environ.get('LDFLAGS', '').split() 133 ldflags = os.environ.get('LDFLAGS', '').split()
132 include_dirs = [SRC_ROOT] 134 include_dirs = [BOOTSTRAP_DIR, SRC_ROOT]
133 libs = [] 135 libs = []
134 136
137 cflags.extend(['-DNO_TCMALLOC'])
138
135 if is_posix: 139 if is_posix:
136 if options.debug: 140 if options.debug:
137 cflags.extend(['-O0', '-g']) 141 cflags.extend(['-O0', '-g'])
138 else: 142 else:
139 cflags.extend(['-O2', '-g0']) 143 cflags.extend(['-O2', '-g0'])
140 144
141 cflags.extend(['-D_FILE_OFFSET_BITS=64', '-pthread', '-pipe']) 145 cflags.extend(['-D_FILE_OFFSET_BITS=64', '-pthread', '-pipe'])
142 cflags_cc.extend(['-std=c++11', '-Wno-c++11-narrowing']) 146 cflags_cc.extend(['-std=c++11', '-Wno-c++11-narrowing'])
143 147
148 if is_mac:
149 # base/build_time.cc needs this to be defined
150 # it must be in the format "Mmm DD YYYY" (e.g "Feb 13 2016")
151 # strftime() is influenced by the current locale
152 locale.setlocale(locale.LC_TIME, 'en_US')
153 build_date = datetime.datetime.now().strftime('%b %d %Y')
154 cflags.extend(['-DBUILD_DATE="\\"' + build_date + '\\""'])
155
144 static_libraries = { 156 static_libraries = {
145 'base': {'sources': [], 'tool': 'cxx'}, 157 'base': {'sources': [], 'tool': 'cxx'},
146 'dynamic_annotations': {'sources': [], 'tool': 'cc'}, 158 'dynamic_annotations': {'sources': [], 'tool': 'cc'},
147 'gn': {'sources': [], 'tool': 'cxx'}, 159 'gn': {'sources': [], 'tool': 'cxx'},
148 } 160 }
149 161
150 for name in os.listdir(GN_ROOT): 162 for name in os.listdir(GN_ROOT):
151 if not name.endswith('.cc'): 163 if not name.endswith('.cc'):
152 continue 164 continue
153 if name.endswith('_unittest.cc'): 165 if name.endswith('_unittest.cc'):
(...skipping 18 matching lines...) Expand all
172 'base/debug/alias.cc', 184 'base/debug/alias.cc',
173 'base/debug/stack_trace.cc', 185 'base/debug/stack_trace.cc',
174 'base/debug/task_annotator.cc', 186 'base/debug/task_annotator.cc',
175 'base/environment.cc', 187 'base/environment.cc',
176 'base/files/file.cc', 188 'base/files/file.cc',
177 'base/files/file_enumerator.cc', 189 'base/files/file_enumerator.cc',
178 'base/files/file_path.cc', 190 'base/files/file_path.cc',
179 'base/files/file_path_constants.cc', 191 'base/files/file_path_constants.cc',
180 'base/files/file_tracing.cc', 192 'base/files/file_tracing.cc',
181 'base/files/file_util.cc', 193 'base/files/file_util.cc',
194 'base/files/memory_mapped_file.cc',
182 'base/files/scoped_file.cc', 195 'base/files/scoped_file.cc',
183 'base/hash.cc', 196 'base/hash.cc',
184 'base/json/json_parser.cc', 197 'base/json/json_parser.cc',
185 'base/json/json_reader.cc', 198 'base/json/json_reader.cc',
186 'base/json/json_string_value_serializer.cc', 199 'base/json/json_string_value_serializer.cc',
187 'base/json/json_writer.cc', 200 'base/json/json_writer.cc',
188 'base/json/string_escape.cc', 201 'base/json/string_escape.cc',
189 'base/lazy_instance.cc', 202 'base/lazy_instance.cc',
190 'base/location.cc', 203 'base/location.cc',
191 'base/logging.cc', 204 'base/logging.cc',
192 'base/md5.cc', 205 'base/md5.cc',
193 'base/memory/ref_counted.cc', 206 'base/memory/ref_counted.cc',
194 'base/memory/ref_counted_memory.cc', 207 'base/memory/ref_counted_memory.cc',
195 'base/memory/singleton.cc', 208 'base/memory/singleton.cc',
196 'base/memory/weak_ptr.cc', 209 'base/memory/weak_ptr.cc',
197 'base/message_loop/incoming_task_queue.cc', 210 'base/message_loop/incoming_task_queue.cc',
198 'base/message_loop/message_loop.cc', 211 'base/message_loop/message_loop.cc',
199 'base/message_loop/message_loop_task_runner.cc', 212 'base/message_loop/message_loop_task_runner.cc',
200 'base/message_loop/message_pump.cc', 213 'base/message_loop/message_pump.cc',
201 'base/message_loop/message_pump_default.cc', 214 'base/message_loop/message_pump_default.cc',
202 'base/metrics/bucket_ranges.cc', 215 'base/metrics/bucket_ranges.cc',
203 'base/metrics/histogram.cc', 216 'base/metrics/histogram.cc',
204 'base/metrics/histogram_base.cc', 217 'base/metrics/histogram_base.cc',
218 'base/metrics/histogram_persistence.cc',
205 'base/metrics/histogram_samples.cc', 219 'base/metrics/histogram_samples.cc',
206 'base/metrics/metrics_hashes.cc', 220 'base/metrics/metrics_hashes.cc',
221 'base/metrics/persistent_memory_allocator.cc',
207 'base/metrics/sample_map.cc', 222 'base/metrics/sample_map.cc',
208 'base/metrics/sample_vector.cc', 223 'base/metrics/sample_vector.cc',
209 'base/metrics/sparse_histogram.cc', 224 'base/metrics/sparse_histogram.cc',
210 'base/metrics/statistics_recorder.cc', 225 'base/metrics/statistics_recorder.cc',
211 'base/path_service.cc', 226 'base/path_service.cc',
212 'base/pending_task.cc', 227 'base/pending_task.cc',
213 'base/pickle.cc', 228 'base/pickle.cc',
214 'base/process/kill.cc', 229 'base/process/kill.cc',
215 'base/process/process_iterator.cc', 230 'base/process/process_iterator.cc',
216 'base/process/process_metrics.cc', 231 'base/process/process_metrics.cc',
232 'base/profiler/scoped_profile.cc',
233 'base/profiler/scoped_tracker.cc',
217 'base/profiler/tracked_time.cc', 234 'base/profiler/tracked_time.cc',
218 'base/run_loop.cc', 235 'base/run_loop.cc',
219 'base/sequence_checker_impl.cc', 236 'base/sequence_checker_impl.cc',
220 'base/sequenced_task_runner.cc', 237 'base/sequenced_task_runner.cc',
221 'base/sha1_portable.cc', 238 'base/sha1_portable.cc',
222 'base/strings/pattern.cc', 239 'base/strings/pattern.cc',
223 'base/strings/string16.cc', 240 'base/strings/string16.cc',
224 'base/strings/string_number_conversions.cc', 241 'base/strings/string_number_conversions.cc',
225 'base/strings/string_piece.cc', 242 'base/strings/string_piece.cc',
226 'base/strings/string_split.cc', 243 'base/strings/string_split.cc',
(...skipping 30 matching lines...) Expand all
257 'base/trace_event/heap_profiler_stack_frame_deduplicator.cc', 274 'base/trace_event/heap_profiler_stack_frame_deduplicator.cc',
258 'base/trace_event/heap_profiler_type_name_deduplicator.cc', 275 'base/trace_event/heap_profiler_type_name_deduplicator.cc',
259 'base/trace_event/memory_allocator_dump.cc', 276 'base/trace_event/memory_allocator_dump.cc',
260 'base/trace_event/memory_allocator_dump_guid.cc', 277 'base/trace_event/memory_allocator_dump_guid.cc',
261 'base/trace_event/memory_dump_manager.cc', 278 'base/trace_event/memory_dump_manager.cc',
262 'base/trace_event/memory_dump_request_args.cc', 279 'base/trace_event/memory_dump_request_args.cc',
263 'base/trace_event/memory_dump_session_state.cc', 280 'base/trace_event/memory_dump_session_state.cc',
264 'base/trace_event/process_memory_dump.cc', 281 'base/trace_event/process_memory_dump.cc',
265 'base/trace_event/process_memory_maps.cc', 282 'base/trace_event/process_memory_maps.cc',
266 'base/trace_event/process_memory_totals.cc', 283 'base/trace_event/process_memory_totals.cc',
267 'base/trace_event/process_memory_totals_dump_provider.cc',
268 'base/trace_event/trace_buffer.cc', 284 'base/trace_event/trace_buffer.cc',
269 'base/trace_event/trace_config.cc', 285 'base/trace_event/trace_config.cc',
270 'base/trace_event/trace_event_argument.cc', 286 'base/trace_event/trace_event_argument.cc',
271 'base/trace_event/trace_event_impl.cc', 287 'base/trace_event/trace_event_impl.cc',
272 'base/trace_event/trace_event_memory_overhead.cc', 288 'base/trace_event/trace_event_memory_overhead.cc',
273 'base/trace_event/trace_event_synthetic_delay.cc', 289 'base/trace_event/trace_event_synthetic_delay.cc',
274 'base/trace_event/trace_log.cc', 290 'base/trace_event/trace_log.cc',
275 'base/trace_event/trace_log_constants.cc', 291 'base/trace_event/trace_log_constants.cc',
276 'base/trace_event/trace_sampling_thread.cc', 292 'base/trace_event/trace_sampling_thread.cc',
277 'base/trace_event/tracing_agent.cc', 293 'base/trace_event/tracing_agent.cc',
278 'base/tracked_objects.cc', 294 'base/tracked_objects.cc',
279 'base/tracking_info.cc', 295 'base/tracking_info.cc',
280 'base/values.cc', 296 'base/values.cc',
281 'base/vlog.cc', 297 'base/vlog.cc',
282 ]) 298 ])
283 299
284 if is_posix: 300 if is_posix:
285 static_libraries['base']['sources'].extend([ 301 static_libraries['base']['sources'].extend([
286 'base/base_paths_posix.cc', 302 'base/base_paths_posix.cc',
287 'base/debug/debugger_posix.cc', 303 'base/debug/debugger_posix.cc',
288 'base/debug/stack_trace_posix.cc', 304 'base/debug/stack_trace_posix.cc',
289 'base/files/file_enumerator_posix.cc', 305 'base/files/file_enumerator_posix.cc',
290 'base/files/file_posix.cc', 306 'base/files/file_posix.cc',
291 'base/files/file_util_posix.cc', 307 'base/files/file_util_posix.cc',
308 'base/files/memory_mapped_file_posix.cc',
292 'base/message_loop/message_pump_libevent.cc', 309 'base/message_loop/message_pump_libevent.cc',
293 'base/posix/file_descriptor_shuffle.cc', 310 'base/posix/file_descriptor_shuffle.cc',
294 'base/posix/safe_strerror.cc', 311 'base/posix/safe_strerror.cc',
295 'base/process/kill_posix.cc', 312 'base/process/kill_posix.cc',
296 'base/process/process_handle_posix.cc', 313 'base/process/process_handle_posix.cc',
297 'base/process/process_metrics_posix.cc', 314 'base/process/process_metrics_posix.cc',
298 'base/process/process_posix.cc', 315 'base/process/process_posix.cc',
299 'base/synchronization/condition_variable_posix.cc', 316 'base/synchronization/condition_variable_posix.cc',
300 'base/synchronization/lock_impl_posix.cc', 317 'base/synchronization/lock_impl_posix.cc',
301 'base/synchronization/waitable_event_posix.cc', 318 'base/synchronization/waitable_event_posix.cc',
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 libs.extend(['-lrt']) 350 libs.extend(['-lrt'])
334 ldflags.extend(['-pthread']) 351 ldflags.extend(['-pthread'])
335 352
336 static_libraries['xdg_user_dirs'] = { 353 static_libraries['xdg_user_dirs'] = {
337 'sources': [ 354 'sources': [
338 'base/third_party/xdg_user_dirs/xdg_user_dir_lookup.cc', 355 'base/third_party/xdg_user_dirs/xdg_user_dir_lookup.cc',
339 ], 356 ],
340 'tool': 'cxx', 357 'tool': 'cxx',
341 } 358 }
342 static_libraries['base']['sources'].extend([ 359 static_libraries['base']['sources'].extend([
360 'base/memory/shared_memory_posix.cc',
343 'base/nix/xdg_util.cc', 361 'base/nix/xdg_util.cc',
344 'base/process/internal_linux.cc', 362 'base/process/internal_linux.cc',
345 'base/process/process_handle_linux.cc', 363 'base/process/process_handle_linux.cc',
346 'base/process/process_iterator_linux.cc', 364 'base/process/process_iterator_linux.cc',
347 'base/process/process_linux.cc', 365 'base/process/process_linux.cc',
348 'base/process/process_metrics_linux.cc', 366 'base/process/process_metrics_linux.cc',
349 'base/strings/sys_string_conversions_posix.cc', 367 'base/strings/sys_string_conversions_posix.cc',
350 'base/sys_info_linux.cc', 368 'base/sys_info_linux.cc',
351 'base/threading/platform_thread_linux.cc', 369 'base/threading/platform_thread_linux.cc',
352 'base/trace_event/malloc_dump_provider.cc', 370 'base/trace_event/malloc_dump_provider.cc',
353 'base/trace_event/process_memory_maps_dump_provider.cc',
354 ]) 371 ])
355 static_libraries['libevent']['include_dirs'].extend([ 372 static_libraries['libevent']['include_dirs'].extend([
356 os.path.join(SRC_ROOT, 'base', 'third_party', 'libevent', 'linux') 373 os.path.join(SRC_ROOT, 'base', 'third_party', 'libevent', 'linux')
357 ]) 374 ])
358 static_libraries['libevent']['sources'].extend([ 375 static_libraries['libevent']['sources'].extend([
359 'base/third_party/libevent/epoll.c', 376 'base/third_party/libevent/epoll.c',
360 ]) 377 ])
361 378
362 379
363 if is_mac: 380 if is_mac:
364 static_libraries['base']['sources'].extend([ 381 static_libraries['base']['sources'].extend([
365 'base/base_paths_mac.mm', 382 'base/base_paths_mac.mm',
383 'base/build_time.cc',
384 'base/rand_util.cc',
385 'base/rand_util_posix.cc',
366 'base/files/file_util_mac.mm', 386 'base/files/file_util_mac.mm',
367 'base/mac/bundle_locations.mm', 387 'base/mac/bundle_locations.mm',
368 'base/mac/call_with_eh_frame.cc', 388 'base/mac/call_with_eh_frame.cc',
369 'base/mac/call_with_eh_frame_asm.S', 389 'base/mac/call_with_eh_frame_asm.S',
370 'base/mac/foundation_util.mm', 390 'base/mac/foundation_util.mm',
371 'base/mac/mach_logging.cc', 391 'base/mac/mach_logging.cc',
372 'base/mac/scoped_mach_port.cc', 392 'base/mac/scoped_mach_port.cc',
393 'base/mac/scoped_mach_vm.cc',
373 'base/mac/scoped_nsautorelease_pool.mm', 394 'base/mac/scoped_nsautorelease_pool.mm',
395 'base/memory/shared_memory_handle_mac.cc',
396 'base/memory/shared_memory_mac.cc',
374 'base/message_loop/message_pump_mac.mm', 397 'base/message_loop/message_pump_mac.mm',
398 'base/metrics/field_trial.cc',
375 'base/process/process_handle_mac.cc', 399 'base/process/process_handle_mac.cc',
376 'base/process/process_iterator_mac.cc', 400 'base/process/process_iterator_mac.cc',
377 'base/process/process_metrics_mac.cc', 401 'base/process/process_metrics_mac.cc',
378 'base/strings/sys_string_conversions_mac.mm', 402 'base/strings/sys_string_conversions_mac.mm',
379 'base/time/time_mac.cc', 403 'base/time/time_mac.cc',
380 'base/threading/platform_thread_mac.mm', 404 'base/threading/platform_thread_mac.mm',
381 'base/trace_event/malloc_dump_provider.cc', 405 'base/trace_event/malloc_dump_provider.cc',
382 ]) 406 ])
383 static_libraries['libevent']['include_dirs'].extend([ 407 static_libraries['libevent']['include_dirs'].extend([
384 os.path.join(SRC_ROOT, 'base', 'third_party', 'libevent', 'mac') 408 os.path.join(SRC_ROOT, 'base', 'third_party', 'libevent', 'mac')
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 cmd.append('-v') 483 cmd.append('-v')
460 cmd.append('gn') 484 cmd.append('gn')
461 check_call(cmd) 485 check_call(cmd)
462 486
463 if not options.debug: 487 if not options.debug:
464 check_call(['strip', os.path.join(build_dir, 'gn')]) 488 check_call(['strip', os.path.join(build_dir, 'gn')])
465 489
466 490
467 if __name__ == '__main__': 491 if __name__ == '__main__':
468 sys.exit(main(sys.argv[1:])) 492 sys.exit(main(sys.argv[1:]))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698