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
70 lines
2.2 KiB
Python
70 lines
2.2 KiB
Python
load("@bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
|
|
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
|
load("sqlite_build_info.bzl", "sqlite_build_info")
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
exports_files([
|
|
"libsqlite3_sys.BUILD.bazel",
|
|
])
|
|
|
|
# Use bindings and native code from the same libsqlite3-sys release.
|
|
copy_to_directory(
|
|
name = "sqlite_bindings",
|
|
srcs = ["@crates//:libsqlite3_sys_bindings"],
|
|
include_external_repositories = ["*"],
|
|
replace_prefixes = {"sqlite3/bindgen_bundled_version.rs": "bindgen.rs"},
|
|
)
|
|
|
|
sqlite_build_info(
|
|
name = "libsqlite3_sys_build_info",
|
|
cc_lib = "sqlite3",
|
|
out_dir = "sqlite_bindings",
|
|
)
|
|
|
|
# Match libsqlite3-sys's bundled build without embedding build.rs's worker path.
|
|
# Internal compilation options must not leak into dependent C/C++ targets.
|
|
cc_library(
|
|
name = "sqlite3",
|
|
srcs = ["@crates//:libsqlite3_sys_source"],
|
|
linkopts = select({
|
|
"@platforms//os:freebsd": ["-lpthread"],
|
|
"@platforms//os:linux": [
|
|
"-lpthread",
|
|
"-ldl",
|
|
],
|
|
"@platforms//os:netbsd": ["-lpthread"],
|
|
"@platforms//os:openbsd": ["-lpthread"],
|
|
"//conditions:default": [],
|
|
}),
|
|
linkstatic = True,
|
|
local_defines = [
|
|
"SQLITE_CORE",
|
|
"SQLITE_DEFAULT_FOREIGN_KEYS=1",
|
|
"SQLITE_ENABLE_API_ARMOR",
|
|
"SQLITE_ENABLE_COLUMN_METADATA",
|
|
"SQLITE_ENABLE_DBSTAT_VTAB",
|
|
"SQLITE_ENABLE_FTS3",
|
|
"SQLITE_ENABLE_FTS3_PARENTHESIS",
|
|
"SQLITE_ENABLE_FTS5",
|
|
"SQLITE_ENABLE_JSON1",
|
|
"SQLITE_ENABLE_LOAD_EXTENSION=1",
|
|
"SQLITE_ENABLE_RTREE",
|
|
"SQLITE_ENABLE_STAT4",
|
|
"SQLITE_SOUNDEX",
|
|
"SQLITE_THREADSAFE=1",
|
|
"SQLITE_USE_URI",
|
|
"HAVE_USLEEP=1",
|
|
"HAVE_ISNAN",
|
|
"_POSIX_THREAD_SAFE_FUNCTIONS",
|
|
] + select({
|
|
"@platforms//os:windows": [],
|
|
"//conditions:default": ["HAVE_LOCALTIME_R"],
|
|
}) + select({
|
|
# Preserve Codex's workaround for older x64 Windows CPUs.
|
|
"@rules_rs//rs/platforms/config:x86_64-pc-windows-msvc": ["SQLITE_DISABLE_INTRINSIC"],
|
|
"//conditions:default": [],
|
|
}),
|
|
deps = ["@crates//:libsqlite3_sys_headers"],
|
|
)
|