Files
dev/codex-rs/windows-sandbox-rs/build.rs
zeekayandHanzo Dev 54a8eed885 port: adopt latest openai/codex codex-rs base (2026-06-16, 33d5023)
Wholesale-adopt latest upstream codex-rs (97 crates, new architecture:
model-provider-info crate, app-server-daemon/transport, code-mode-host,
thread-store, file-watcher, etc.). Hanzo-only crates (browser, debug-client,
instructions, tui2) preserved on disk (not yet re-added to workspace). Builds
clean as upstream (codex bin). Hanzo overlay (dev bin, api.hanzo.ai default,
hanzo.id/Claude login, branding) re-applied in following commits.

Co-authored-by: Hanzo Dev <[email protected]>
2026-06-16 21:24:01 -07:00

40 lines
1.4 KiB
Rust

use std::env;
use std::path::PathBuf;
const SETUP_BIN: &str = "codex-windows-sandbox-setup";
const SETUP_MANIFEST: &str = "codex-windows-sandbox-setup.manifest";
fn main() -> Result<(), String> {
println!("cargo:rerun-if-changed={SETUP_MANIFEST}");
if env::var("CARGO_CFG_TARGET_OS").as_deref() != Ok("windows") {
return Ok(());
}
let manifest_dir = env::var_os("CARGO_MANIFEST_DIR")
.ok_or_else(|| "CARGO_MANIFEST_DIR should be set for build scripts".to_string())?;
let manifest_path = PathBuf::from(manifest_dir).join(SETUP_MANIFEST);
let manifest_path = manifest_path.display();
// Keep this scoped to the setup helper so Codex binaries that link the
// library do not inherit any resource metadata from this package.
match (
env::var("CARGO_CFG_TARGET_ENV").as_deref(),
env::var("CARGO_CFG_TARGET_ABI").as_deref(),
) {
(Ok("msvc"), _) => {
println!("cargo:rustc-link-arg-bin={SETUP_BIN}=/MANIFEST:EMBED");
println!("cargo:rustc-link-arg-bin={SETUP_BIN}=/MANIFESTINPUT:{manifest_path}");
}
(Ok("gnu"), Ok("llvm")) => {
println!("cargo:rustc-link-arg-bin={SETUP_BIN}=-Wl,-Xlink=/manifest:embed");
println!(
"cargo:rustc-link-arg-bin={SETUP_BIN}=-Wl,-Xlink=/manifestinput:{manifest_path}"
);
}
_ => {}
}
Ok(())
}