mirror of
https://github.com/openai/codex.git
synced 2026-09-11 20:36:49 +00:00
## Why Native voice builds ignore ambient compiler flags, but need a way to accept declared compiler, linker, and archive-tool inputs. ## What changed - Add repeated `--c-flag`, `--cxx-flag`, and `--link-flag` options plus optional `--ar` and `--ranlib` paths for Unix builds. Record flags and pass them through CMake, Meson, and libffi, including Objective-C flags on macOS. - Preserve literal libffi compiler arguments with response files. Reject flags containing whitespace, libffi paths requiring shell quoting, and Unix toolchain overrides on Windows. - Add a pinned Bazel `pkg-config` tool built with LLVM archive tools and native macOS configure checks. Register the pinned Make toolchain and patch its bootstrap to pass preprocessor flags and enable cross-compilation configuration. ## Testing Extend native-build tests to verify compiler and linker flags, explicit archive tools, Meson and Objective-C inputs, literal definitions through shell and recursive Make expansion, and rejection of unsupported overrides. GitOrigin-RevId: e5ea541ec76abfa170f6b0411b0f14cd698c07e7
34 lines
1.2 KiB
Python
34 lines
1.2 KiB
Python
"""Build the pinned pkg-config with native Mac configure checks."""
|
|
|
|
load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make_variant")
|
|
|
|
def pkg_config(name, **kwargs):
|
|
"""Keep Linux remote builds and select native Mac producers by OS and CPU."""
|
|
tags = kwargs.pop("tags", [])
|
|
configure_make_variant(
|
|
name = name + "_default",
|
|
tags = tags,
|
|
**kwargs
|
|
)
|
|
for arch in ["aarch64", "x86_64"]:
|
|
native.config_setting(
|
|
name = name + "_macos_" + arch,
|
|
constraint_values = ["@platforms//os:macos", "@platforms//cpu:" + arch],
|
|
)
|
|
configure_make_variant(
|
|
name = name + "_native_macos_" + arch,
|
|
exec_compatible_with = ["@platforms//os:macos", "@platforms//cpu:" + arch],
|
|
tags = tags + ["no-remote-exec"],
|
|
**kwargs
|
|
)
|
|
native.alias(
|
|
name = name,
|
|
tags = tags,
|
|
actual = select({
|
|
":" + name + "_macos_aarch64": ":" + name + "_native_macos_aarch64",
|
|
":" + name + "_macos_x86_64": ":" + name + "_native_macos_x86_64",
|
|
"//conditions:default": ":" + name + "_default",
|
|
}),
|
|
visibility = kwargs.get("visibility"),
|
|
)
|