• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2023 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5# Provides per-crate and overall configuration options to gnrt.
6
7[all]
8# force-unstable-if-unmarked prevents normal crates from inadvertently using
9# symbols from std-internal dependencies in the sysroot. This is normally passed
10# during an x.py build, but we have to do it manually.
11rustflags = ['-Zforce-unstable-if-unmarked']
12
13# Override the GN output dir. We direct std targets to output directly to the
14# sysroot we'll use later. This must stay in sync with `local_rustc_sysroot` in
15# //build/rust/std/BUILD.gn
16output_dir = '$root_out_dir/local_rustc_sysroot/lib/rustlib/$rust_abi_target/lib/'
17
18# This target provides setup needed for building std.
19extra_gn_deps = ['//build/rust/std:std_build_deps']
20
21[crate.libc]
22# Many flags are set by libc's build.rs based on new enough rustc but we don't
23# run build scripts for std crates.
24# See https://github.com/rust-lang/libc/blob/master/build.rs
25cfg = ['libc_priv_mod_use', 'libc_union', 'libc_const_size_of', 'libc_align',
26'libc_int128', 'libc_core_cvoid', 'libc_packedN', 'libc_cfg_target_vendor',
27'libc_non_exhaustive', 'libc_long_array', 'libc_ptr_addr_of',
28'libc_underscore_const_names', 'libc_const_extern_fn'
29]
30
31[crate.std]
32# Requires:
33# * cfg(backtrace_in_libstd) because it directly includes .rs files from the
34#   backtrace code rather than including it as a dependency. backtrace's
35#   implementation has special-purpose code to handle this.
36# * STD_ENV_ARCH is referenced in architecture-dependent code. Note this is the
37#   target arch, and as such `$rust_target_arch` is passed literally to GN. This
38#   variable is set at build time in build/config/rust.gni
39#
40# See https://github.com/rust-lang/rust/blob/master/library/std/build.rs
41cfg = ['backtrace_in_libstd']
42env = ['STD_ENV_ARCH=$rust_target_arch']
43
44[crate.test]
45# Requires:
46# * CFG_DISABLE_UNSTABLE_FEATURES=0 to match how it's built by x.py.
47env = ['CFG_DISABLE_UNSTABLE_FEATURES=0']
48
49# test only depends on proc_macro as an internal detail of the Rust build, so
50# it's implicitly included with std/test. However, we list the std crates and
51# construct the sysroot explicitly. We don't need this, and we don't even want
52# it during cross-compiles (since we will only build host proc_macro crates).
53exclude_deps_in_gn = ['proc_macro']
54
55[crate.unwind]
56# The unwind crate has #[link] directives to the native unwind library, but we
57# either get that automatically by linking with clang++, or build and link the
58# lib from //buildtools/third_party/libunsind explicitly. Disable -lfoo linker
59# flags from this crate.
60rustflags = ['-Zlink-directives=false']
61