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

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

Issue 2807463004: GN: aix port along with linux_s390x, linux_ppc64 and linux_ppc64le support. (Closed)
Patch Set: removed the changes from //base/BUILD.gn Created 3 years, 7 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 | « tools/gn/args.cc ('k') | tools/gn/bootstrap/build_aix.ninja.template » ('j') | 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 14 matching lines...) Expand all
25 import sys 25 import sys
26 import tempfile 26 import tempfile
27 27
28 BOOTSTRAP_DIR = os.path.dirname(os.path.abspath(__file__)) 28 BOOTSTRAP_DIR = os.path.dirname(os.path.abspath(__file__))
29 GN_ROOT = os.path.dirname(BOOTSTRAP_DIR) 29 GN_ROOT = os.path.dirname(BOOTSTRAP_DIR)
30 SRC_ROOT = os.path.dirname(os.path.dirname(GN_ROOT)) 30 SRC_ROOT = os.path.dirname(os.path.dirname(GN_ROOT))
31 31
32 is_win = sys.platform.startswith('win') 32 is_win = sys.platform.startswith('win')
33 is_linux = sys.platform.startswith('linux') 33 is_linux = sys.platform.startswith('linux')
34 is_mac = sys.platform.startswith('darwin') 34 is_mac = sys.platform.startswith('darwin')
35 is_posix = is_linux or is_mac 35 is_aix = sys.platform.startswith('aix')
36 is_posix = is_linux or is_mac or is_aix
36 37
37 def check_call(cmd, **kwargs): 38 def check_call(cmd, **kwargs):
38 logging.debug('Running: %s', ' '.join(cmd)) 39 logging.debug('Running: %s', ' '.join(cmd))
39 40
40 # With shell=False, subprocess expects an executable on Windows 41 # With shell=False, subprocess expects an executable on Windows
41 if is_win and cmd and cmd[0].endswith('.py'): 42 if is_win and cmd and cmd[0].endswith('.py'):
42 cmd.insert(0, sys.executable) 43 cmd.insert(0, sys.executable)
43 44
44 subprocess.check_call(cmd, cwd=GN_ROOT, **kwargs) 45 subprocess.check_call(cmd, cwd=GN_ROOT, **kwargs)
45 46
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 'cxx = ' + cxx, 217 'cxx = ' + cxx,
217 'ar = ' + ar, 218 'ar = ' + ar,
218 'ld = ' + ld, 219 'ld = ' + ld,
219 '', 220 '',
220 ] 221 ]
221 222
222 if is_win: 223 if is_win:
223 template_filename = 'build_vs.ninja.template' 224 template_filename = 'build_vs.ninja.template'
224 elif is_mac: 225 elif is_mac:
225 template_filename = 'build_mac.ninja.template' 226 template_filename = 'build_mac.ninja.template'
227 elif is_aix:
228 template_filename = 'build_aix.ninja.template'
226 else: 229 else:
227 template_filename = 'build.ninja.template' 230 template_filename = 'build.ninja.template'
228 231
229 with open(os.path.join(GN_ROOT, 'bootstrap', template_filename)) as f: 232 with open(os.path.join(GN_ROOT, 'bootstrap', template_filename)) as f:
230 ninja_template = f.read() 233 ninja_template = f.read()
231 234
232 if is_win: 235 if is_win:
233 executable_ext = '.exe' 236 executable_ext = '.exe'
234 library_ext = '.lib' 237 library_ext = '.lib'
235 object_ext = '.obj' 238 object_ext = '.obj'
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 f.write('\n'.join(ninja_header_lines)) 294 f.write('\n'.join(ninja_header_lines))
292 f.write(ninja_template) 295 f.write(ninja_template)
293 f.write('\n'.join(ninja_lines)) 296 f.write('\n'.join(ninja_lines))
294 297
295 def write_gn_ninja(path, root_gen_dir, options): 298 def write_gn_ninja(path, root_gen_dir, options):
296 if is_win: 299 if is_win:
297 cc = os.environ.get('CC', 'cl.exe') 300 cc = os.environ.get('CC', 'cl.exe')
298 cxx = os.environ.get('CXX', 'cl.exe') 301 cxx = os.environ.get('CXX', 'cl.exe')
299 ld = os.environ.get('LD', 'link.exe') 302 ld = os.environ.get('LD', 'link.exe')
300 ar = os.environ.get('AR', 'lib.exe') 303 ar = os.environ.get('AR', 'lib.exe')
304 elif is_aix:
305 cc = os.environ.get('CC', 'gcc')
306 cxx = os.environ.get('CXX', 'c++')
307 ld = os.environ.get('LD', cxx)
308 ar = os.environ.get('AR', 'ar -X64')
301 else: 309 else:
302 cc = os.environ.get('CC', 'cc') 310 cc = os.environ.get('CC', 'cc')
303 cxx = os.environ.get('CXX', 'c++') 311 cxx = os.environ.get('CXX', 'c++')
304 ld = cxx 312 ld = cxx
305 ar = os.environ.get('AR', 'ar') 313 ar = os.environ.get('AR', 'ar')
306 314
307 cflags = os.environ.get('CFLAGS', '').split() 315 cflags = os.environ.get('CFLAGS', '').split()
308 cflags_cc = os.environ.get('CXXFLAGS', '').split() 316 cflags_cc = os.environ.get('CXXFLAGS', '').split()
309 ldflags = os.environ.get('LDFLAGS', '').split() 317 ldflags = os.environ.get('LDFLAGS', '').split()
310 include_dirs = [root_gen_dir, SRC_ROOT] 318 include_dirs = [root_gen_dir, SRC_ROOT]
311 libs = [] 319 libs = []
312 320
313 # //base/allocator/allocator_extension.cc needs this macro defined, 321 # //base/allocator/allocator_extension.cc needs this macro defined,
314 # otherwise there would be link errors. 322 # otherwise there would be link errors.
315 cflags.extend(['-DNO_TCMALLOC', '-D__STDC_FORMAT_MACROS']) 323 cflags.extend(['-DNO_TCMALLOC', '-D__STDC_FORMAT_MACROS'])
316 324
317 if is_posix: 325 if is_posix:
318 if options.debug: 326 if options.debug:
319 cflags.extend(['-O0', '-g']) 327 cflags.extend(['-O0', '-g'])
320 else: 328 else:
329 # The linux::ppc64 BE binary doesn't "work" when
330 # optimization level is set to 2 (0 works fine).
331 # Note that the current bootstrap script has no way to detect host_cpu.
332 # This can be easily fixed once we start building using a GN binary,
333 # as the optimization flag can then just be set using the
334 # logic inside //build/toolchain.
321 cflags.extend(['-O2', '-g0']) 335 cflags.extend(['-O2', '-g0'])
322 336
323 cflags.extend([ 337 cflags.extend([
324 '-D_FILE_OFFSET_BITS=64', 338 '-D_FILE_OFFSET_BITS=64',
325 '-D__STDC_CONSTANT_MACROS', '-D__STDC_FORMAT_MACROS', 339 '-D__STDC_CONSTANT_MACROS', '-D__STDC_FORMAT_MACROS',
326 '-pthread', 340 '-pthread',
327 '-pipe', 341 '-pipe',
328 '-fno-exceptions' 342 '-fno-exceptions'
329 ]) 343 ])
330 cflags_cc.extend(['-std=c++11', '-Wno-c++11-narrowing']) 344 cflags_cc.extend(['-std=c++11', '-Wno-c++11-narrowing'])
345 if is_aix:
346 cflags.extend(['-maix64'])
347 ldflags.extend([ '-maix64 -Wl,-bbigtoc' ])
331 elif is_win: 348 elif is_win:
332 if not options.debug: 349 if not options.debug:
333 cflags.extend(['/Ox', '/DNDEBUG', '/GL']) 350 cflags.extend(['/Ox', '/DNDEBUG', '/GL'])
334 ldflags.extend(['/LTCG', '/OPT:REF', '/OPT:ICF']) 351 ldflags.extend(['/LTCG', '/OPT:REF', '/OPT:ICF'])
335 352
336 cflags.extend([ 353 cflags.extend([
337 '/FS', 354 '/FS',
338 '/Gy', 355 '/Gy',
339 '/W3', '/wd4244', 356 '/W3', '/wd4244',
340 '/Zi', 357 '/Zi',
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 'base/threading/sequenced_worker_pool.cc', 513 'base/threading/sequenced_worker_pool.cc',
497 'base/threading/simple_thread.cc', 514 'base/threading/simple_thread.cc',
498 'base/threading/thread.cc', 515 'base/threading/thread.cc',
499 'base/threading/thread_checker_impl.cc', 516 'base/threading/thread_checker_impl.cc',
500 'base/threading/thread_collision_warner.cc', 517 'base/threading/thread_collision_warner.cc',
501 'base/threading/thread_id_name_manager.cc', 518 'base/threading/thread_id_name_manager.cc',
502 'base/threading/thread_local_storage.cc', 519 'base/threading/thread_local_storage.cc',
503 'base/threading/thread_restrictions.cc', 520 'base/threading/thread_restrictions.cc',
504 'base/threading/thread_task_runner_handle.cc', 521 'base/threading/thread_task_runner_handle.cc',
505 'base/threading/worker_pool.cc', 522 'base/threading/worker_pool.cc',
523 'base/time/clock.cc',
524 'base/time/default_clock.cc',
525 'base/time/default_tick_clock.cc',
526 'base/time/tick_clock.cc',
506 'base/time/time.cc', 527 'base/time/time.cc',
507 'base/timer/elapsed_timer.cc', 528 'base/timer/elapsed_timer.cc',
508 'base/timer/timer.cc', 529 'base/timer/timer.cc',
509 'base/trace_event/category_registry.cc', 530 'base/trace_event/category_registry.cc',
510 'base/trace_event/event_name_filter.cc', 531 'base/trace_event/event_name_filter.cc',
511 'base/trace_event/heap_profiler_allocation_context.cc', 532 'base/trace_event/heap_profiler_allocation_context.cc',
512 'base/trace_event/heap_profiler_allocation_context_tracker.cc', 533 'base/trace_event/heap_profiler_allocation_context_tracker.cc',
513 'base/trace_event/heap_profiler_allocation_register.cc', 534 'base/trace_event/heap_profiler_allocation_register.cc',
514 'base/trace_event/heap_profiler_event_filter.cc', 535 'base/trace_event/heap_profiler_event_filter.cc',
515 'base/trace_event/heap_profiler_heap_dump_writer.cc', 536 'base/trace_event/heap_profiler_heap_dump_writer.cc',
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 'base/third_party/libevent/poll.c', 611 'base/third_party/libevent/poll.c',
591 'base/third_party/libevent/select.c', 612 'base/third_party/libevent/select.c',
592 'base/third_party/libevent/signal.c', 613 'base/third_party/libevent/signal.c',
593 'base/third_party/libevent/strlcpy.c', 614 'base/third_party/libevent/strlcpy.c',
594 ], 615 ],
595 'tool': 'cc', 616 'tool': 'cc',
596 'include_dirs': [], 617 'include_dirs': [],
597 'cflags': cflags + ['-DHAVE_CONFIG_H'], 618 'cflags': cflags + ['-DHAVE_CONFIG_H'],
598 } 619 }
599 620
600 if is_linux: 621 if is_linux or is_aix:
601 libs.extend(['-lrt', '-latomic'])
602 ldflags.extend(['-pthread']) 622 ldflags.extend(['-pthread'])
603 623
604 static_libraries['xdg_user_dirs'] = { 624 static_libraries['xdg_user_dirs'] = {
605 'sources': [ 625 'sources': [
606 'base/third_party/xdg_user_dirs/xdg_user_dir_lookup.cc', 626 'base/third_party/xdg_user_dirs/xdg_user_dir_lookup.cc',
607 ], 627 ],
608 'tool': 'cxx', 628 'tool': 'cxx',
609 } 629 }
610 static_libraries['base']['sources'].extend([ 630 static_libraries['base']['sources'].extend([
611 'base/allocator/allocator_shim.cc',
612 'base/allocator/allocator_shim_default_dispatch_to_glibc.cc',
613 'base/memory/shared_memory_posix.cc', 631 'base/memory/shared_memory_posix.cc',
614 'base/memory/shared_memory_tracker.cc', 632 'base/memory/shared_memory_tracker.cc',
615 'base/nix/xdg_util.cc', 633 'base/nix/xdg_util.cc',
616 'base/process/internal_linux.cc', 634 'base/process/internal_linux.cc',
617 'base/process/memory_linux.cc', 635 'base/process/memory_linux.cc',
618 'base/process/process_handle_linux.cc', 636 'base/process/process_handle_linux.cc',
619 'base/process/process_info_linux.cc', 637 'base/process/process_info_linux.cc',
620 'base/process/process_iterator_linux.cc', 638 'base/process/process_iterator_linux.cc',
621 'base/process/process_linux.cc', 639 'base/process/process_linux.cc',
622 'base/process/process_metrics_linux.cc', 640 'base/process/process_metrics_linux.cc',
623 'base/strings/sys_string_conversions_posix.cc', 641 'base/strings/sys_string_conversions_posix.cc',
624 'base/sys_info_linux.cc', 642 'base/sys_info_linux.cc',
625 'base/threading/platform_thread_linux.cc', 643 'base/threading/platform_thread_linux.cc',
626 'base/trace_event/malloc_dump_provider.cc', 644 'base/trace_event/malloc_dump_provider.cc',
627 ]) 645 ])
628 static_libraries['libevent']['include_dirs'].extend([ 646 if is_linux:
629 os.path.join(SRC_ROOT, 'base', 'third_party', 'libevent', 'linux') 647 static_libraries['base']['sources'].extend([
630 ]) 648 'base/allocator/allocator_shim.cc',
631 static_libraries['libevent']['sources'].extend([ 649 'base/allocator/allocator_shim_default_dispatch_to_glibc.cc',
632 'base/third_party/libevent/epoll.c', 650 ])
633 ]) 651 libs.extend(['-lrt', '-latomic'])
634 652 static_libraries['libevent']['include_dirs'].extend([
653 os.path.join(SRC_ROOT, 'base', 'third_party', 'libevent', 'linux')
654 ])
655 static_libraries['libevent']['sources'].extend([
656 'base/third_party/libevent/epoll.c',
657 ])
658 else:
659 libs.extend(['-lrt'])
660 static_libraries['base']['sources'].extend([
661 'base/process/internal_aix.cc'
662 ])
663 static_libraries['libevent']['include_dirs'].extend([
664 os.path.join(SRC_ROOT, 'base', 'third_party', 'libevent', 'aix')
665 ])
666 static_libraries['libevent']['include_dirs'].extend([
667 os.path.join(SRC_ROOT, 'base', 'third_party', 'libevent', 'compat')
668 ])
635 669
636 if is_mac: 670 if is_mac:
637 static_libraries['base']['sources'].extend([ 671 static_libraries['base']['sources'].extend([
638 'base/base_paths_mac.mm', 672 'base/base_paths_mac.mm',
639 'base/build_time.cc', 673 'base/build_time.cc',
640 'base/rand_util.cc', 674 'base/rand_util.cc',
641 'base/rand_util_posix.cc', 675 'base/rand_util_posix.cc',
642 'base/files/file_util_mac.mm', 676 'base/files/file_util_mac.mm',
643 'base/mac/bundle_locations.mm', 677 'base/mac/bundle_locations.mm',
644 'base/mac/call_with_eh_frame.cc', 678 'base/mac/call_with_eh_frame.cc',
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 cmd.append('-v') 813 cmd.append('-v')
780 cmd.append('gn') 814 cmd.append('gn')
781 check_call(cmd) 815 check_call(cmd)
782 816
783 if not options.debug and not is_win: 817 if not options.debug and not is_win:
784 check_call(['strip', os.path.join(build_dir, 'gn')]) 818 check_call(['strip', os.path.join(build_dir, 'gn')])
785 819
786 820
787 if __name__ == '__main__': 821 if __name__ == '__main__':
788 sys.exit(main(sys.argv[1:])) 822 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « tools/gn/args.cc ('k') | tools/gn/bootstrap/build_aix.ninja.template » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698