From 06417d8020a9f7b2d4863a0b7d8f7b466672ddcf Mon Sep 17 00:00:00 2001 From: jif-oai Date: Fri, 20 Mar 2026 15:49:57 +0000 Subject: [PATCH] try to fix bazel 4 --- patches/llvm_macos_sdk_local_fallback.patch | 37 +++++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/patches/llvm_macos_sdk_local_fallback.patch b/patches/llvm_macos_sdk_local_fallback.patch index 1d9294a4a1..893a32f53a 100644 --- a/patches/llvm_macos_sdk_local_fallback.patch +++ b/patches/llvm_macos_sdk_local_fallback.patch @@ -1,14 +1,10 @@ diff --git a/http_pkg_archive.bzl b/http_pkg_archive.bzl -index 8822c51..a2c7f31 100644 --- a/http_pkg_archive.bzl +++ b/http_pkg_archive.bzl -@@ -1,9 +1,31 @@ - load("@bazel_tools//tools/build_defs/repo:utils.bzl", "get_auth") +@@ -2,6 +2,49 @@ load("@bazel_lib//lib:repo_utils.bzl", "repo_utils") def _http_pkg_archive_impl(rctx): -- rctx.download( -- url = rctx.attr.urls, + if repo_utils.is_darwin(rctx): + host_xcrun = rctx.which("xcrun") + if host_xcrun == None: @@ -23,16 +19,35 @@ index 8822c51..a2c7f31 100644 + fail("xcrun --show-sdk-path returned an empty SDK path") + + rctx.file(rctx.attr.dst + "/BUILD.bazel", rctx.read(Label("//3rd_party/macos_sdk:CLTools_macOSNMOS_SDK.BUILD.bazel"))) -+ rctx.symlink(sdk_path + "/System", rctx.attr.dst + "/System") -+ rctx.symlink(sdk_path + "/usr", rctx.attr.dst + "/usr") ++ rctx.execute([ ++ "mkdir", ++ "-p", ++ rctx.attr.dst + "/System/Library/Frameworks", ++ rctx.attr.dst + "/System/Library/PrivateFrameworks", ++ rctx.attr.dst + "/usr", ++ ]) ++ rctx.symlink(sdk_path + "/usr/include", rctx.attr.dst + "/usr/include") ++ rctx.symlink(sdk_path + "/usr/lib", rctx.attr.dst + "/usr/lib") + rctx.symlink(sdk_path + "/Entitlements.plist", rctx.attr.dst + "/Entitlements.plist") + rctx.symlink(sdk_path + "/SDKSettings.json", rctx.attr.dst + "/SDKSettings.json") + rctx.symlink(sdk_path + "/SDKSettings.plist", rctx.attr.dst + "/SDKSettings.plist") + ++ for include in rctx.attr.includes: ++ if include.startswith("System/Library/Frameworks/") and include.endswith("/*"): ++ framework = include.removeprefix("System/Library/Frameworks/").removesuffix("/*") ++ rctx.symlink( ++ sdk_path + "/System/Library/Frameworks/" + framework, ++ rctx.attr.dst + "/System/Library/Frameworks/" + framework, ++ ) ++ if include.startswith("System/Library/PrivateFrameworks/") and include.endswith("/*"): ++ framework = include.removeprefix("System/Library/PrivateFrameworks/").removesuffix("/*") ++ rctx.symlink( ++ sdk_path + "/System/Library/PrivateFrameworks/" + framework, ++ rctx.attr.dst + "/System/Library/PrivateFrameworks/" + framework, ++ ) ++ + return rctx.repo_metadata(reproducible = False) + -+ rctx.download( -+ url = rctx.attr.urls, + rctx.download( + url = rctx.attr.urls, output = ".downloaded.pkg", - sha256 = rctx.attr.sha256, - canonical_id = " ".join(rctx.attr.urls),