From 4bdc70990c3c91b0ee301274f25c0252ba9b72e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Fri, 7 Mar 2025 13:38:36 +0300 Subject: [PATCH 1/4] Add built-in support for `*-linux-none` targets --- Cargo.toml | 2 +- src/backends.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 4298ea0b..5cddbde7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ compiler_builtins = { version = "0.1", optional = true } core = { version = "1.0", optional = true, package = "rustc-std-workspace-core" } # getrandom / linux_android_with_fallback -[target.'cfg(all(any(target_os = "linux", target_os = "android"), not(any(getrandom_backend = "custom", getrandom_backend = "linux_raw", getrandom_backend = "rdrand", getrandom_backend = "rndr"))))'.dependencies] +[target.'cfg(all(any(target_os = "linux", target_os = "android"), not(any(target_env = "", getrandom_backend = "custom", getrandom_backend = "linux_raw", getrandom_backend = "rdrand", getrandom_backend = "rndr"))))'.dependencies] libc = { version = "0.2.154", default-features = false } # apple-other diff --git a/src/backends.rs b/src/backends.rs index 82141a2b..719e035a 100644 --- a/src/backends.rs +++ b/src/backends.rs @@ -38,6 +38,9 @@ cfg_if! { ); } } + } else if #[cfg(all(target_os = "linux", target_env = ""))] { + mod linux_raw; + pub use linux_raw::*; } else if #[cfg(target_os = "espidf")] { mod esp_idf; pub use esp_idf::*; From 41aecf7b72e36ab581fa424e08a3aa2e1c481e89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Fri, 7 Mar 2025 13:42:23 +0300 Subject: [PATCH 2/4] Fix Android --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 5cddbde7..944f336e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ compiler_builtins = { version = "0.1", optional = true } core = { version = "1.0", optional = true, package = "rustc-std-workspace-core" } # getrandom / linux_android_with_fallback -[target.'cfg(all(any(target_os = "linux", target_os = "android"), not(any(target_env = "", getrandom_backend = "custom", getrandom_backend = "linux_raw", getrandom_backend = "rdrand", getrandom_backend = "rndr"))))'.dependencies] +[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] libc = { version = "0.2.154", default-features = false } # apple-other From 26ca6b97a082e14c714175cd293ff7908944c64f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Fri, 7 Mar 2025 13:43:11 +0300 Subject: [PATCH 3/4] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16fdb371..5d5ea417 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `.cargo/config.toml` example in the crate-level docs [#591] - `getrandom_test_linux_without_fallback` configuration flag to test that file fallback is not triggered in the `linux_android_with_fallback` backend [#605] +- Built-in support for `*-linux-none` targets [#618] ### Changed - Update `windows-targets` dependency to v0.53 [#593] @@ -38,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#605]: https://github.com/rust-random/getrandom/pull/605 [#610]: https://github.com/rust-random/getrandom/pull/610 [#614]: https://github.com/rust-random/getrandom/pull/614 +[#618]: https://github.com/rust-random/getrandom/pull/618 ## [0.3.1] - 2025-01-28 From 79e8c08ecfa040c737684e157cfdf713a5910ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Sun, 9 Mar 2025 20:39:27 +0300 Subject: [PATCH 4/4] Add build-only job for `x86_64-unknown-linux-none` --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d0c2feb7..79dba1d0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -94,6 +94,7 @@ jobs: x86_64-wrs-vxworks, x86_64-unknown-dragonfly, x86_64-unknown-haiku, + x86_64-unknown-linux-none, # TODO: once libc support for cygwin is released # https://github.com/rust-lang/libc/pull/4308 # x86_64-pc-cygwin,