1// Sysroot Libraries 2package { 3 default_applicable_licenses: ["prebuilts_rust_license"], 4} 5 6// Added automatically by a large-scale-change that took the approach of 7// 'apply every license found to every target'. While this makes sure we respect 8// every license restriction, it may not be entirely correct. 9// 10// e.g. GPL in an MIT project might only apply to the contrib/ directory. 11// 12// Please consider splitting the single license below into multiple licenses, 13// taking care not to lose any license_kind information, and overriding the 14// default license using the 'licenses: [...]' property on targets as needed. 15// 16// For unused files, consider creating a 'fileGroup' with "//visibility:private" 17// to attach the license to, and including a comment whether the files may be 18// used in the current project. 19// See: http://go/android-license-faq 20license { 21 name: "prebuilts_rust_license", 22 visibility: [":__subpackages__"], 23 license_kinds: [ 24 "SPDX-license-identifier-Apache-2.0", 25 "SPDX-license-identifier-BSD", 26 "SPDX-license-identifier-GPL", 27 "SPDX-license-identifier-GPL-2.0", 28 "SPDX-license-identifier-GPL-3.0", 29 "SPDX-license-identifier-LGPL", 30 "SPDX-license-identifier-MIT", 31 "SPDX-license-identifier-NCSA", 32 "SPDX-license-identifier-OpenSSL", 33 "legacy_notice", 34 "legacy_permissive", 35 "legacy_unencumbered", 36 ], 37 // large-scale-change unable to identify any license_text files 38} 39 40rust_stdlib_prebuilt_host { 41 name: "libstd", 42 crate_name: "std", 43 sysroot: true, 44} 45 46// stdlibs source path relative to toolchain root 47stdlibs_src_path = "src/stdlibs" 48 49// The basic crates are only available as static libraries 50// .rust_sysroot is appended to the name to prevent accidental direct usage 51// of these crates by user code. 52// The most likely place for this to occur would be liblibc. 53rust_defaults { 54 name: "rust_sysroot_defaults", 55 no_stdlibs: true, 56 edition: "2021", 57 native_coverage: false, 58 host_supported: true, 59 sysroot: true, 60 native_bridge_supported: true, 61 product_available: true, 62 ramdisk_available: true, 63 recovery_available: true, 64 vendor_available: true, 65 vendor_ramdisk_available: true, 66 apex_available: [ 67 "//apex_available:platform", 68 "//apex_available:anyapex", 69 ], 70 target: { 71 glibc: { 72 enabled: false, 73 }, 74 darwin_x86_64: { 75 enabled: false, 76 }, 77 darwin_arm64: { 78 enabled: true, 79 }, 80 musl: { 81 enabled: false, 82 }, 83 musl_arm64: { 84 enabled: true, 85 }, 86 }, 87 min_sdk_version: "29", 88} 89 90rust_toolchain_library_rlib { 91 name: "libcore.rust_sysroot", 92 defaults: ["rust_sysroot_defaults"], 93 crate_name: "core", 94 toolchain_crate_root: stdlibs_src_path + "/library/core/src/lib.rs", 95 toolchain_srcs: [ 96 stdlibs_src_path + "/library/core/src/**/*.rs", 97 stdlibs_src_path + "/library/core/src/**/*.md", 98 stdlibs_src_path + "/library/core/primitive_docs/*.md", 99 stdlibs_src_path + "/library/stdarch/crates/core_arch/src/**/*.rs", 100 stdlibs_src_path + "/library/stdarch/crates/core_arch/src/**/*.md", 101 stdlibs_src_path + "/library/portable-simd/crates/core_simd/src/**/*.rs", 102 stdlibs_src_path + "/library/portable-simd/crates/core_simd/src/**/*.md", 103 ], 104 sanitize: { 105 never: true, 106 }, 107 edition: "2021", 108} 109 110rust_toolchain_library_rlib { 111 name: "librustc_demangle.rust_sysroot", 112 defaults: ["rust_sysroot_defaults"], 113 crate_name: "rustc_demangle", 114 toolchain_crate_root: stdlibs_src_path + "/vendor/rustc-demangle/src/lib.rs", 115 toolchain_srcs: [ 116 stdlibs_src_path + "/vendor/rustc-demangle/src/**/*.rs", 117 stdlibs_src_path + "/vendor/rustc-demangle/src/**/*.md", 118 ], 119 features: [ 120 "core", 121 "compiler_builtins", 122 ], 123 rlibs: [ 124 "libcompiler_builtins.rust_sysroot", 125 "libcore.rust_sysroot", 126 ], 127 edition: "2015", 128} 129 130rust_toolchain_library_rlib { 131 name: "libcompiler_builtins.rust_sysroot", 132 defaults: ["rust_sysroot_defaults"], 133 crate_name: "compiler_builtins", 134 features: [ 135 "compiler-builtins", 136 "core", 137 "default", 138 "weak-intrinsics", 139 ], 140 toolchain_crate_root: stdlibs_src_path + "/vendor/compiler_builtins/src/lib.rs", 141 toolchain_srcs: [ 142 stdlibs_src_path + "/vendor/compiler_builtins/src/**/*.rs", 143 stdlibs_src_path + "/vendor/compiler_builtins/src/**/*.md", 144 ], 145 rlibs: ["libcore.rust_sysroot"], 146 flags: [ 147 "-C", 148 "panic=abort", 149 "-C", 150 "overflow-checks=off", 151 ], 152 edition: "2018", 153} 154 155rust_toolchain_library_rlib { 156 name: "liblibc.rust_sysroot", 157 defaults: ["rust_sysroot_defaults"], 158 crate_name: "libc", 159 features: ["align"], 160 toolchain_crate_root: stdlibs_src_path + "/vendor/libc/src/lib.rs", 161 toolchain_srcs: [ 162 stdlibs_src_path + "/vendor/libc/src/**/*.rs", 163 stdlibs_src_path + "/vendor/libc/src/**/*.md", 164 ], 165 rlibs: [ 166 "libcompiler_builtins.rust_sysroot", 167 "libcore.rust_sysroot", 168 ], 169 // Generated via build.rs autodetect on compiler version. May need to be 170 // regenerated on compiler version bump. 171 cfgs: [ 172 "freebsd11", 173 "libc_priv_mod_use", 174 "libc_union", 175 "libc_const_size_of", 176 "libc_align", 177 "libc_core_cvoid", 178 "libc_packedN", 179 "libc_thread_local", 180 "libc_const_extern_fn", 181 ], 182 edition: "2015", 183} 184 185rust_toolchain_library_rlib { 186 name: "liballoc.rust_sysroot", 187 defaults: ["rust_sysroot_defaults"], 188 crate_name: "alloc", 189 toolchain_crate_root: stdlibs_src_path + "/library/alloc/src/lib.rs", 190 toolchain_srcs: [ 191 stdlibs_src_path + "/library/alloc/src/**/*.rs", 192 stdlibs_src_path + "/library/alloc/src/**/*.md", 193 ], 194 features: ["compiler-builtins-weak-intrinsics"], 195 rlibs: [ 196 "libcompiler_builtins.rust_sysroot", 197 "libcore.rust_sysroot", 198 ], 199 edition: "2021", 200} 201 202rust_toolchain_library_rlib { 203 name: "libcfg_if.rust_sysroot", 204 defaults: ["rust_sysroot_defaults"], 205 crate_name: "cfg_if", 206 features: [ 207 "compiler_builtins", 208 "core", 209 ], 210 toolchain_crate_root: stdlibs_src_path + "/vendor/cfg-if/src/lib.rs", 211 toolchain_srcs: [ 212 stdlibs_src_path + "/vendor/cfg-if/src/**/*.rs", 213 stdlibs_src_path + "/vendor/cfg-if/src/**/*.md", 214 ], 215 rlibs: [ 216 "libcompiler_builtins.rust_sysroot", 217 "libcore.rust_sysroot", 218 ], 219 edition: "2018", 220} 221 222rust_toolchain_library_rlib { 223 name: "libstd_detect.rust_sysroot", 224 defaults: ["rust_sysroot_defaults"], 225 crate_name: "std_detect", 226 features: [ 227 "std_detect_file_io", 228 "std_detect_dlsym_getauxval", 229 ], 230 toolchain_crate_root: stdlibs_src_path + "/library/stdarch/crates/std_detect/src/lib.rs", 231 toolchain_srcs: [ 232 stdlibs_src_path + "/library/stdarch/crates/std_detect/src/**/*.rs", 233 stdlibs_src_path + "/library/stdarch/crates/std_detect/src/**/*.md", 234 ], 235 rlibs: [ 236 "libcompiler_builtins.rust_sysroot", 237 "libcore.rust_sysroot", 238 "liballoc.rust_sysroot", 239 "libcfg_if.rust_sysroot", 240 ], 241} 242 243rust_toolchain_library_rlib { 244 name: "libpanic_abort.rust_sysroot", 245 defaults: ["rust_sysroot_defaults"], 246 crate_name: "panic_abort", 247 toolchain_crate_root: stdlibs_src_path + "/library/panic_abort/src/lib.rs", 248 toolchain_srcs: [ 249 stdlibs_src_path + "/library/panic_abort/src/**/*.rs", 250 stdlibs_src_path + "/library/panic_abort/src/**/*.md", 251 ], 252 rlibs: [ 253 "liballoc.rust_sysroot", 254 "libcompiler_builtins.rust_sysroot", 255 "libcore.rust_sysroot", 256 "libcfg_if.rust_sysroot", 257 "liblibc.rust_sysroot", 258 ], 259 flags: ["-C panic=abort"], 260} 261 262rust_toolchain_library_rlib { 263 name: "libpanic_unwind.rust_sysroot", 264 defaults: ["rust_sysroot_defaults"], 265 crate_name: "panic_unwind", 266 toolchain_crate_root: stdlibs_src_path + "/library/panic_unwind/src/lib.rs", 267 toolchain_srcs: [ 268 stdlibs_src_path + "/library/panic_unwind/src/**/*.rs", 269 stdlibs_src_path + "/library/panic_unwind/src/**/*.md", 270 ], 271 rlibs: [ 272 "liballoc.rust_sysroot", 273 "libcore.rust_sysroot", 274 "liblibc.rust_sysroot", 275 "libunwind.rust_sysroot", 276 "libcompiler_builtins.rust_sysroot", 277 "libcfg_if.rust_sysroot", 278 ], 279} 280 281rust_toolchain_library_rlib { 282 name: "libunwind.rust_sysroot", 283 defaults: ["rust_sysroot_defaults"], 284 crate_name: "unwind", 285 toolchain_crate_root: stdlibs_src_path + "/library/unwind/src/lib.rs", 286 toolchain_srcs: [ 287 stdlibs_src_path + "/library/unwind/src/**/*.rs", 288 stdlibs_src_path + "/library/unwind/src/**/*.md", 289 ], 290 rlibs: [ 291 "libcompiler_builtins.rust_sysroot", 292 "libcore.rust_sysroot", 293 "liblibc.rust_sysroot", 294 "libcfg_if.rust_sysroot", 295 ], 296} 297 298rust_toolchain_library_rlib { 299 name: "libhashbrown.rust_sysroot", 300 defaults: ["rust_sysroot_defaults"], 301 edition: "2021", 302 crate_name: "hashbrown", 303 toolchain_crate_root: stdlibs_src_path + "/vendor/hashbrown/src/lib.rs", 304 toolchain_srcs: [ 305 stdlibs_src_path + "/vendor/hashbrown/src/**/*.rs", 306 stdlibs_src_path + "/vendor/hashbrown/src/**/*.md", 307 ], 308 features: [ 309 "alloc", 310 "compiler_builtins", 311 "core", 312 "nightly", 313 "rustc-dep-of-std", 314 "rustc-internal-api", 315 ], 316 cfgs: ["has_extern_crate_alloc"], 317 rlibs: [ 318 "libcore.rust_sysroot", 319 "libcompiler_builtins.rust_sysroot", 320 "liballoc.rust_sysroot", 321 "libunwind.rust_sysroot", 322 ], 323} 324 325// Top level sysroot libraries are available both as static and dynamic 326rust_toolchain_library { 327 name: "libstd", 328 defaults: ["rust_sysroot_defaults"], 329 crate_name: "std", 330 target: { 331 linux_bionic: { 332 rlibs: ["libpanic_abort.rust_sysroot"], 333 }, 334 linux_musl: { 335 rlibs: [ 336 "libpanic_abort.rust_sysroot", 337 "libpanic_unwind.rust_sysroot", 338 ], 339 }, 340 android: { 341 rlibs: ["libpanic_abort.rust_sysroot"], 342 }, 343 }, 344 toolchain_crate_root: stdlibs_src_path + "/library/std/src/lib.rs", 345 toolchain_srcs: [ 346 stdlibs_src_path + "/library/std/src/**/*.rs", 347 stdlibs_src_path + "/library/std/src/**/*.md", 348 stdlibs_src_path + "/library/std/primitive_docs/*.md", 349 stdlibs_src_path + "/library/core/src/**/*.md", 350 stdlibs_src_path + "/library/backtrace/src/**/*.rs", 351 stdlibs_src_path + "/library/backtrace/src/**/*.md", 352 stdlibs_src_path + "/library/portable-simd/crates/std_float/src/**/*.rs", 353 stdlibs_src_path + "/library/portable-simd/crates/std_float/src/**/*.md", 354 stdlibs_src_path + "/library/stdarch/crates/core_arch/src/**/*.md", 355 stdlibs_src_path + "/library/stdarch/crates/core_simd/src/**/*.md", 356 stdlibs_src_path + "/library/portable-simd/crates/core_simd/src/**/*.md", 357 ], 358 cfgs: ["backtrace_in_libstd"], 359 features: [ 360 "default", 361 "std_detect_dlsym_getauxval", 362 "std_detect_file_io", 363 "profiler", 364 "compiler-builtins-weak-intrinsics", 365 ], 366 rlibs: [ 367 "libcompiler_builtins.rust_sysroot", 368 "libcore.rust_sysroot", 369 "librustc_demangle.rust_sysroot", 370 "liblibc.rust_sysroot", 371 "libcfg_if.rust_sysroot", 372 "liballoc.rust_sysroot", 373 "libhashbrown.rust_sysroot", 374 "libunwind.rust_sysroot", 375 "libprofiler_builtins.rust_sysroot", 376 "libstd_detect.rust_sysroot", 377 ], 378} 379 380rust_toolchain_library_rlib { 381 name: "libprofiler_builtins.rust_sysroot", 382 defaults: ["rust_sysroot_defaults"], 383 crate_name: "profiler_builtins", 384 toolchain_crate_root: stdlibs_src_path + "/library/profiler_builtins/src/lib.rs", 385 toolchain_srcs: [ 386 stdlibs_src_path + "/library/profiler_builtins/src/**/*.rs", 387 stdlibs_src_path + "/library/profiler_builtins/src/**/*.md", 388 ], 389 rlibs: [ 390 "libcompiler_builtins.rust_sysroot", 391 "libcore.rust_sysroot", 392 ], 393} 394 395rust_toolchain_library { 396 name: "libgetopts", 397 host_supported: true, 398 vendor_available: true, 399 product_available: true, 400 crate_name: "getopts", 401 toolchain_crate_root: stdlibs_src_path + "/vendor/getopts/src/lib.rs", 402 toolchain_srcs: [ 403 stdlibs_src_path + "/vendor/getopts/src/**/*.rs", 404 stdlibs_src_path + "/vendor/getopts/src/**/*.md", 405 ], 406 rlibs: ["libunicode_width.rust_toolchain"], 407 edition: "2015", 408 apex_available: [ 409 "//apex_available:platform", 410 "com.android.virt", 411 ], 412} 413 414rust_toolchain_library { 415 name: "libtest", 416 crate_name: "test", 417 host_supported: true, 418 vendor_available: true, 419 product_available: true, 420 toolchain_crate_root: stdlibs_src_path + "/library/test/src/lib.rs", 421 toolchain_srcs: [ 422 stdlibs_src_path + "/library/test/src/**/*.rs", 423 stdlibs_src_path + "/library/test/src/**/*.md", 424 ], 425 rlibs: [ 426 "liblibc.rust_toolchain", 427 "libcfg_if.rust_toolchain", 428 "libgetopts", 429 ], 430} 431 432rust_toolchain_library_rlib { 433 name: "libunicode_width.rust_toolchain", 434 host_supported: true, 435 vendor_available: true, 436 product_available: true, 437 crate_name: "unicode_width", 438 toolchain_crate_root: stdlibs_src_path + "/vendor/unicode-width/src/lib.rs", 439 toolchain_srcs: [ 440 stdlibs_src_path + "/vendor/unicode-width/src/**/*.rs", 441 stdlibs_src_path + "/vendor/unicode-width/src/**/*.md", 442 ], 443 edition: "2015", 444 apex_available: [ 445 "//apex_available:platform", 446 "com.android.virt", 447 ], 448} 449 450rust_toolchain_library_rlib { 451 name: "libcfg_if.rust_toolchain", 452 crate_name: "cfg_if", 453 host_supported: true, 454 vendor_available: true, 455 product_available: true, 456 toolchain_crate_root: stdlibs_src_path + "/vendor/cfg-if/src/lib.rs", 457 toolchain_srcs: [ 458 stdlibs_src_path + "/vendor/cfg-if/src/**/*.rs", 459 stdlibs_src_path + "/vendor/cfg-if/src/**/*.md", 460 ], 461} 462 463rust_toolchain_library_rlib { 464 name: "liblibc.rust_toolchain", 465 crate_name: "libc", 466 host_supported: true, 467 vendor_available: true, 468 product_available: true, 469 toolchain_crate_root: stdlibs_src_path + "/vendor/libc/src/lib.rs", 470 toolchain_srcs: [ 471 stdlibs_src_path + "/vendor/libc/src/**/*.rs", 472 stdlibs_src_path + "/vendor/libc/src/**/*.md", 473 ], 474 cfgs: [ 475 "freebsd11", 476 "libc_priv_mod_use", 477 "libc_union", 478 "libc_const_size_of", 479 "libc_align", 480 "libc_core_cvoid", 481 "libc_packedN", 482 "libc_thread_local", 483 ], 484 features: [ 485 "std", 486 "align", 487 ], 488 edition: "2015", 489} 490 491// Rustc and Clang have mismatched LLVM versions, cross language LTO may break when LLVM bitcode 492// format changes. Disallow LTO until we can synchronise the versions. http://b/240643019 493cc_defaults { 494 name: "rust_static_cc_lib_defaults", 495 visibility: ["//visibility:public"], 496 lto: { 497 never: true, 498 }, 499} 500 501rust_stdlib_prebuilt_filegroup_host { 502 name: "stdlib_prebuilts", 503 srcs: [ 504 "**/*.rlib", 505 "**/*.a", 506 "**/*.so", 507 "**/*.dylib", 508 ], 509 visibility: ["//visibility:private"], 510} 511 512rust_toolchain_rustc_prebuilt { 513 name: "rustc", 514 toolchain_prebuilt_src: "bin/rustc", 515 toolchain_deps: [ 516 "lib/*", 517 "lib64/*", 518 ], 519 deps: [ 520 ":gcc.lib", 521 ":gcc.lib32", 522 ":gcc.lib64", 523 ":gcc.sysroot", 524 ":stdlib_prebuilts", 525 ], 526} 527 528rust_toolchain_rustc_prebuilt { 529 name: "clippy-driver", 530 toolchain_prebuilt_src: "bin/clippy-driver", 531} 532 533rust_toolchain_rustc_prebuilt { 534 name: "rustdoc", 535 toolchain_prebuilt_src: "bin/rustdoc", 536} 537 538dirgroup { 539 name: "trusty_dirgroup_prebuilts_rust", 540 dirs: ["."], 541 visibility: ["//trusty/vendor/google/aosp/scripts"], 542} 543