From 4fb826fdb20c2fb2832187e968e0a924fd8a4ea1 Mon Sep 17 00:00:00 2001 From: geruipu Date: Sat, 20 Jun 2026 23:59:31 +0800 Subject: [PATCH] Restore ANGLE static target patching --- scripts/build-linux-static-graphics.sh | 28 ++++++++++++++++++++++++- scripts/build-macos-static-graphics.sh | 29 +++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/scripts/build-linux-static-graphics.sh b/scripts/build-linux-static-graphics.sh index 4792521..d05e333 100755 --- a/scripts/build-linux-static-graphics.sh +++ b/scripts/build-linux-static-graphics.sh @@ -227,7 +227,33 @@ apply_angle_patches() { local build_patch="$ANGLE_PATCH_DIR/angle-chromium-$ANGLE_BRANCH.patch" local deps_patch="$ANGLE_PATCH_DIR/angle-chromium-$ANGLE_BRANCH-deps.patch" - if [[ -f "$build_patch" ]] && ! git -C "$src" grep -q 'angle_static_library("libANGLE_static")' -- BUILD.gn; then + if ! git -C "$src" grep -q 'angle_static_library("libANGLE_static")' -- BUILD.gn; then + python3 - "$src/BUILD.gn" <<'PY' +import pathlib +import re +import sys + +path = pathlib.Path(sys.argv[1]) +text = path.read_text() +targets = '''angle_static_library("libANGLE_static") { + complete_static_lib = true + public_deps = [ ":libANGLE" ] +} + +angle_static_library("libANGLE_with_capture_static") { + complete_static_lib = true + public_deps = [ ":libANGLE_with_capture" ] +} + +angle_static_library("libGLESv2_static") { +''' +text = re.sub(r'^angle_static_library\("libGLESv2_static"\) \{', targets, text, count=1, flags=re.M) +text = re.sub(r'^angle_static_library\("libGLESv2_static"\) \{\n sources = libglesv2_sources', 'angle_static_library("libGLESv2_static") {\n complete_static_lib = true\n sources = libglesv2_sources', text, count=1, flags=re.M) +path.write_text(text) +PY + fi + + if [[ -f "$build_patch" ]] && git -C "$src" grep -q "'third_party/catapult'" -- DEPS; then git -C "$src" apply "$build_patch" elif [[ -f "$deps_patch" ]] && ! git -C "$src" apply --check "$deps_patch" >/dev/null 2>&1; then : diff --git a/scripts/build-macos-static-graphics.sh b/scripts/build-macos-static-graphics.sh index f841609..fbee727 100755 --- a/scripts/build-macos-static-graphics.sh +++ b/scripts/build-macos-static-graphics.sh @@ -160,7 +160,34 @@ sync_angle() { apply_angle_patches() { local src="$1" local patch="$ANGLE_PATCH_DIR/angle-chromium-$ANGLE_BRANCH.patch" - if [[ -f "$patch" ]] && ! git -C "$src" grep -q 'angle_static_library("libANGLE_static")' -- BUILD.gn; then + + if ! git -C "$src" grep -q 'angle_static_library("libANGLE_static")' -- BUILD.gn; then + python3 - "$src/BUILD.gn" <<'PY' +import pathlib +import re +import sys + +path = pathlib.Path(sys.argv[1]) +text = path.read_text() +targets = '''angle_static_library("libANGLE_static") { + complete_static_lib = true + public_deps = [ ":libANGLE" ] +} + +angle_static_library("libANGLE_with_capture_static") { + complete_static_lib = true + public_deps = [ ":libANGLE_with_capture" ] +} + +angle_static_library("libGLESv2_static") { +''' +text = re.sub(r'^angle_static_library\("libGLESv2_static"\) \{', targets, text, count=1, flags=re.M) +text = re.sub(r'^angle_static_library\("libGLESv2_static"\) \{\n sources = libglesv2_sources', 'angle_static_library("libGLESv2_static") {\n complete_static_lib = true\n sources = libglesv2_sources', text, count=1, flags=re.M) +path.write_text(text) +PY + fi + + if [[ -f "$patch" ]] && git -C "$src" grep -q "'third_party/catapult'" -- DEPS; then git -C "$src" apply "$patch" fi }