Skip to content

Commit

Permalink
Add *-apple-{visionos,watchos} support; CI: build tvOS,visionOS,watchOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
briansmith committed Jun 20, 2024
1 parent 481462e commit 5c0f858
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 5 deletions.
26 changes: 25 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ libc = { version = "0.2.148", default-features = false }
[build-dependencies]
cc = { version = "1.0.83", default-features = false }

[target.'cfg(all(target_vendor = "apple", 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"]
Expand Down
9 changes: 8 additions & 1 deletion mk/install-build-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
13 changes: 10 additions & 3 deletions src/rand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,23 @@ impl crate::sealed::Sealed for SystemRandom {}
target_os = "hermit",
target_os = "hurd",
target_os = "illumos",
target_os = "ios",
target_os = "linux",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
target_os = "tvos",
target_os = "vita",
target_os = "windows",
all(
target_vendor = "apple",
any(
target_os = "ios",
target_os = "macos",
target_os = "tvos",
target_os = "visionos",
target_os = "watchos",
)
),
all(
target_arch = "wasm32",
any(
Expand Down

0 comments on commit 5c0f858

Please sign in to comment.