mirror of
https://github.com/openai/codex.git
synced 2026-10-20 00:18:49 +00:00
## What changed - Add `runtime_package` targets for combined, primary, app-server, and Windows helper bundles, plus per-binary release archives. - Apply release settings automatically and retain unstripped binaries with macOS dSYM or Windows PDB symbols. Require platform-specific symbols and validate that dSYM bundles contain nonempty DWARF data. - Support a `debug` build mode for faster package smoke builds and configure platform-specific release settings, including native Windows MSVC toolchains. - Add a composite action that refreshes Cargo workspace metadata, builds the selected archive, and extracts writable files for existing signing and packaging steps. GitOrigin-RevId: 21109875cde228aaef67b2ba9812b3e4854aee84
74 lines
2.1 KiB
Python
74 lines
2.1 KiB
Python
load("@rules_cc//cc:defs.bzl", "cc_library")
|
|
load("//:defs.bzl", "codex_rust_crate")
|
|
load("//bazel/rules:runtime_package.bzl", "release_binary")
|
|
|
|
codex_rust_crate(
|
|
name = "bwrap",
|
|
# Bazel wires vendored bubblewrap + libcap via :bwrap-ffi below and sets
|
|
# bwrap_available explicitly, so we skip Cargo's build.rs in Bazel builds.
|
|
build_script_enabled = False,
|
|
crate_name = "codex_bwrap",
|
|
deps_extra = select({
|
|
"@platforms//os:linux": [":bwrap-ffi"],
|
|
"//conditions:default": [],
|
|
}),
|
|
rustc_flags_extra = select({
|
|
"@platforms//os:linux": [
|
|
"--cfg=bwrap_available",
|
|
# TODO(anp) Extract bwrap symbols before stripping.
|
|
"-Cstrip=symbols",
|
|
],
|
|
"//conditions:default": [],
|
|
}),
|
|
)
|
|
|
|
release_binary(
|
|
binary = ":bwrap",
|
|
target_compatible_with = ["@platforms//os:linux"],
|
|
)
|
|
|
|
genrule(
|
|
name = "bwrap-sha256-env",
|
|
srcs = [":bwrap"],
|
|
outs = ["bwrap.sha256.env"],
|
|
cmd = " && ".join([
|
|
'$(execpath @bazel_tools//tools/build_defs/hash:sha256) $(execpath :bwrap) "$@"',
|
|
'digest=$$(<"$@")',
|
|
'printf "CODEX_BWRAP_SHA256=%s\\n" "$$digest" > "$@"',
|
|
]),
|
|
target_compatible_with = ["@platforms//os:linux"],
|
|
tools = ["@bazel_tools//tools/build_defs/hash:sha256"],
|
|
visibility = ["//codex-rs/linux-sandbox:__pkg__"],
|
|
)
|
|
|
|
config_setting(
|
|
name = "optimized",
|
|
values = {"compilation_mode": "opt"},
|
|
)
|
|
|
|
cc_library(
|
|
name = "bwrap-ffi",
|
|
srcs = ["//codex-rs/vendor:bubblewrap_c_sources"],
|
|
hdrs = [
|
|
"config.h",
|
|
"//codex-rs/vendor:bubblewrap_headers",
|
|
],
|
|
copts = [
|
|
"-D_GNU_SOURCE",
|
|
"-Dmain=bwrap_main",
|
|
] + select({
|
|
# Cargo cc-rs uses release OPT_LEVEL=3 and DEBUG=true, without
|
|
# the C toolchain's default NDEBUG; retain native symbols for packaging.
|
|
":optimized": [
|
|
"-O3",
|
|
"-g",
|
|
"-UNDEBUG",
|
|
],
|
|
"//conditions:default": [],
|
|
}),
|
|
includes = ["."],
|
|
target_compatible_with = ["@platforms//os:linux"],
|
|
visibility = ["//visibility:private"],
|
|
deps = ["@libcap"],
|
|
)
|