| 1 |
[package] |
| 2 |
name = "getrandom" |
| 3 |
version = "0.3.4" |
| 4 |
edition = "2021" |
| 5 |
rust-version = "1.63" # Sync tests.yml and README.md. |
| 6 |
authors = ["The Rand Project Developers"] |
| 7 |
license = "MIT OR Apache-2.0" |
| 8 |
description = "A small cross-platform library for retrieving random data from system source" |
| 9 |
documentation = "https://docs.rs/getrandom" |
| 10 |
repository = "https://github.com/rust-random/getrandom" |
| 11 |
categories = ["os", "no-std"] |
| 12 |
exclude = [".*"] |
| 13 |
|
| 14 |
[features] |
| 15 |
# Implement std::error::Error for getrandom::Error and |
| 16 |
# use std to retrieve OS error descriptions |
| 17 |
std = [] |
| 18 |
|
| 19 |
# Optional backend: wasm_js |
| 20 |
# This flag enables the wasm_js backend and uses it by default on wasm32 where |
| 21 |
# the target_os is unknown. The getrandom_backend cfg may override this. |
| 22 |
# WARNING: It is highly recommended to enable this feature only for binary crates and tests, |
| 23 |
# i.e. avoid unconditionally enabling it in library crates. |
| 24 |
wasm_js = ["dep:wasm-bindgen", "dep:js-sys"] |
| 25 |
|
| 26 |
[dependencies] |
| 27 |
cfg-if = "1" |
| 28 |
|
| 29 |
# getrandom / linux_android_with_fallback |
| 30 |
[target.'cfg(all(any(target_os = "linux", target_os = "android"), not(any(all(target_os = "linux", target_env = ""), getrandom_backend = "custom", getrandom_backend = "linux_raw", getrandom_backend = "rdrand", getrandom_backend = "rndr"))))'.dependencies] |
| 31 |
libc = { version = "0.2.154", default-features = false } |
| 32 |
|
| 33 |
# apple-other |
| 34 |
[target.'cfg(any(target_os = "ios", target_os = "visionos", target_os = "watchos", target_os = "tvos"))'.dependencies] |
| 35 |
libc = { version = "0.2.154", default-features = false } |
| 36 |
|
| 37 |
# efi_rng |
| 38 |
[target.'cfg(all(target_os = "uefi", getrandom_backend = "efi_rng"))'.dependencies] |
| 39 |
r-efi = { version = "5.1", default-features = false } |
| 40 |
|
| 41 |
# getentropy |
| 42 |
[target.'cfg(any(target_os = "macos", target_os = "openbsd", target_os = "vita", target_os = "emscripten"))'.dependencies] |
| 43 |
libc = { version = "0.2.154", default-features = false } |
| 44 |
|
| 45 |
# getrandom |
| 46 |
[target.'cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "hurd", target_os = "illumos", target_os = "cygwin", all(target_os = "horizon", target_arch = "arm")))'.dependencies] |
| 47 |
libc = { version = "0.2.154", default-features = false } |
| 48 |
|
| 49 |
# netbsd |
| 50 |
[target.'cfg(target_os = "netbsd")'.dependencies] |
| 51 |
libc = { version = "0.2.154", default-features = false } |
| 52 |
|
| 53 |
# solaris |
| 54 |
[target.'cfg(target_os = "solaris")'.dependencies] |
| 55 |
libc = { version = "0.2.154", default-features = false } |
| 56 |
|
| 57 |
# use_file |
| 58 |
[target.'cfg(any(target_os = "haiku", target_os = "redox", target_os = "nto", target_os = "aix"))'.dependencies] |
| 59 |
libc = { version = "0.2.154", default-features = false } |
| 60 |
|
| 61 |
# vxworks |
| 62 |
[target.'cfg(target_os = "vxworks")'.dependencies] |
| 63 |
libc = { version = "0.2.154", default-features = false } |
| 64 |
|
| 65 |
# wasi_p2 |
| 66 |
[target.'cfg(all(target_arch = "wasm32", target_os = "wasi", target_env = "p2"))'.dependencies] |
| 67 |
wasip2 = { version = "1", default-features = false } |
| 68 |
|
| 69 |
# wasm_js |
| 70 |
[target.'cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))'.dependencies] |
| 71 |
wasm-bindgen = { version = "0.2.98", default-features = false, optional = true } |
| 72 |
[target.'cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"), target_feature = "atomics"))'.dependencies] |
| 73 |
js-sys = { version = "0.3.77", default-features = false, optional = true } |
| 74 |
[target.'cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))'.dev-dependencies] |
| 75 |
wasm-bindgen-test = "0.3" |
| 76 |
|
| 77 |
[lints.rust.unexpected_cfgs] |
| 78 |
level = "warn" |
| 79 |
check-cfg = [ |
| 80 |
'cfg(getrandom_backend, values("custom", "efi_rng", "rdrand", "rndr", "linux_getrandom", "linux_raw", "wasm_js", "windows_legacy", "unsupported"))', |
| 81 |
'cfg(getrandom_msan)', |
| 82 |
'cfg(getrandom_test_linux_fallback)', |
| 83 |
'cfg(getrandom_test_linux_without_fallback)', |
| 84 |
'cfg(getrandom_test_netbsd_fallback)', |
| 85 |
'cfg(target_os, values("cygwin"))', # TODO(MSRV 1.86): Remove this. |
| 86 |
] |
| 87 |
|
| 88 |
[package.metadata.docs.rs] |
| 89 |
features = ["std"] |
| 90 |
|
| 91 |
# workaround for https://github.com/cross-rs/cross/issues/1345 |
| 92 |
[package.metadata.cross.target.x86_64-unknown-netbsd] |
| 93 |
pre-build = [ |
| 94 |
"mkdir -p /tmp/netbsd", |
| 95 |
"curl -fO https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.3/amd64/binary/sets/base.tar.xz", |
| 96 |
"tar -C /tmp/netbsd -xJf base.tar.xz", |
| 97 |
"cp /tmp/netbsd/usr/lib/libexecinfo.so /usr/local/x86_64-unknown-netbsd/lib", |
| 98 |
"rm base.tar.xz", |
| 99 |
"rm -rf /tmp/netbsd", |
| 100 |
] |