| RUSTC_EFI_FLAGS = [ |
| # Disable generation of PDB file to make build reproducible. Otherwise, |
| # the PDB file contains a non-deterministic path like |
| # /tmp/rustc0VgeF3/symbols.o, and the binary contains a hash of the PDB |
| # file. See https://github.com/rust-lang/rust/issues/112587 |
| "-Clink-arg=/DEBUG:none", |
| ] |
| |
| rust = use_extension("@rules_rust//rust:extensions.bzl", "rust") |
| rust.toolchain( |
| edition = "2021", |
| extra_rustc_flags_triples = { |
| "x86_64-unknown-uefi": RUSTC_EFI_FLAGS, |
| "aarch64-unknown-uefi": RUSTC_EFI_FLAGS, |
| }, |
| extra_target_triples = [ |
| "x86_64-unknown-uefi", |
| "aarch64-unknown-uefi", |
| ], |
| versions = ["1.82.0"], |
| ) |
| use_repo(rust, "rust_toolchains") |
| |
| crate = use_extension("@rules_rust//crate_universe:extension.bzl", "crate") |
| crate.from_cargo( |
| name = "crate_index", |
| cargo_lockfile = "//third_party/rust:Cargo.lock", |
| generate_binaries = True, |
| manifests = ["//third_party/rust:Cargo.toml"], |
| supported_platform_triples = [ |
| "x86_64-unknown-linux-gnu", |
| ], |
| ) |
| crate.from_cargo( |
| name = "crate_index_efi", |
| cargo_lockfile = "//third_party/rust_efi:Cargo.lock", |
| generate_binaries = True, |
| manifests = ["//third_party/rust_efi:Cargo.toml"], |
| supported_platform_triples = [ |
| "x86_64-unknown-linux-gnu", |
| "x86_64-unknown-uefi", |
| "aarch64-unknown-uefi", |
| ], |
| ) |
| use_repo( |
| crate, |
| "crate_index", |
| "crate_index_efi", |
| ) |