xref: /aosp_15_r20/external/angle/build/rust/std/BUILD.gn.hbs (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
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# @generated from build/rust/std/BUILD.gn.hbs by tools/crates/gnrt. Do not edit!
6
7import("//build/rust/cargo_crate.gni")
8
9{{#each rules}}
10{{#with this.detail}}
11cargo_crate("{{../name}}") {
12  crate_type = "{{crate_type}}"
13  crate_root = "{{crate_root}}"
14  sources = [
15    {{#each sources}}
16    "{{this}}",
17    {{/each}}
18  ]
19  inputs = [
20    {{#each inputs}}
21    "{{this}}",
22    {{/each}}
23  ]
24  no_std = true
25
26  # Unit tests skipped. Generate with --with-tests to include them.
27  build_native_rust_unit_tests = false
28  edition = "{{edition}}"
29  cargo_pkg_version = "{{cargo_pkg_version}}"
30  {{#with cargo_pkg_authors}}
31  cargo_pkg_authors = "{{this}}"
32  {{/with}}
33  cargo_pkg_name = "{{cargo_pkg_name}}"
34  {{#with cargo_pkg_description}}
35  cargo_pkg_description = "{{gn_escape this}}"
36  {{/with}}
37  library_configs -= [
38    "//build/config/compiler:chromium_code",
39    "//build/config/compiler:disallow_unstable_features",
40    {{#each remove_library_configs}}
41    "{{this}}",
42    {{/each}}
43    {{#unless extra_kv.include_coverage}}
44    "//build/config/coverage:default_coverage",
45    {{/unless}}
46  ]
47  library_configs += [
48    "//build/config/compiler:no_chromium_code",
49    {{#if extra_kv.immediate_abort}}
50    "//build/rust:panic_immediate_abort",
51    {{/if}}
52  ]
53  executable_configs -= [
54    "//build/config/compiler:chromium_code",
55    "//build/config/compiler:disallow_unstable_features",
56    {{#each remove_executable_configs}}
57    "{{this}}",
58    {{/each}}
59  ]
60  executable_configs += [
61    "//build/config/compiler:no_chromium_code",
62    {{#each add_executable_configs}}
63    "{{this}}",
64    {{/each}}
65  ]
66  deps = [
67    "//build/rust/std:std_build_deps",
68    {{#if extra_kv.include_coverage}}
69    "//build/rust/std:profiler_builtins_group",
70    {{/if}}
71  {{#unless deps}}
72  ]
73  {{/unless}}
74  {{#each deps}}
75  {{#if @first}}
76    {{#each this.packages}}
77    ":{{this.name}}",
78    {{/each}}
79  ]
80  {{else}}
81  if ({{this.cond}}) {
82    deps += [
83      {{#each this.packages}}
84      ":{{this.name}}",
85      {{/each}}
86    ]
87  }
88  {{/if}}
89  {{/each}}
90  {{#if aliased_deps}}
91  aliased_deps = {
92    {{#each aliased_deps}}
93    {{this.0}} = "{{this.1}}"
94    {{/each}}
95  }
96  {{/if}}
97  {{#if features}}
98  features = [
99    {{#each features}}
100    "{{this}}",
101    {{/each}}
102  ]
103  {{/if}}
104  {{#unless extra_kv.skip_build_rs}}
105  {{#if build_root}}
106  build_root = "{{build_root}}"
107  build_sources = [
108    {{#each build_script_sources}}
109    "{{this}}",
110    {{/each}}
111  ]
112  {{#with build_script_inputs}}
113  build_script_inputs = [
114    {{#each this}}
115    "{{this}}",
116    {{/each}}
117  ]
118  {{/with}}
119  {{#with build_script_outputs}}
120  build_script_outputs = [
121    {{#each this}}
122    "{{this}}",
123    {{/each}}
124  ]
125  {{/with}}
126  {{#each build_deps}}
127  {{#if @first}}
128  build_deps = [
129    {{#each this.packages}}
130      ":{{this.name}}",
131    {{/each}}
132  ]
133  {{else}}
134  if ({{this.cond}}) {
135    build_deps += [
136    {{#each this.packages}}
137      ":{{this.name}}",
138    {{/each}}
139    ]
140  }
141  {{/if}}
142  {{/each}}
143  {{/if}}
144  {{/unless}}
145  rustenv = [
146    "CFG_DISABLE_UNSTABLE_FEATURES=0",
147    "STD_ENV_ARCH=$rust_target_arch",
148  ]
149  rustflags = [
150    "--cfg=backtrace_in_libstd",
151    "-Zforce-unstable-if-unmarked",
152    {{#if extra_kv.no_link_directives}}
153    "-Zlink-directives=false",
154    {{/if}}
155  ]
156  output_dir = "$root_out_dir/local_rustc_sysroot/lib/rustlib/$rust_abi_target/lib/"
157
158  {{#with extra_kv.raw_gn}}
159  {{this}}
160  {{/with}}
161  {{/with}}
162}
163{{/each}}
164