| # 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_deps = ['//build/rust/std:std_build_deps'] |
| |
| [crate.libc] |
| # Requires: |
| # * cfg(libc_align) for new enough rustc, which is normally provided by build.rs |
| # but we don't run build scripts for std crates. |
| # * cfg(libc_priv_mod_use) is required for the below to work properly. |
| # * cfg(libc_core_cvoid) to use the same ffi c_void definition as libcore. |
| # |
| # See https://github.com/rust-lang/libc/blob/master/build.rs |
| cfg = ['libc_align', 'libc_priv_mod_use', 'libc_core_cvoid'] |
| |
| [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'] |