diff --git a/packages/skia/scripts/build-skia.ts b/packages/skia/scripts/build-skia.ts index b225d7c47d..b8ea1435f3 100644 --- a/packages/skia/scripts/build-skia.ts +++ b/packages/skia/scripts/build-skia.ts @@ -1,7 +1,9 @@ import { exit } from "process"; +import path from "path"; import type { Platform, PlatformName } from "./skia-configuration"; import { + applyGraphiteSkiaPatches, commonArgs, configurations, copyHeaders, @@ -279,6 +281,22 @@ const buildXCFrameworks = () => { process.chdir(SkiaSrc); $("PATH=../depot_tools/:$PATH python3 tools/git-sync-deps"); console.log("gclient sync done"); + if (GRAPHITE) { + console.log("Applying Graphite patches..."); + $(`git reset --hard HEAD`); + + // Apply arm64e simulator patch + const arm64ePatchFile = path.join(__dirname, "dawn-arm64e-simulator.patch"); + $(`cd ${SkiaSrc} && git apply ${arm64ePatchFile}`); + + // Fix Dawn ShaderModuleMTL.mm uint32 typo if it exists + const shaderModuleFile = `${SkiaSrc}/third_party/externals/dawn/src/dawn/native/metal/ShaderModuleMTL.mm`; + $( + `sed -i '' 's/uint32(bindingInfo\\.binding)/uint32_t(bindingInfo.binding)/g' ${shaderModuleFile}` + ); + + console.log("Patches applied successfully"); + } $(`rm -rf ${PackageRoot}/libs`); // Build specified platforms and targets diff --git a/packages/skia/scripts/dawn-arm64e-simulator.patch b/packages/skia/scripts/dawn-arm64e-simulator.patch new file mode 100644 index 0000000000..510ef02768 --- /dev/null +++ b/packages/skia/scripts/dawn-arm64e-simulator.patch @@ -0,0 +1,32 @@ +From e34f6eaae468d0499b544815f67a73c6f75e9d56 Mon Sep 17 00:00:00 2001 +From: William Candillon +Date: Sat, 18 Oct 2025 18:45:06 +0200 +Subject: [PATCH] Remove unavailable platform on simulator + +--- + gn/skia/BUILD.gn | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/gn/skia/BUILD.gn b/gn/skia/BUILD.gn +index 8e42db771b..30048a1d43 100644 +--- a/gn/skia/BUILD.gn ++++ b/gn/skia/BUILD.gn +@@ -199,9 +199,13 @@ config("default") { + _arch_flags = [ + "-arch", + "arm64", +- "-arch", +- "arm64e", + ] ++ if (!ios_use_simulator) { ++ _arch_flags += [ ++ "-arch", ++ "arm64e", ++ ] ++ } + } else if (current_cpu == "x86") { + _arch_flags = [ + "-arch", +-- +2.42.0 +