mirror of
https://github.com/openai/codex.git
synced 2026-10-31 19:28:49 +00:00
## Why V8's Abseil and protobuf's shared Abseil can be built for different C++ runtimes. Give V8's copy a distinct inline namespace so both can link into one binary without interposing incompatible functions. ## What changed - Move pinned V8 dependency imports and BUILD overlays into `third_party/v8`, and inject those repositories into V8 through a module-extension bridge with no fallback downloads. - Build V8's Abseil with a V8-specific inline namespace while preserving protobuf's shared Abseil namespace. - Apply V8's C++ runtime settings in the Abseil, Highway, and simdutf overlays, and remove the shared `rules_cc` patch. - Document source dependency ownership and the version, checksum, and overlay review procedure for V8 upgrades. GitOrigin-RevId: 2b8e3deed285559f8dd3324647cb4b81089f2f56
58 lines
2.4 KiB
Python
58 lines
2.4 KiB
Python
"""Source-only, private Abseil build for V8.
|
|
|
|
Abseil's inline namespace is deliberately set in options.h, not a command line
|
|
override: upstream's options header defines it unconditionally. That file is
|
|
Abseil's supported build configuration interface for packagers. Namespace all
|
|
of the V8 copy (including its public headers) identically so it can coexist in
|
|
the same binary with the shared Abseil module compiled for protobuf.
|
|
"""
|
|
|
|
def _v8_abseil_repository_impl(repository_ctx):
|
|
repository_ctx.download_and_extract(
|
|
url = "https://github.com/abseil/abseil-cpp/releases/download/20250814.1/abseil-cpp-20250814.1.tar.gz",
|
|
integrity = "sha256-FpL3fRc5us8/lDNxiLeFg88JurfkINLcbFYFpPhnhaE=",
|
|
stripPrefix = "abseil-cpp-20250814.1",
|
|
)
|
|
|
|
# Our root BUILD must own all sources beneath absl/. Native Starlark
|
|
# filesystem operations work on Windows as well; no shell or Python.
|
|
directories = [repository_ctx.path("absl")]
|
|
for _ in range(32):
|
|
if not directories:
|
|
break
|
|
next_directories = []
|
|
for directory in directories:
|
|
for entry in directory.readdir():
|
|
if entry.basename in ["BUILD", "BUILD.bazel"]:
|
|
repository_ctx.delete(entry)
|
|
elif entry.is_dir:
|
|
next_directories.append(entry)
|
|
directories = next_directories
|
|
if directories:
|
|
fail("V8 Abseil source tree exceeds the supported traversal depth")
|
|
repository_ctx.delete("BUILD")
|
|
repository_ctx.delete("BUILD.bazel")
|
|
repository_ctx.symlink(repository_ctx.attr.build_file, "BUILD.bazel")
|
|
|
|
# Do not silently configure a new Abseil version as this version on upgrade.
|
|
# See absl/base/options.h: ABSL_OPTION_INLINE_NAMESPACE_NAME.
|
|
options = repository_ctx.read("absl/base/options.h")
|
|
original = "#define ABSL_OPTION_INLINE_NAMESPACE_NAME lts_20250814"
|
|
if options.count(original) != 1:
|
|
fail("Unexpected Abseil inline namespace: recheck the private V8 ABI for this source revision")
|
|
repository_ctx.file(
|
|
"absl/base/options.h",
|
|
options.replace(original, "#define ABSL_OPTION_INLINE_NAMESPACE_NAME codex_v8_lts_20250814"),
|
|
executable = False,
|
|
)
|
|
|
|
v8_abseil_repository = repository_rule(
|
|
implementation = _v8_abseil_repository_impl,
|
|
attrs = {
|
|
"build_file": attr.label(
|
|
default = Label("//third_party/v8:abseil.BUILD.bazel"),
|
|
allow_single_file = True,
|
|
),
|
|
},
|
|
)
|