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

Commit 4e37447

Browse files
committed
Add winapi-x86_64-pc-windows-gnu
Signed-off-by: Eli Ma <eli@patch.sh>
1 parent 0755549 commit 4e37447

File tree

1,423 files changed

+1210
-0
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,423 files changed

+1210
-0
lines changed

BUCK

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ cargo.rust_binary(
1717
"//third-party/rust/crates/windows_aarch64_msvc/0.53.0:windows_aarch64_msvc",
1818
"//third-party/rust/crates/windows_aarch64_gnullvm/0.53.0:windows_aarch64_gnullvm",
1919
"//third-party/rust/crates/winapi-i686-pc-windows-gnu/0.4.0:winapi-i686-pc-windows-gnu",
20+
"//third-party/rust/crates/winapi-x86_64-pc-windows-gnu/0.4.0:winapi-x86_64-pc-windows-gnu",
2021
# ---
2122

2223
# autocfg
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-x86_64-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-x86_64-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+
)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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 = "winapi-x86_64-pc-windows-gnu"
15+
version = "0.4.0"
16+
authors = ["Peter Atashian <retep998@gmail.com>"]
17+
build = "build.rs"
18+
include = ["src/*", "lib/*", "Cargo.toml", "build.rs"]
19+
description = "Import libraries for the x86_64-pc-windows-gnu target. Please don't use this crate directly, depend on winapi instead."
20+
keywords = ["windows"]
21+
license = "MIT/Apache-2.0"
22+
repository = "https://github.com/retep998/winapi-rs"

third-party/rust/crates/winapi-x86_64-pc-windows-gnu/0.4.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: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
def get_rustc_flags():
2+
"""
3+
Determine rustc flags based on target platform.
4+
5+
This mimics the build.rs logic which only sets the library search path
6+
when the target is i686-pc-windows-gnu and WINAPI_NO_BUNDLED_LIBRARIES is not set.
7+
"""
8+
# Get target platform from config
9+
target = read_config("rust", "target", "")
10+
no_bundled = read_config("winapi", "no_bundled_libraries", "")
11+
12+
# Only add link search path for i686-pc-windows-gnu target
13+
# when WINAPI_NO_BUNDLED_LIBRARIES is not set
14+
if target == "i686-pc-windows-gnu" and no_bundled == "":
15+
return [
16+
"-L",
17+
"native=lib",
18+
]
19+
return []
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright © 2016-2018 winapi-rs developers
2+
// Licensed under the Apache License, Version 2.0
3+
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
4+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
5+
// All files in the project carrying such notice may not be copied, modified, or distributed
6+
// except according to those terms.
7+
fn main() {
8+
use std::env::var;
9+
use std::path::Path;
10+
println!("cargo:rerun-if-env-changed=WINAPI_NO_BUNDLED_LIBRARIES");
11+
if var("WINAPI_NO_BUNDLED_LIBRARIES").is_ok() {
12+
return;
13+
}
14+
if var("TARGET").map(|target| target == "x86_64-pc-windows-gnu").unwrap_or(false) {
15+
let dir = var("CARGO_MANIFEST_DIR").unwrap();
16+
println!("cargo:rustc-link-search=native={}", Path::new(&dir).join("lib").display());
17+
}
18+
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)