blob: a5187a0e75fedc16f9db04b21914df766aa099c3 [file] [log] [blame]
// Sysroot Libraries
package {
default_applicable_licenses: ["prebuilts_rust_license"],
}
// Added automatically by a large-scale-change that took the approach of
// 'apply every license found to every target'. While this makes sure we respect
// every license restriction, it may not be entirely correct.
//
// e.g. GPL in an MIT project might only apply to the contrib/ directory.
//
// Please consider splitting the single license below into multiple licenses,
// taking care not to lose any license_kind information, and overriding the
// default license using the 'licenses: [...]' property on targets as needed.
//
// For unused files, consider creating a 'fileGroup' with "//visibility:private"
// to attach the license to, and including a comment whether the files may be
// used in the current project.
// See: http://go/android-license-faq
license {
name: "prebuilts_rust_license",
visibility: [":__subpackages__"],
license_kinds: [
"SPDX-license-identifier-Apache-2.0",
"SPDX-license-identifier-BSD",
"SPDX-license-identifier-GPL",
"SPDX-license-identifier-GPL-2.0",
"SPDX-license-identifier-GPL-3.0",
"SPDX-license-identifier-LGPL",
"SPDX-license-identifier-MIT",
"SPDX-license-identifier-NCSA",
"SPDX-license-identifier-OpenSSL",
"legacy_notice",
"legacy_permissive",
"legacy_unencumbered",
],
// large-scale-change unable to identify any license_text files
}
rust_stdlib_prebuilt_host {
name: "libstd",
crate_name: "std",
sysroot: true,
}
// stdlibs source path relative to toolchain root
stdlibs_src_path = "src/stdlibs"
// The basic crates are only available as static libraries
// .rust_sysroot is appended to the name to prevent accidental direct usage
// of these crates by user code.
// The most likely place for this to occur would be liblibc.
rust_defaults {
name: "rust_sysroot_defaults",
no_stdlibs: true,
edition: "2018",
native_coverage: false,
host_supported: true,
sysroot: true,
native_bridge_supported: true,
product_available: true,
ramdisk_available: true,
recovery_available: true,
vendor_available: true,
vendor_ramdisk_available: true,
apex_available: [
"//apex_available:platform",
"//apex_available:anyapex",
],
target: {
glibc: {
enabled: false,
},
darwin: {
enabled: false,
},
},
min_sdk_version: "29",
}
rust_toolchain_library_rlib {
name: "libcore.rust_sysroot",
defaults: ["rust_sysroot_defaults"],
crate_name: "core",
toolchain_src: stdlibs_src_path + "/library/core/src/lib.rs",
sanitize: {
never: true,
},
edition: "2021",
}
rust_toolchain_library_rlib {
name: "librustc_demangle.rust_sysroot",
defaults: ["rust_sysroot_defaults"],
crate_name: "rustc_demangle",
toolchain_src: stdlibs_src_path + "/vendor/rustc-demangle/src/lib.rs",
features: [
"core",
"compiler_builtins",
],
rlibs: [
"libcompiler_builtins.rust_sysroot",
"libcore.rust_sysroot",
],
edition: "2015",
}
rust_toolchain_library_rlib {
name: "libcompiler_builtins.rust_sysroot",
defaults: ["rust_sysroot_defaults"],
crate_name: "compiler_builtins",
features: [
"compiler-builtins",
"core",
"default",
],
toolchain_src: stdlibs_src_path + "/vendor/compiler_builtins/src/lib.rs",
rlibs: ["libcore.rust_sysroot"],
flags: [
"-C",
"panic=abort",
"-C",
"overflow-checks=off",
],
edition: "2015",
}
rust_toolchain_library_rlib {
name: "liblibc.rust_sysroot",
defaults: ["rust_sysroot_defaults"],
crate_name: "libc",
features: ["align"],
toolchain_src: stdlibs_src_path + "/vendor/libc/src/lib.rs",
rlibs: [
"libcompiler_builtins.rust_sysroot",
"libcore.rust_sysroot",
],
// Generated via build.rs autodetect on compiler version. May need to be
// regenerated on compiler version bump.
cfgs: [
"freebsd11",
"libc_priv_mod_use",
"libc_union",
"libc_const_size_of",
"libc_align",
"libc_core_cvoid",
"libc_packedN",
"libc_thread_local",
],
edition: "2015",
}
rust_toolchain_library_rlib {
name: "liballoc.rust_sysroot",
defaults: ["rust_sysroot_defaults"],
crate_name: "alloc",
toolchain_src: stdlibs_src_path + "/library/alloc/src/lib.rs",
rlibs: [
"libcompiler_builtins.rust_sysroot",
"libcore.rust_sysroot",
],
edition: "2021",
}
rust_toolchain_library_rlib {
name: "libcfg_if.rust_sysroot",
defaults: ["rust_sysroot_defaults"],
crate_name: "cfg_if",
features: [
"compiler_builtins",
"core",
],
toolchain_src: stdlibs_src_path + "/vendor/cfg-if/src/lib.rs",
rlibs: [
"libcompiler_builtins.rust_sysroot",
"libcore.rust_sysroot",
],
}
rust_toolchain_library_rlib {
name: "libstd_detect.rust_sysroot",
defaults: ["rust_sysroot_defaults"],
crate_name: "std_detect",
features: [
"std_detect_file_io",
"std_detect_dlsym_getauxval",
],
toolchain_src: stdlibs_src_path + "/library/stdarch/crates/std_detect/src/lib.rs",
rlibs: [
"libcompiler_builtins.rust_sysroot",
"libcore.rust_sysroot",
"liballoc.rust_sysroot",
"libcfg_if.rust_sysroot",
],
}
rust_toolchain_library_rlib {
name: "libpanic_abort.rust_sysroot",
defaults: ["rust_sysroot_defaults"],
crate_name: "panic_abort",
toolchain_src: stdlibs_src_path + "/library/panic_abort/src/lib.rs",
rlibs: [
"liballoc.rust_sysroot",
"libcompiler_builtins.rust_sysroot",
"libcore.rust_sysroot",
"libcfg_if.rust_sysroot",
"liblibc.rust_sysroot",
],
}
rust_toolchain_library_rlib {
name: "libpanic_unwind.rust_sysroot",
defaults: ["rust_sysroot_defaults"],
crate_name: "panic_unwind",
toolchain_src: stdlibs_src_path + "/library/panic_unwind/src/lib.rs",
rlibs: [
"liballoc.rust_sysroot",
"libcore.rust_sysroot",
"liblibc.rust_sysroot",
"libunwind.rust_sysroot",
"libcompiler_builtins.rust_sysroot",
"libcfg_if.rust_sysroot",
],
}
rust_toolchain_library_rlib {
name: "libunwind.rust_sysroot",
defaults: ["rust_sysroot_defaults"],
crate_name: "unwind",
toolchain_src: stdlibs_src_path + "/library/unwind/src/lib.rs",
rlibs: [
"libcompiler_builtins.rust_sysroot",
"libcore.rust_sysroot",
"liblibc.rust_sysroot",
"libcfg_if.rust_sysroot",
],
}
rust_toolchain_library_rlib {
name: "libhashbrown.rust_sysroot",
defaults: ["rust_sysroot_defaults"],
crate_name: "hashbrown",
toolchain_src: stdlibs_src_path + "/vendor/hashbrown/src/lib.rs",
features: [
"alloc",
"compiler_builtins",
"core",
"nightly",
"rustc-dep-of-std",
"rustc-internal-api",
],
cfgs: ["has_extern_crate_alloc"],
rlibs: [
"libcore.rust_sysroot",
"libcompiler_builtins.rust_sysroot",
"liballoc.rust_sysroot",
"libunwind.rust_sysroot",
],
}
// Top level sysroot libraries are available both as static and dynamic
rust_toolchain_library {
name: "libstd",
defaults: ["rust_sysroot_defaults"],
crate_name: "std",
target: {
linux_bionic: {
rlibs: ["libpanic_abort.rust_sysroot"],
},
android: {
rlibs: ["libpanic_abort.rust_sysroot"],
},
musl: {
rlibs: ["libpanic_unwind.rust_sysroot"],
},
},
toolchain_src: stdlibs_src_path + "/library/std/src/lib.rs",
cfgs: ["backtrace_in_libstd"],
features: [
"default",
"std_detect_dlsym_getauxval",
"std_detect_file_io",
"profiler",
],
rlibs: [
"libcompiler_builtins.rust_sysroot",
"libcore.rust_sysroot",
"librustc_demangle.rust_sysroot",
"liblibc.rust_sysroot",
"libcfg_if.rust_sysroot",
"liballoc.rust_sysroot",
"libhashbrown.rust_sysroot",
"libunwind.rust_sysroot",
"libprofiler_builtins.rust_sysroot",
"libstd_detect.rust_sysroot",
],
}
rust_toolchain_library_rlib {
name: "libprofiler_builtins.rust_sysroot",
defaults: ["rust_sysroot_defaults"],
crate_name: "profiler_builtins",
toolchain_src: stdlibs_src_path + "/library/profiler_builtins/src/lib.rs",
rlibs: [
"libcompiler_builtins.rust_sysroot",
"libcore.rust_sysroot",
],
}
rust_toolchain_library {
name: "libgetopts",
host_supported: true,
crate_name: "getopts",
toolchain_src: stdlibs_src_path + "/vendor/getopts/src/lib.rs",
rlibs: ["libunicode_width.rust_toolchain"],
edition: "2015",
apex_available: [
"//apex_available:platform",
"com.android.virt",
],
}
rust_toolchain_library {
name: "libtest",
crate_name: "test",
host_supported: true,
toolchain_src: stdlibs_src_path + "/library/test/src/lib.rs",
rlibs: [
"liblibc.rust_toolchain",
"libcfg_if.rust_toolchain",
"libgetopts",
],
}
rust_toolchain_library_rlib {
name: "libunicode_width.rust_toolchain",
host_supported: true,
crate_name: "unicode_width",
toolchain_src: stdlibs_src_path + "/vendor/unicode-width/src/lib.rs",
edition: "2015",
apex_available: [
"//apex_available:platform",
"com.android.virt",
],
}
rust_toolchain_library_rlib {
name: "libcfg_if.rust_toolchain",
crate_name: "cfg_if",
host_supported: true,
toolchain_src: stdlibs_src_path + "/vendor/cfg-if/src/lib.rs",
}
rust_toolchain_library_rlib {
name: "liblibc.rust_toolchain",
crate_name: "libc",
host_supported: true,
toolchain_src: stdlibs_src_path + "/vendor/libc/src/lib.rs",
cfgs: [
"freebsd11",
"libc_priv_mod_use",
"libc_union",
"libc_const_size_of",
"libc_align",
"libc_core_cvoid",
"libc_packedN",
"libc_thread_local",
],
features: [
"std",
"align",
],
edition: "2015",
}
cc_prebuilt_binary {
name: "rustfmt",
enabled: false,
target: {
linux_x86_64: {
enabled: true,
srcs: ["linux-x86/stable/rustfmt"],
},
darwin_x86_64: {
enabled: true,
srcs: ["darwin-x86/stable/rustfmt"],
},
},
host_supported: true,
check_elf_files: false,
}
// Rustc and Clang have mismatched LLVM versions, cross language LTO may break when LLVM bitcode
// format changes. Disallow LTO until we can synchronise the versions. http://b/240643019
cc_defaults {
name: "rust_static_cc_lib_defaults",
visibility: ["//visibility:public"],
lto: {
never: true,
},
}