# Copyright 2023 The Chromium Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # Provides per-crate and overall configuration options to gnrt. [all] # force-unstable-if-unmarked prevents normal crates from inadvertently using # symbols from std-internal dependencies in the sysroot. This is normally passed # during an x.py build, but we have to do it manually. rustflags = ['-Zforce-unstable-if-unmarked'] # Override the GN output dir. We direct std targets to output directly to the # sysroot we'll use later. This must stay in sync with `local_rustc_sysroot` in # //build/rust/std/BUILD.gn output_dir = '$root_out_dir/local_rustc_sysroot/lib/rustlib/$rust_abi_target/lib/' # This target provides setup needed for building std. extra_gn_deps = ['//build/rust/std:std_build_deps'] [crate.libc] # Many flags are set by libc's build.rs based on new enough rustc but we don't # run build scripts for std crates. # See https://github.com/rust-lang/libc/blob/master/build.rs cfg = ['libc_priv_mod_use', 'libc_union', 'libc_const_size_of', 'libc_align', 'libc_int128', 'libc_core_cvoid', 'libc_packedN', 'libc_cfg_target_vendor', 'libc_non_exhaustive', 'libc_long_array', 'libc_ptr_addr_of', 'libc_underscore_const_names', 'libc_const_extern_fn' ] [crate.std] # Requires: # * cfg(backtrace_in_libstd) because it directly includes .rs files from the # backtrace code rather than including it as a dependency. backtrace's # implementation has special-purpose code to handle this. # * STD_ENV_ARCH is referenced in architecture-dependent code. Note this is the # target arch, and as such `$rust_target_arch` is passed literally to GN. This # variable is set at build time in build/config/rust.gni # # See https://github.com/rust-lang/rust/blob/master/library/std/build.rs cfg = ['backtrace_in_libstd'] env = ['STD_ENV_ARCH=$rust_target_arch'] [crate.test] # Requires: # * CFG_DISABLE_UNSTABLE_FEATURES=0 to match how it's built by x.py. env = ['CFG_DISABLE_UNSTABLE_FEATURES=0'] # test only depends on proc_macro as an internal detail of the Rust build, so # it's implicitly included with std/test. However, we list the std crates and # construct the sysroot explicitly. We don't need this, and we don't even want # it during cross-compiles (since we will only build host proc_macro crates). exclude_deps_in_gn = ['proc_macro'] [crate.unwind] # The unwind crate has #[link] directives to the native unwind library, but we # either get that automatically by linking with clang++, or build and link the # lib from //buildtools/third_party/libunsind explicitly. Disable -lfoo linker # flags from this crate. rustflags = ['-Zlink-directives=false']