@@ -89,18 +89,7 @@ def to_command_line(gn_args):
8989
9090
9191def is_host_build(args):
92- # If target_os == None, then this is a host build.
93- if args.target_os is None:
94- return True
95- # For linux arm64 builds, we cross compile from x64 hosts, so the
96- # target_os='linux' and linux-cpu='arm64'
97- if args.target_os == 'linux' and args.linux_cpu == 'arm64':
98- return True
99- # The Mac and host targets are redundant. Again, necessary to disambiguate
100- # during cross-compilation.
101- if args.target_os == 'mac':
102- return True
103- return False
92+ return args.target_os is None
10493
10594
10695# Determines whether a prebuilt Dart SDK can be used instead of building one.
@@ -502,7 +491,7 @@ def to_gn_args(args):
502491 # does not exist. Further, we set the 'host_cpu' so that it shares the
503492 # bitwidth of the 32-bit arm target.
504493 if sys.platform.startswith(
505- ('cygwin', 'win')) and args.target_os == 'android ' and gn_args['target_cpu'] == 'arm':
494+ ('cygwin', 'win')) and args.target_os != 'win ' and gn_args['target_cpu'] == 'arm':
506495 gn_args['host_cpu'] = 'x86'
507496 gn_args['current_cpu'] = 'x86'
508497
@@ -599,7 +588,7 @@ def to_gn_args(args):
599588 else:
600589 gn_args['skia_use_gl'] = args.target_os != 'fuchsia'
601590
602- if sys.platform == 'darwin' and args.target_os not in ['android', 'fuchsia']:
591+ if sys.platform == 'darwin' and args.target_os not in ['android', 'fuchsia', 'linux' ]:
603592 # OpenGL is deprecated on macOS > 10.11.
604593 # This is not necessarily needed but enabling this until we have a way to
605594 # build a macOS metal only shell and a gl only shell.
@@ -610,7 +599,7 @@ def to_gn_args(args):
610599 # Enable Vulkan on all platforms except for iOS. This is just
611600 # to save on mobile binary size, as there's no reason the Vulkan embedder
612601 # features can't work on these platforms.
613- if gn_args['target_os'] not in ['ios', 'mac']:
602+ if gn_args['target_os'] not in ['ios', 'mac', 'linux' ]:
614603 gn_args['skia_use_vulkan'] = True
615604 gn_args['skia_use_vma'] = False
616605 gn_args['shell_enable_vulkan'] = True
@@ -698,13 +687,17 @@ def to_gn_args(args):
698687
699688 # Enable pointer compression on 64-bit mobile targets. iOS is excluded due to
700689 # its inability to allocate address space without allocating memory.
701- if args.target_os in ['android'] and gn_args['target_cpu'] in ['x64', 'arm64']:
690+ if args.target_os in ['android', 'linux' ] and gn_args['target_cpu'] in ['x64', 'arm64']:
702691 gn_args['dart_use_compressed_pointers'] = True
703692
704693 if args.target_os == 'fuchsia':
705694 gn_args['gn_configs_path'] = '//flutter/build/config/fuchsia/gn_configs.gni'
706695 gn_args['fuchsia_gn_sdk'] = '//flutter/tools/fuchsia/gn-sdk'
707696
697+ # Don't use the default Linux sysroot when buliding for Linux on macOS.
698+ if sys.platform == 'darwin' and args.target_os == 'linux':
699+ gn_args['use_default_linux_sysroot'] = False
700+
708701 # Flags for Dart features:
709702 if args.use_mallinfo2:
710703 gn_args['dart_use_mallinfo2'] = args.use_mallinfo2
@@ -730,9 +723,8 @@ def to_gn_args(args):
730723 # gen_snapshot, but the build defines otherwise make it look like the build is
731724 # for a host Windows build and make GN think we will be building ANGLE.
732725 # Angle is not used on Mac hosts as there are no tests for the OpenGL backend.
733- if is_host_build(args) or (args.target_os == 'android' and get_host_os() == 'win'):
734- # Don't include git commit information.
735- gn_args['angle_enable_commit_id'] = False
726+ if (is_host_build(args) and gn_args['host_os'] != 'mac') or (args.target_os == 'linux' and
727+ get_host_os() == 'win'):
736728 # Do not build unnecessary parts of the ANGLE tree.
737729 gn_args['angle_build_all'] = False
738730 gn_args['angle_has_astc_encoder'] = False
0 commit comments