From e6ed8e1a5526838dffb0af3cd973525ffba23c8f Mon Sep 17 00:00:00 2001 From: Thom Chiovoloni Date: Mon, 24 Oct 2022 16:31:05 -0700 Subject: [PATCH 1/2] Add tvOS and watchOS support, identical to iOS support --- src/{ios.rs => apple-other.rs} | 0 src/lib.rs | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) rename src/{ios.rs => apple-other.rs} (100%) diff --git a/src/ios.rs b/src/apple-other.rs similarity index 100% rename from src/ios.rs rename to src/apple-other.rs diff --git a/src/lib.rs b/src/lib.rs index fb81400a..39262580 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -15,7 +15,7 @@ //! | Linux, Android | `*‑linux‑*` | [`getrandom`][1] system call if available, otherwise [`/dev/urandom`][2] after successfully polling `/dev/random` //! | Windows | `*‑windows‑*` | [`BCryptGenRandom`] //! | macOS | `*‑apple‑darwin` | [`getentropy`][3] if available, otherwise [`/dev/urandom`][4] (identical to `/dev/random`) -//! | iOS | `*‑apple‑ios` | [`SecRandomCopyBytes`] +//! | iOS, tvOS, watchOS | `*‑apple‑ios`, `*-apple-tvos`, `*-apple-watchos` | [`SecRandomCopyBytes`] //! | FreeBSD | `*‑freebsd` | [`getrandom`][5] if available, otherwise [`kern.arandom`][6] //! | OpenBSD | `*‑openbsd` | [`getentropy`][7] //! | NetBSD | `*‑netbsd` | [`kern.arandom`][8] @@ -229,8 +229,8 @@ cfg_if! { #[path = "dragonfly.rs"] mod imp; } else if #[cfg(target_os = "fuchsia")] { #[path = "fuchsia.rs"] mod imp; - } else if #[cfg(target_os = "ios")] { - #[path = "ios.rs"] mod imp; + } else if #[cfg(any(target_os = "ios", target_os = "watchos", target_os = "tvos"))] { + #[path = "apple-other.rs"] mod imp; } else if #[cfg(target_os = "macos")] { mod util_libc; mod use_file; From e32ea822c33b8f16c691d09e9e65ab938769332f Mon Sep 17 00:00:00 2001 From: Thom Chiovoloni Date: Mon, 24 Oct 2022 21:29:25 -0700 Subject: [PATCH 2/2] Add tvOS and watchOS to CI --- .github/workflows/tests.yml | 7 ++++++- Cargo.toml | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f0a98f35..9ac496ac 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -152,12 +152,14 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@stable + - uses: dtolnay/rust-toolchain@nightly with: targets: aarch64-apple-darwin, aarch64-apple-ios + components: rust-src - uses: Swatinem/rust-cache@v2 - run: cargo test --no-run --target=aarch64-apple-darwin --features=std - run: cargo test --no-run --target=aarch64-apple-ios --features=std + - run: cargo test --no-run --target=aarch64-apple-watchos-sim -Zbuild-std --features=std cross-link: name: Cross Build/Link @@ -273,6 +275,9 @@ jobs: aarch64-kmc-solid_asp3, armv6k-nintendo-3ds, riscv32imc-esp-espidf, + # `std` support still in progress. Can be moved up with the other + # apple targets after https://github.com/rust-lang/rust/pull/103503 + aarch64-apple-tvos, ] include: # Supported tier 3 targets without libstd support diff --git a/Cargo.toml b/Cargo.toml index 35408b83..3ea982f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ compiler_builtins = { version = "0.1", optional = true } core = { version = "1.0", optional = true, package = "rustc-std-workspace-core" } [target.'cfg(unix)'.dependencies] -libc = { version = "0.2.128", default-features = false } +libc = { version = "0.2.136", default-features = false } [target.'cfg(target_os = "wasi")'.dependencies] wasi = { version = "0.11", default-features = false }