--- gn/skia/BUILD.gn +++ gn/skia/BUILD.gn 2026-04-26 21:56:40.000000000 +0800 @@ -18,6 +18,7 @@ malloc = "" werror = false + mac_deployment_target = "" xcode_sysroot = "" } @@ -269,33 +270,37 @@ # Falling back to library file for linking. ldflags += [ "-Wl,-w" ] - # As of 11/2020, gn is an x86 binary and defaults the host_cpu to x86_64. - # This allows you to build arm64 mac binaries by setting target_cpu = "arm64" + # This allows you to build for other archs by setting target_cpu. if (current_cpu == "arm64") { - asmflags += [ - "-target", - "arm64-apple-macos11", - ] - cflags += [ - "-target", - "arm64-apple-macos11", - ] - ldflags += [ - "-target", - "arm64-apple-macos11", - ] + _mac_arch = "arm64" + } else if (current_cpu == "x64") { + _mac_arch = "x86_64" + } else if (current_cpu == "x86") { + _mac_arch = "i386" + } else if (current_cpu == "ppc") { + _mac_arch = "ppc" + } else if (current_cpu == "ppc64") { + _mac_arch = "ppc64" } else { + _mac_arch = current_cpu + } + + asmflags += [ + "-arch", _mac_arch, + ] + cflags += [ + "-arch", _mac_arch, + "-mmacosx-version-min=" + mac_deployment_target, + ] + ldflags += [ + "-arch", _mac_arch, + "-mmacosx-version-min=" + mac_deployment_target, + ] + + # Suppress minimum version warnings from assembler + if (current_cpu == "x64" || current_cpu == "x86") { asmflags += [ - "-target", - "x86_64-apple-macos11", - ] - cflags += [ - "-target", - "x86_64-apple-macos11", - ] - ldflags += [ - "-target", - "x86_64-apple-macos11", + "-mmacosx-version-min=" + mac_deployment_target, ] } }