Skip to content
This repository was archived by the owner on Sep 18, 2025. It is now read-only.

Commit 66f7426

Browse files
committed
Add Windows crates and refacotring build.bzl
Signed-off-by: Eli Ma <eli@patch.sh>
1 parent 4011a85 commit 66f7426

File tree

1,476 files changed

+3689
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,476 files changed

+3689
-4
lines changed

BUCK

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ cargo.rust_binary(
66
srcs = glob(["src/**/*.rs"]),
77
crate_root = "src/main.rs",
88
deps = [
9+
# ---
10+
"//third-party/rust/crates/windows_x86_64_msvc/0.53.0:windows_x86_64_msvc",
11+
"//third-party/rust/crates/windows_x86_64_gnullvm/0.53.0:windows_x86_64_gnullvm",
12+
"//third-party/rust/crates/windows_x86_64_gnu/0.53.0:windows_x86_64_gnu",
13+
"//third-party/rust/crates/windows_i686_msvc/0.53.0:windows_i686_msvc",
14+
"//third-party/rust/crates/windows_i686_gnullvm/0.53.0:windows_i686_gnullvm",
15+
"//third-party/rust/crates/windows_i686_gnu/0.53.0:windows_i686_gnu",
16+
"//third-party/rust/crates/windows_aarch64_msvc/0.53.0:windows_aarch64_msvc",
17+
"//third-party/rust/crates/windows_aarch64_gnullvm/0.53.0:windows_aarch64_gnullvm",
18+
"//third-party/rust/crates/winapi-i686-pc-windows-gnu/0.4.0:winapi-i686-pc-windows-gnu",
19+
# ---
20+
921
# autocfg
1022
"//third-party/rust/crates/autocfg/1.4.0:autocfg",
1123

third-party/README.md

Lines changed: 2 additions & 2 deletions

third-party/rust/crates/anstyle/1.0.10/BUCK

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
load("@prelude//toolchains:rust.bzl", "system_rust_toolchain")
2-
load("//build.bzl", "get_rust_features")
2+
load("//third-party/rust/crates/anstyle/1.0.10:build.bzl", "get_rust_features")
33

44
rust_library(
55
name = "anstyle",
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""Build configuration module for zstd-sys crate.
2+
3+
This module provides functionality for configuring Rust features and standard library
4+
support for the zstd-sys crate build process. It handles feature flag management and
5+
platform-specific configurations.
6+
"""
7+
8+
def get_rust_features():
9+
features_config = read_config("rust", "features", "")
10+
11+
if features_config == "":
12+
return ["legacy", "zdict_builder"] # Default features
13+
return [f.strip() for f in features_config.split(",") if f.strip()]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
2+
#
3+
# When uploading crates to the registry Cargo will automatically
4+
# "normalize" Cargo.toml files for maximal compatibility
5+
# with all versions of Cargo and also rewrite `path` dependencies
6+
# to registry (e.g., crates.io) dependencies
7+
#
8+
# If you believe there's an error in this file please file an
9+
# issue against the rust-lang/cargo repository. If you're
10+
# editing this file be aware that the upstream Cargo.toml
11+
# will likely look very different (and much more reasonable)
12+
13+
[package]
14+
name = "deno-x86_64-pc-windows-msvc"
15+
version = "0.23.0"
16+
authors = ["The deno authors <bertbelder@nodejs.org>"]
17+
build = "build.rs"
18+
include = ["src/*", "lib/*", "Cargo.toml", "build.rs"]
19+
description = "Binary dependencies for the 'deno' crate"
20+
license = "MIT"
21+
repository = "https://github.com/denoland/deno"

third-party/rust/crates/deno-x86_64-pc-windows-msvc/0.23.0/Cargo.toml.orig

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
fn main() {
3+
use std::env::var;
4+
use std::path::Path;
5+
if var("TARGET")
6+
.map(|target| target == "x86_64-pc-windows-msvc")
7+
.unwrap_or(false)
8+
{
9+
let dir = var("CARGO_MANIFEST_DIR").unwrap();
10+
println!(
11+
"cargo:rustc-link-search=native={}",
12+
Path::new(&dir).join("lib").display()
13+
);
14+
}
15+
}
Binary file not shown.

third-party/rust/crates/deno-x86_64-pc-windows-msvc/0.23.0/src/lib.rs

Whitespace-only changes.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
load("@prelude//toolchains:rust.bzl", "system_rust_toolchain")
2+
load("//third-party/rust/crates/winapi-i686-pc-windows-gnu/0.4.0:build.bzl", "get_rustc_flags")
3+
4+
# This rust_library is for winapi-i686-pc-windows-gnu import libraries
5+
# It implements the functionality from the original Cargo.toml and build.rs
6+
rust_library(
7+
name = "winapi-i686-pc-windows-gnu",
8+
# Using fixed edition as per requirements
9+
# Note: original Cargo.toml doesn't specify edition, defaulting to 2015
10+
edition = "2021",
11+
srcs = glob(["src/**/*.rs"]),
12+
crate_root = "src/lib.rs",
13+
features = [],
14+
# Conditionally add rustc flags based on target triple
15+
rustc_flags = get_rustc_flags(),
16+
# Add environment variable to control library bundling
17+
env = {
18+
# This can be overridden at build time
19+
"WINAPI_NO_BUNDLED_LIBRARIES": read_config("winapi", "no_bundled_libraries", ""),
20+
},
21+
deps = [],
22+
visibility = ["PUBLIC"],
23+
)

0 commit comments

Comments
 (0)