From 010309bff92dbcbbc0755e344f0647ffd3e36ee4 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Thu, 20 Jun 2024 13:38:11 -0700 Subject: [PATCH] Add *-apple-{visionos,watchos} support; CI: build tvOS,visionOS,watchOS. --- .github/workflows/ci.yml | 26 +++++++++++++++++++++++++- Cargo.toml | 3 +++ mk/install-build-tools.sh | 9 ++++++++- src/rand.rs | 2 ++ 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f7b30b0df..c4c814e8f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -164,8 +164,11 @@ jobs: - # Default target: - - aarch64-apple-ios - aarch64-apple-darwin + - aarch64-apple-ios + # - aarch64-apple-tvos Tier 3; handled below + # - aarch64-apple-visionos Tier 3; handled below + # - aarch64-apple-watchos Tier 3; handled below - aarch64-linux-android - aarch64-pc-windows-msvc - aarch64-unknown-linux-gnu @@ -205,6 +208,27 @@ jobs: # TODO: Run in the emulator. cargo_options: --no-run + - target: aarch64-apple-tvos + host_os: macos-14 + rust_channel: nightly + mode: --release + # TODO: Run in the emulator. + cargo_options: --no-run -Z build-std + + - target: aarch64-apple-visionos + host_os: macos-14 + rust_channel: nightly + mode: --release + # TODO: Run in the emulator. + cargo_options: --no-run -Z build-std + + - target: aarch64-apple-watchos + host_os: macos-14 + rust_channel: nightly + mode: --release + # TODO: Run in the emulator. + cargo_options: --no-run -Z build-std + - target: aarch64-linux-android host_os: ubuntu-22.04 # TODO: https://github.com/briansmith/ring/issues/486 diff --git a/Cargo.toml b/Cargo.toml index 0898ddd1af..ff07c26b8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -176,6 +176,9 @@ libc = { version = "0.2.148", default-features = false } [build-dependencies] cc = { version = "1.0.83", default-features = false } +[target.'cfg(any(target_os = "visionos"))'.build-dependencies] +cc = { version = "1.0.94", default-features = false } + [features] # These features are documented in the top-level module's documentation. default = ["alloc", "dev_urandom_fallback"] diff --git a/mk/install-build-tools.sh b/mk/install-build-tools.sh index 81fd9ed1ba..1018d3b8c0 100755 --- a/mk/install-build-tools.sh +++ b/mk/install-build-tools.sh @@ -68,6 +68,11 @@ case ${target-} in esac case ${target-} in +aarch64-apple-tvos | aarch64-apple-tvos-sim | \ +aarch64-apple-visionos | aarch64-apple-visionos-sim | \ +aarch64-apple-watchos | aarch64-apple-watchos-sim) + build_std=1 + ;; aarch64-unknown-linux-gnu) # Clang is needed for code coverage. use_clang=1 @@ -214,7 +219,9 @@ esac rustup toolchain install --no-self-update --profile=minimal ${toolchain} if [ -n "${target-}" ]; then - rustup target add --toolchain=${toolchain} ${target} + if [ -z "${build_std-}" ]; then + rustup target add --toolchain=${toolchain} ${target} + fi fi if [ -n "${RING_COVERAGE-}" ]; then rustup toolchain install --profile=minimal ${toolchain} --component llvm-tools-preview diff --git a/src/rand.rs b/src/rand.rs index 0d55635a00..683ee22fbe 100644 --- a/src/rand.rs +++ b/src/rand.rs @@ -140,6 +140,8 @@ impl crate::sealed::Sealed for SystemRandom {} target_os = "redox", target_os = "solaris", target_os = "tvos", + target_os = "visionos", + target_os = "watchos", target_os = "vita", target_os = "windows", all(