@@ -96,17 +96,7 @@ def cpu_for_target_arch(arch):
9696
9797def is_host_build(args):
9898 # If target_os == None, then this is a host build.
99- if args.target_os is None:
100- return True
101- # For linux arm64 builds, we cross compile from x64 hosts, so the
102- # target_os='linux' and linux-cpu='arm64'
103- if args.target_os == 'linux' and args.linux_cpu == 'arm64':
104- return True
105- # The Mac and host targets are redundant. Again, necessary to disambiguate
106- # during cross-compilation.
107- if args.target_os == 'mac':
108- return True
109- return False
99+ return args.target_os is None
110100
111101
112102# Determines whether a prebuilt Dart SDK can be used instead of building one.
@@ -435,7 +425,8 @@ def to_gn_args(args):
435425 else:
436426 gn_args['skia_use_gl'] = args.target_os != 'fuchsia'
437427
438- if sys.platform == 'darwin' and args.target_os not in ['android', 'fuchsia']:
428+ if sys.platform == 'darwin' and args.target_os not in ['android', 'fuchsia',
429+ 'linux']:
439430 # OpenGL is deprecated on macOS > 10.11.
440431 # This is not necessarily needed but enabling this until we have a way to
441432 # build a macOS metal only shell and a gl only shell.
@@ -529,8 +520,8 @@ def to_gn_args(args):
529520
530521 # Enable pointer compression on 64-bit mobile targets. iOS is excluded due to
531522 # its inability to allocate address space without allocating memory.
532- if args.target_os in ['android'] and gn_args['target_cpu'] in ['x64' , 'arm64 '
533- ]:
523+ if args.target_os in ['android', 'linux '
524+ ] and gn_args['target_cpu'] in ['x64', 'arm64' ]:
534525 gn_args['dart_use_compressed_pointers'] = True
535526
536527 if args.fuchsia_target_api_level is not None:
@@ -541,6 +532,10 @@ def to_gn_args(args):
541532 'fuchsia/target_api_level')) as file:
542533 gn_args['fuchsia_target_api_level'] = int(file.read().strip())
543534
535+ # Don't use the default Linux sysroot when buliding for Linux on macOS.
536+ if sys.platform == 'darwin' and args.target_os == 'linux':
537+ gn_args['use_default_linux_sysroot'] = False
538+
544539 # Flags for Dart features:
545540 if args.use_mallinfo2:
546541 gn_args['dart_use_mallinfo2'] = args.use_mallinfo2
@@ -562,7 +557,7 @@ def to_gn_args(args):
562557 # There is a special case for Android on Windows because there we _only_ build
563558 # gen_snapshot, but the build defines otherwise make it look like the build is
564559 # for a host Windows build and make GN think we will be building ANGLE.
565- if is_host_build(args) or (args.target_os == 'android ' and
560+ if is_host_build(args) or (args.target_os == 'linux ' and
566561 get_host_os() == 'win'):
567562 # Do not build unnecessary parts of the ANGLE tree.
568563 gn_args['angle_build_all'] = False
0 commit comments