@@ -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
@@ -711,13 +700,17 @@ def to_gn_args(args):
711700
712701 # Enable pointer compression on 64-bit mobile targets. iOS is excluded due to
713702 # its inability to allocate address space without allocating memory.
714- if args.target_os in ['android'] and gn_args['target_cpu'] in ['x64', 'arm64']:
703+ if args.target_os in ['android', 'linux' ] and gn_args['target_cpu'] in ['x64', 'arm64']:
715704 gn_args['dart_use_compressed_pointers'] = True
716705
717706 if args.target_os == 'fuchsia':
718707 gn_args['gn_configs_path'] = '//flutter/build/config/fuchsia/gn_configs.gni'
719708 gn_args['fuchsia_gn_sdk'] = '//flutter/tools/fuchsia/gn-sdk'
720709
710+ # Don't use the default Linux sysroot when buliding for Linux on macOS.
711+ if sys.platform == 'darwin' and args.target_os == 'linux':
712+ gn_args['use_default_linux_sysroot'] = False
713+
721714 # Flags for Dart features:
722715 if args.use_mallinfo2:
723716 gn_args['dart_use_mallinfo2'] = args.use_mallinfo2
@@ -743,9 +736,8 @@ def to_gn_args(args):
743736 # gen_snapshot, but the build defines otherwise make it look like the build is
744737 # for a host Windows build and make GN think we will be building ANGLE.
745738 # Angle is not used on Mac hosts as there are no tests for the OpenGL backend.
746- if is_host_build(args) or (args.target_os == 'android' and get_host_os() == 'win'):
747- # Don't include git commit information.
748- gn_args['angle_enable_commit_id'] = False
739+ if (is_host_build(args) and gn_args['host_os'] != 'mac') or (args.target_os == 'linux' and
740+ get_host_os() == 'win'):
749741 # Do not build unnecessary parts of the ANGLE tree.
750742 gn_args['angle_build_all'] = False
751743 gn_args['angle_has_astc_encoder'] = False
0 commit comments