Collin Baker | 8cc20b86 | 2023-02-17 21:55:25 | [diff] [blame] | 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 | |
Collin Baker | 81e6574 | 2023-03-21 18:02:42 | [diff] [blame] | 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. |
| 11 | rustflags = ['-Zforce-unstable-if-unmarked'] |
| 12 | |
Collin Baker | 59d3fdf5 | 2023-03-24 14:36:30 | [diff] [blame] | 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 |
| 16 | output_dir = '$root_out_dir/local_rustc_sysroot/lib/rustlib/$rust_abi_target/lib/' |
| 17 | |
| 18 | # This target provides setup needed for building std. |
| 19 | extra_deps = ['//build/rust/std:std_build_deps'] |
| 20 | |
Collin Baker | 81e6574 | 2023-03-21 18:02:42 | [diff] [blame] | 21 | [crate.libc] |
Collin Baker | 8cc20b86 | 2023-02-17 21:55:25 | [diff] [blame] | 22 | # Requires: |
| 23 | # * cfg(libc_align) for new enough rustc, which is normally provided by build.rs |
| 24 | # but we don't run build scripts for std crates. |
| 25 | # * cfg(libc_priv_mod_use) is required for the below to work properly. |
| 26 | # * cfg(libc_core_cvoid) to use the same ffi c_void definition as libcore. |
| 27 | # |
| 28 | # See https://github.com/rust-lang/libc/blob/master/build.rs |
| 29 | cfg = ['libc_align', 'libc_priv_mod_use', 'libc_core_cvoid'] |
| 30 | |
Collin Baker | 81e6574 | 2023-03-21 18:02:42 | [diff] [blame] | 31 | [crate.std] |
Collin Baker | 8cc20b86 | 2023-02-17 21:55:25 | [diff] [blame] | 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 |
| 41 | cfg = ['backtrace_in_libstd'] |
| 42 | env = ['STD_ENV_ARCH=$rust_target_arch'] |
| 43 | |
Collin Baker | 81e6574 | 2023-03-21 18:02:42 | [diff] [blame] | 44 | [crate.test] |
Collin Baker | 8cc20b86 | 2023-02-17 21:55:25 | [diff] [blame] | 45 | # Requires: |
| 46 | # * CFG_DISABLE_UNSTABLE_FEATURES=0 to match how it's built by x.py. |
| 47 | env = ['CFG_DISABLE_UNSTABLE_FEATURES=0'] |