mirror of
https://github.com/openai/codex.git
synced 2026-11-10 21:00:47 +00:00
## Why Windows MSVC builds relied on installed C++ toolchains, and V8 snapshot generation required native Windows execution. Cross-compiling V8 also needs a Windows snapshot generator to preserve Windows unwind metadata. ## What changed - Use the registered hermetic LLVM toolchain and declared Microsoft SDK for Windows MSVC builds, with static CRT linkage and the toolchain's declared `lld-link` for Rust. - Run Windows V8 snapshot generators natively or through `rules_wine` on Linux, preserving target CPU, OS, and sandbox settings. Keep separate archive and binding pairs for the workspace's ISO stdio ABI and the distributed MSVC stdio ABI. - Update build dependencies and bindgen, scope V8's Chromium libc++ settings to its own targets, and adapt native voice dependencies for clang-cl and Windows ARM64. - Build SQLite directly with Bazel and give `openssl-sys` an explicit build using Bazel's OpenSSL. - Remove build-worker source-directory dependencies from Bazel resource lookup, schema output discovery, and snapshot paths; embed assets in debug builds as well. GitOrigin-RevId: fd224d9d28d73a67baf90f6d73c6079d60f20351
111 lines
4.1 KiB
Diff
111 lines
4.1 KiB
Diff
diff --git a/build.rs b/build.rs
|
|
--- a/build.rs
|
|
+++ b/build.rs
|
|
@@ -346,7 +346,27 @@
|
|
// we want to optimize for minimizing the build tools required: No Perl,
|
|
// no nasm, etc.
|
|
let generated_dir = if !is_git {
|
|
- c_root_dir.join(PREGENERATED)
|
|
+ let pregenerated_dir = c_root_dir.join(PREGENERATED);
|
|
+ if target.os == WINDOWS && target.env == "msvc"
|
|
+ {
|
|
+ let mut pending = vec![(pregenerated_dir.clone(), out_dir.clone())];
|
|
+ while let Some((src_dir, dst_dir)) = pending.pop() {
|
|
+ fs::create_dir_all(&dst_dir).unwrap();
|
|
+ for entry in fs::read_dir(&src_dir).unwrap() {
|
|
+ let entry = entry.unwrap();
|
|
+ let src_path = entry.path();
|
|
+ let dst_path = dst_dir.join(entry.file_name());
|
|
+ if entry.file_type().unwrap().is_dir() {
|
|
+ pending.push((src_path, dst_path));
|
|
+ } else {
|
|
+ fs::copy(&src_path, &dst_path).unwrap();
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ out_dir.clone()
|
|
+ } else {
|
|
+ pregenerated_dir
|
|
+ }
|
|
} else {
|
|
generate_sources_and_preassemble(
|
|
&out_dir,
|
|
@@ -561,14 +581,21 @@
|
|
- let compiler = c.get_compiler();
|
|
- // FIXME: On Windows AArch64 we currently must use Clang to compile C code
|
|
- let compiler = if target.os == WINDOWS && target.arch == AARCH64 && !compiler.is_like_clang() {
|
|
- let _ = c.compiler("clang");
|
|
- c.get_compiler()
|
|
- } else {
|
|
- compiler
|
|
+ // FIXME: On Windows AArch64 we currently must use Clang to compile C code.
|
|
+ // clang-cl emulates the cl.exe command line, `$CFLAGS`, etc.
|
|
+ if target.os == WINDOWS && target.arch == AARCH64 {
|
|
+ let _: &_ = c.prefer_clang_cl_over_msvc(true);
|
|
};
|
|
+ let compiler = c.get_compiler();
|
|
|
|
let _ = c.include(c_root_dir.join("include"));
|
|
let _ = c.include(include_dir);
|
|
+ let _ = c.include(c_root_dir.join("third_party").join("fiat"));
|
|
+ if compiler.is_like_msvc() {
|
|
+ let _ = c.include(c_root_dir.join("crypto").join("curve25519"));
|
|
+ let _ = c.include(c_root_dir.join("crypto").join("limbs"));
|
|
+ let _ = c.include(c_root_dir.join("crypto").join("fipsmodule").join("aes"));
|
|
+ let _ = c.include(c_root_dir.join("crypto").join("fipsmodule").join("bn"));
|
|
+ let _ = c.include(c_root_dir.join("crypto").join("fipsmodule").join("ec"));
|
|
+ let _ = c.include(c_root_dir.join("crypto").join("poly1305"));
|
|
+ }
|
|
for f in cpp_flags(&compiler) {
|
|
let _ = c.flag(f);
|
|
}
|
|
diff --git a/crypto/curve25519/curve25519.c b/crypto/curve25519/curve25519.c
|
|
index 99d7d7fbb..2f69ad560 100644
|
|
--- a/crypto/curve25519/curve25519.c
|
|
+++ b/crypto/curve25519/curve25519.c
|
|
@@ -47,11 +47,11 @@
|
|
#if defined(__GNUC__)
|
|
#pragma GCC diagnostic ignored "-Wpedantic"
|
|
#endif
|
|
-#include "../../third_party/fiat/curve25519_64.h"
|
|
+#include "curve25519_64.h"
|
|
#elif defined(OPENSSL_64_BIT)
|
|
-#include "../../third_party/fiat/curve25519_64_msvc.h"
|
|
+#include "curve25519_64_msvc.h"
|
|
#else
|
|
-#include "../../third_party/fiat/curve25519_32.h"
|
|
+#include "curve25519_32.h"
|
|
#endif
|
|
|
|
|
|
diff --git a/crypto/curve25519/curve25519_64_adx.c b/crypto/curve25519/curve25519_64_adx.c
|
|
index 88964a9dd..b660f55f4 100644
|
|
--- a/crypto/curve25519/curve25519_64_adx.c
|
|
+++ b/crypto/curve25519/curve25519_64_adx.c
|
|
@@ -19,5 +19,5 @@
|
|
#pragma GCC diagnostic ignored "-Wpedantic"
|
|
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
|
|
|
-#include "../../third_party/fiat/curve25519_64_adx.h"
|
|
+#include "curve25519_64_adx.h"
|
|
#endif
|
|
diff --git a/crypto/fipsmodule/ec/p256.c b/crypto/fipsmodule/ec/p256.c
|
|
index 0117916da..4224d1192 100644
|
|
--- a/crypto/fipsmodule/ec/p256.c
|
|
+++ b/crypto/fipsmodule/ec/p256.c
|
|
@@ -50,11 +50,11 @@
|
|
#if defined(__GNUC__)
|
|
#pragma GCC diagnostic ignored "-Wpedantic"
|
|
#endif
|
|
-#include "../../../third_party/fiat/p256_64.h"
|
|
+#include "p256_64.h"
|
|
#elif defined(OPENSSL_64_BIT)
|
|
-#include "../../../third_party/fiat/p256_64_msvc.h"
|
|
+#include "p256_64_msvc.h"
|
|
#else
|
|
-#include "../../../third_party/fiat/p256_32.h"
|
|
+#include "p256_32.h"
|
|
#endif
|
|
|
|
|