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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 build_gn_with_ninja_manually(tempdir, options): | 117 def build_gn_with_ninja_manually(tempdir, options): |
118 write_ninja(os.path.join(tempdir, 'build.ninja'), options) | 118 root_gen_dir = os.path.join(tempdir, 'gen') |
119 mkdir_p(root_gen_dir) | |
120 | |
121 if is_mac: | |
tfarina
2016/02/18 22:47:54
Wait, why is this only for Mac? It is not included
NGG
2016/02/18 23:31:48
Because build_time.cc is not compiled for non-mac
brettw
2016/02/19 22:13:48
This seems wrong. Why did you add build_time.cc on
NGG
2016/02/20 14:58:44
It's only needed on Mac because //base/memory/shar
| |
122 # //base/build_time.cc needs base/generated_build_date.h, | |
123 # and this file is only included for Mac builds. | |
124 mkdir_p(os.path.join(root_gen_dir, 'base')) | |
125 check_call([ | |
126 os.path.join(SRC_ROOT, 'build', 'write_build_date_header.py'), | |
127 os.path.join(root_gen_dir, 'base', 'generated_build_date.h'), | |
128 'default' | |
129 ]) | |
130 | |
131 write_ninja(os.path.join(tempdir, 'build.ninja'), root_gen_dir, options) | |
119 cmd = ['ninja', '-C', tempdir] | 132 cmd = ['ninja', '-C', tempdir] |
120 if options.verbose: | 133 if options.verbose: |
121 cmd.append('-v') | 134 cmd.append('-v') |
122 cmd.append('gn') | 135 cmd.append('gn') |
123 check_call(cmd) | 136 check_call(cmd) |
124 | 137 |
125 def write_ninja(path, options): | 138 def write_ninja(path, root_gen_dir, options): |
126 cc = os.environ.get('CC', '') | 139 cc = os.environ.get('CC', '') |
127 cxx = os.environ.get('CXX', '') | 140 cxx = os.environ.get('CXX', '') |
128 cflags = os.environ.get('CFLAGS', '').split() | 141 cflags = os.environ.get('CFLAGS', '').split() |
129 cflags_cc = os.environ.get('CXXFLAGS', '').split() | 142 cflags_cc = os.environ.get('CXXFLAGS', '').split() |
130 ld = os.environ.get('LD', cxx) | 143 ld = os.environ.get('LD', cxx) |
131 ldflags = os.environ.get('LDFLAGS', '').split() | 144 ldflags = os.environ.get('LDFLAGS', '').split() |
132 include_dirs = [SRC_ROOT] | 145 include_dirs = [root_gen_dir, SRC_ROOT] |
133 libs = [] | 146 libs = [] |
134 | 147 |
148 # //base/allocator/allocator_extension.cc needs this macro defined, | |
149 # otherwise there would be link errors. | |
150 cflags.extend(['-DNO_TCMALLOC']) | |
151 | |
135 if is_posix: | 152 if is_posix: |
136 if options.debug: | 153 if options.debug: |
137 cflags.extend(['-O0', '-g']) | 154 cflags.extend(['-O0', '-g']) |
138 else: | 155 else: |
139 cflags.extend(['-O2', '-g0']) | 156 cflags.extend(['-O2', '-g0']) |
140 | 157 |
141 cflags.extend(['-D_FILE_OFFSET_BITS=64', '-pthread', '-pipe']) | 158 cflags.extend(['-D_FILE_OFFSET_BITS=64', '-pthread', '-pipe']) |
142 cflags_cc.extend(['-std=c++11', '-Wno-c++11-narrowing']) | 159 cflags_cc.extend(['-std=c++11', '-Wno-c++11-narrowing']) |
143 | 160 |
144 static_libraries = { | 161 static_libraries = { |
(...skipping 27 matching lines...) Expand all Loading... | |
172 'base/debug/alias.cc', | 189 'base/debug/alias.cc', |
173 'base/debug/stack_trace.cc', | 190 'base/debug/stack_trace.cc', |
174 'base/debug/task_annotator.cc', | 191 'base/debug/task_annotator.cc', |
175 'base/environment.cc', | 192 'base/environment.cc', |
176 'base/files/file.cc', | 193 'base/files/file.cc', |
177 'base/files/file_enumerator.cc', | 194 'base/files/file_enumerator.cc', |
178 'base/files/file_path.cc', | 195 'base/files/file_path.cc', |
179 'base/files/file_path_constants.cc', | 196 'base/files/file_path_constants.cc', |
180 'base/files/file_tracing.cc', | 197 'base/files/file_tracing.cc', |
181 'base/files/file_util.cc', | 198 'base/files/file_util.cc', |
199 'base/files/memory_mapped_file.cc', | |
182 'base/files/scoped_file.cc', | 200 'base/files/scoped_file.cc', |
183 'base/hash.cc', | 201 'base/hash.cc', |
184 'base/json/json_parser.cc', | 202 'base/json/json_parser.cc', |
185 'base/json/json_reader.cc', | 203 'base/json/json_reader.cc', |
186 'base/json/json_string_value_serializer.cc', | 204 'base/json/json_string_value_serializer.cc', |
187 'base/json/json_writer.cc', | 205 'base/json/json_writer.cc', |
188 'base/json/string_escape.cc', | 206 'base/json/string_escape.cc', |
189 'base/lazy_instance.cc', | 207 'base/lazy_instance.cc', |
190 'base/location.cc', | 208 'base/location.cc', |
191 'base/logging.cc', | 209 'base/logging.cc', |
192 'base/md5.cc', | 210 'base/md5.cc', |
193 'base/memory/ref_counted.cc', | 211 'base/memory/ref_counted.cc', |
194 'base/memory/ref_counted_memory.cc', | 212 'base/memory/ref_counted_memory.cc', |
195 'base/memory/singleton.cc', | 213 'base/memory/singleton.cc', |
196 'base/memory/weak_ptr.cc', | 214 'base/memory/weak_ptr.cc', |
197 'base/message_loop/incoming_task_queue.cc', | 215 'base/message_loop/incoming_task_queue.cc', |
198 'base/message_loop/message_loop.cc', | 216 'base/message_loop/message_loop.cc', |
199 'base/message_loop/message_loop_task_runner.cc', | 217 'base/message_loop/message_loop_task_runner.cc', |
200 'base/message_loop/message_pump.cc', | 218 'base/message_loop/message_pump.cc', |
201 'base/message_loop/message_pump_default.cc', | 219 'base/message_loop/message_pump_default.cc', |
202 'base/metrics/bucket_ranges.cc', | 220 'base/metrics/bucket_ranges.cc', |
203 'base/metrics/histogram.cc', | 221 'base/metrics/histogram.cc', |
204 'base/metrics/histogram_base.cc', | 222 'base/metrics/histogram_base.cc', |
223 'base/metrics/histogram_persistence.cc', | |
205 'base/metrics/histogram_samples.cc', | 224 'base/metrics/histogram_samples.cc', |
206 'base/metrics/metrics_hashes.cc', | 225 'base/metrics/metrics_hashes.cc', |
226 'base/metrics/persistent_memory_allocator.cc', | |
207 'base/metrics/sample_map.cc', | 227 'base/metrics/sample_map.cc', |
208 'base/metrics/sample_vector.cc', | 228 'base/metrics/sample_vector.cc', |
209 'base/metrics/sparse_histogram.cc', | 229 'base/metrics/sparse_histogram.cc', |
210 'base/metrics/statistics_recorder.cc', | 230 'base/metrics/statistics_recorder.cc', |
211 'base/path_service.cc', | 231 'base/path_service.cc', |
212 'base/pending_task.cc', | 232 'base/pending_task.cc', |
213 'base/pickle.cc', | 233 'base/pickle.cc', |
214 'base/process/kill.cc', | 234 'base/process/kill.cc', |
215 'base/process/process_iterator.cc', | 235 'base/process/process_iterator.cc', |
216 'base/process/process_metrics.cc', | 236 'base/process/process_metrics.cc', |
237 'base/profiler/scoped_profile.cc', | |
238 'base/profiler/scoped_tracker.cc', | |
217 'base/profiler/tracked_time.cc', | 239 'base/profiler/tracked_time.cc', |
218 'base/run_loop.cc', | 240 'base/run_loop.cc', |
219 'base/sequence_checker_impl.cc', | 241 'base/sequence_checker_impl.cc', |
220 'base/sequenced_task_runner.cc', | 242 'base/sequenced_task_runner.cc', |
221 'base/sha1_portable.cc', | 243 'base/sha1_portable.cc', |
222 'base/strings/pattern.cc', | 244 'base/strings/pattern.cc', |
223 'base/strings/string16.cc', | 245 'base/strings/string16.cc', |
224 'base/strings/string_number_conversions.cc', | 246 'base/strings/string_number_conversions.cc', |
225 'base/strings/string_piece.cc', | 247 'base/strings/string_piece.cc', |
226 'base/strings/string_split.cc', | 248 'base/strings/string_split.cc', |
(...skipping 30 matching lines...) Expand all Loading... | |
257 'base/trace_event/heap_profiler_stack_frame_deduplicator.cc', | 279 'base/trace_event/heap_profiler_stack_frame_deduplicator.cc', |
258 'base/trace_event/heap_profiler_type_name_deduplicator.cc', | 280 'base/trace_event/heap_profiler_type_name_deduplicator.cc', |
259 'base/trace_event/memory_allocator_dump.cc', | 281 'base/trace_event/memory_allocator_dump.cc', |
260 'base/trace_event/memory_allocator_dump_guid.cc', | 282 'base/trace_event/memory_allocator_dump_guid.cc', |
261 'base/trace_event/memory_dump_manager.cc', | 283 'base/trace_event/memory_dump_manager.cc', |
262 'base/trace_event/memory_dump_request_args.cc', | 284 'base/trace_event/memory_dump_request_args.cc', |
263 'base/trace_event/memory_dump_session_state.cc', | 285 'base/trace_event/memory_dump_session_state.cc', |
264 'base/trace_event/process_memory_dump.cc', | 286 'base/trace_event/process_memory_dump.cc', |
265 'base/trace_event/process_memory_maps.cc', | 287 'base/trace_event/process_memory_maps.cc', |
266 'base/trace_event/process_memory_totals.cc', | 288 'base/trace_event/process_memory_totals.cc', |
267 'base/trace_event/process_memory_totals_dump_provider.cc', | |
268 'base/trace_event/trace_buffer.cc', | 289 'base/trace_event/trace_buffer.cc', |
269 'base/trace_event/trace_config.cc', | 290 'base/trace_event/trace_config.cc', |
270 'base/trace_event/trace_event_argument.cc', | 291 'base/trace_event/trace_event_argument.cc', |
271 'base/trace_event/trace_event_impl.cc', | 292 'base/trace_event/trace_event_impl.cc', |
272 'base/trace_event/trace_event_memory_overhead.cc', | 293 'base/trace_event/trace_event_memory_overhead.cc', |
273 'base/trace_event/trace_event_synthetic_delay.cc', | 294 'base/trace_event/trace_event_synthetic_delay.cc', |
274 'base/trace_event/trace_log.cc', | 295 'base/trace_event/trace_log.cc', |
275 'base/trace_event/trace_log_constants.cc', | 296 'base/trace_event/trace_log_constants.cc', |
276 'base/trace_event/trace_sampling_thread.cc', | 297 'base/trace_event/trace_sampling_thread.cc', |
277 'base/trace_event/tracing_agent.cc', | 298 'base/trace_event/tracing_agent.cc', |
278 'base/tracked_objects.cc', | 299 'base/tracked_objects.cc', |
279 'base/tracking_info.cc', | 300 'base/tracking_info.cc', |
280 'base/values.cc', | 301 'base/values.cc', |
281 'base/vlog.cc', | 302 'base/vlog.cc', |
282 ]) | 303 ]) |
283 | 304 |
284 if is_posix: | 305 if is_posix: |
285 static_libraries['base']['sources'].extend([ | 306 static_libraries['base']['sources'].extend([ |
286 'base/base_paths_posix.cc', | 307 'base/base_paths_posix.cc', |
287 'base/debug/debugger_posix.cc', | 308 'base/debug/debugger_posix.cc', |
288 'base/debug/stack_trace_posix.cc', | 309 'base/debug/stack_trace_posix.cc', |
289 'base/files/file_enumerator_posix.cc', | 310 'base/files/file_enumerator_posix.cc', |
290 'base/files/file_posix.cc', | 311 'base/files/file_posix.cc', |
291 'base/files/file_util_posix.cc', | 312 'base/files/file_util_posix.cc', |
313 'base/files/memory_mapped_file_posix.cc', | |
292 'base/message_loop/message_pump_libevent.cc', | 314 'base/message_loop/message_pump_libevent.cc', |
293 'base/posix/file_descriptor_shuffle.cc', | 315 'base/posix/file_descriptor_shuffle.cc', |
294 'base/posix/safe_strerror.cc', | 316 'base/posix/safe_strerror.cc', |
295 'base/process/kill_posix.cc', | 317 'base/process/kill_posix.cc', |
296 'base/process/process_handle_posix.cc', | 318 'base/process/process_handle_posix.cc', |
297 'base/process/process_metrics_posix.cc', | 319 'base/process/process_metrics_posix.cc', |
298 'base/process/process_posix.cc', | 320 'base/process/process_posix.cc', |
299 'base/synchronization/condition_variable_posix.cc', | 321 'base/synchronization/condition_variable_posix.cc', |
300 'base/synchronization/lock_impl_posix.cc', | 322 'base/synchronization/lock_impl_posix.cc', |
301 'base/synchronization/waitable_event_posix.cc', | 323 'base/synchronization/waitable_event_posix.cc', |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
333 libs.extend(['-lrt']) | 355 libs.extend(['-lrt']) |
334 ldflags.extend(['-pthread']) | 356 ldflags.extend(['-pthread']) |
335 | 357 |
336 static_libraries['xdg_user_dirs'] = { | 358 static_libraries['xdg_user_dirs'] = { |
337 'sources': [ | 359 'sources': [ |
338 'base/third_party/xdg_user_dirs/xdg_user_dir_lookup.cc', | 360 'base/third_party/xdg_user_dirs/xdg_user_dir_lookup.cc', |
339 ], | 361 ], |
340 'tool': 'cxx', | 362 'tool': 'cxx', |
341 } | 363 } |
342 static_libraries['base']['sources'].extend([ | 364 static_libraries['base']['sources'].extend([ |
365 'base/memory/shared_memory_posix.cc', | |
343 'base/nix/xdg_util.cc', | 366 'base/nix/xdg_util.cc', |
344 'base/process/internal_linux.cc', | 367 'base/process/internal_linux.cc', |
345 'base/process/process_handle_linux.cc', | 368 'base/process/process_handle_linux.cc', |
346 'base/process/process_iterator_linux.cc', | 369 'base/process/process_iterator_linux.cc', |
347 'base/process/process_linux.cc', | 370 'base/process/process_linux.cc', |
348 'base/process/process_metrics_linux.cc', | 371 'base/process/process_metrics_linux.cc', |
349 'base/strings/sys_string_conversions_posix.cc', | 372 'base/strings/sys_string_conversions_posix.cc', |
350 'base/sys_info_linux.cc', | 373 'base/sys_info_linux.cc', |
351 'base/threading/platform_thread_linux.cc', | 374 'base/threading/platform_thread_linux.cc', |
352 'base/trace_event/malloc_dump_provider.cc', | 375 'base/trace_event/malloc_dump_provider.cc', |
353 'base/trace_event/process_memory_maps_dump_provider.cc', | |
354 ]) | 376 ]) |
355 static_libraries['libevent']['include_dirs'].extend([ | 377 static_libraries['libevent']['include_dirs'].extend([ |
356 os.path.join(SRC_ROOT, 'base', 'third_party', 'libevent', 'linux') | 378 os.path.join(SRC_ROOT, 'base', 'third_party', 'libevent', 'linux') |
357 ]) | 379 ]) |
358 static_libraries['libevent']['sources'].extend([ | 380 static_libraries['libevent']['sources'].extend([ |
359 'base/third_party/libevent/epoll.c', | 381 'base/third_party/libevent/epoll.c', |
360 ]) | 382 ]) |
361 | 383 |
362 | 384 |
363 if is_mac: | 385 if is_mac: |
364 static_libraries['base']['sources'].extend([ | 386 static_libraries['base']['sources'].extend([ |
365 'base/base_paths_mac.mm', | 387 'base/base_paths_mac.mm', |
388 'base/build_time.cc', | |
389 'base/rand_util.cc', | |
390 'base/rand_util_posix.cc', | |
366 'base/files/file_util_mac.mm', | 391 'base/files/file_util_mac.mm', |
367 'base/mac/bundle_locations.mm', | 392 'base/mac/bundle_locations.mm', |
368 'base/mac/call_with_eh_frame.cc', | 393 'base/mac/call_with_eh_frame.cc', |
369 'base/mac/call_with_eh_frame_asm.S', | 394 'base/mac/call_with_eh_frame_asm.S', |
370 'base/mac/foundation_util.mm', | 395 'base/mac/foundation_util.mm', |
371 'base/mac/mach_logging.cc', | 396 'base/mac/mach_logging.cc', |
372 'base/mac/scoped_mach_port.cc', | 397 'base/mac/scoped_mach_port.cc', |
398 'base/mac/scoped_mach_vm.cc', | |
373 'base/mac/scoped_nsautorelease_pool.mm', | 399 'base/mac/scoped_nsautorelease_pool.mm', |
400 'base/memory/shared_memory_handle_mac.cc', | |
401 'base/memory/shared_memory_mac.cc', | |
374 'base/message_loop/message_pump_mac.mm', | 402 'base/message_loop/message_pump_mac.mm', |
403 'base/metrics/field_trial.cc', | |
375 'base/process/process_handle_mac.cc', | 404 'base/process/process_handle_mac.cc', |
376 'base/process/process_iterator_mac.cc', | 405 'base/process/process_iterator_mac.cc', |
377 'base/process/process_metrics_mac.cc', | 406 'base/process/process_metrics_mac.cc', |
378 'base/strings/sys_string_conversions_mac.mm', | 407 'base/strings/sys_string_conversions_mac.mm', |
379 'base/time/time_mac.cc', | 408 'base/time/time_mac.cc', |
380 'base/threading/platform_thread_mac.mm', | 409 'base/threading/platform_thread_mac.mm', |
381 'base/trace_event/malloc_dump_provider.cc', | 410 'base/trace_event/malloc_dump_provider.cc', |
382 ]) | 411 ]) |
383 static_libraries['libevent']['include_dirs'].extend([ | 412 static_libraries['libevent']['include_dirs'].extend([ |
384 os.path.join(SRC_ROOT, 'base', 'third_party', 'libevent', 'mac') | 413 os.path.join(SRC_ROOT, 'base', 'third_party', 'libevent', 'mac') |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
459 cmd.append('-v') | 488 cmd.append('-v') |
460 cmd.append('gn') | 489 cmd.append('gn') |
461 check_call(cmd) | 490 check_call(cmd) |
462 | 491 |
463 if not options.debug: | 492 if not options.debug: |
464 check_call(['strip', os.path.join(build_dir, 'gn')]) | 493 check_call(['strip', os.path.join(build_dir, 'gn')]) |
465 | 494 |
466 | 495 |
467 if __name__ == '__main__': | 496 if __name__ == '__main__': |
468 sys.exit(main(sys.argv[1:])) | 497 sys.exit(main(sys.argv[1:])) |
OLD | NEW |