Skip to content

Commit ef6b970

Browse files
committed
wip: Support Apple tvOS in libstd
1 parent 1716932 commit ef6b970

File tree

21 files changed

+84
-22
lines changed

21 files changed

+84
-22
lines changed

library/std/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ fn main() {
1515
|| target.contains("illumos")
1616
|| target.contains("apple-darwin")
1717
|| target.contains("apple-ios")
18+
|| target.contains("apple-tvos")
1819
|| target.contains("apple-watchos")
1920
|| target.contains("uwp")
2021
|| target.contains("windows")
@@ -42,7 +43,6 @@ fn main() {
4243
// - mipsel-sony-psp
4344
// - nvptx64-nvidia-cuda
4445
// - arch=avr
45-
// - tvos (aarch64-apple-tvos, x86_64-apple-tvos)
4646
// - uefi (x86_64-unknown-uefi, i686-unknown-uefi)
4747
// - JSON targets
4848
// - Any new targets that have not been explicitly added above.

library/std/src/os/ios/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::fs::Metadata;
44
use crate::sys_common::AsInner;
55

66
#[allow(deprecated)]
7-
use crate::os::ios::raw;
7+
use super::raw;
88

99
/// OS-specific extensions to [`fs::Metadata`].
1010
///

library/std/src/os/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ pub mod redox;
137137
pub mod solaris;
138138
#[cfg(target_os = "solid_asp3")]
139139
pub mod solid;
140+
#[cfg(target_os = "tvos")]
141+
#[path = "ios/mod.rs"]
142+
pub(crate) mod tvos;
140143
#[cfg(target_os = "vxworks")]
141144
pub mod vxworks;
142145
#[cfg(target_os = "watchos")]

library/std/src/os/unix/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ mod platform {
7373
pub use crate::os::redox::*;
7474
#[cfg(target_os = "solaris")]
7575
pub use crate::os::solaris::*;
76+
#[cfg(target_os = "tvos")]
77+
pub use crate::os::tvos::*;
7678
#[cfg(target_os = "vxworks")]
7779
pub use crate::os::vxworks::*;
7880
#[cfg(target_os = "watchos")]
@@ -94,6 +96,7 @@ pub mod thread;
9496
target_os = "dragonfly",
9597
target_os = "freebsd",
9698
target_os = "ios",
99+
target_os = "tvos",
97100
target_os = "watchos",
98101
target_os = "macos",
99102
target_os = "netbsd",

library/std/src/os/unix/net/stream.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, Owned
1111
target_os = "dragonfly",
1212
target_os = "freebsd",
1313
target_os = "ios",
14+
target_os = "tvos",
1415
target_os = "macos",
1516
target_os = "watchos",
1617
target_os = "netbsd",
@@ -30,6 +31,7 @@ use crate::time::Duration;
3031
target_os = "dragonfly",
3132
target_os = "freebsd",
3233
target_os = "ios",
34+
target_os = "tvos",
3335
target_os = "macos",
3436
target_os = "watchos",
3537
target_os = "netbsd",
@@ -239,6 +241,7 @@ impl UnixStream {
239241
target_os = "dragonfly",
240242
target_os = "freebsd",
241243
target_os = "ios",
244+
target_os = "tvos",
242245
target_os = "macos",
243246
target_os = "watchos",
244247
target_os = "netbsd",

library/std/src/os/unix/ucred.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub use self::impl_linux::peer_cred;
3636
))]
3737
pub use self::impl_bsd::peer_cred;
3838

39-
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos"))]
39+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
4040
pub use self::impl_mac::peer_cred;
4141

4242
#[cfg(any(target_os = "linux", target_os = "android"))]
@@ -98,7 +98,7 @@ pub mod impl_bsd {
9898
}
9999
}
100100

101-
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos"))]
101+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
102102
pub mod impl_mac {
103103
use super::UCred;
104104
use crate::os::unix::io::AsRawFd;

library/std/src/os/unix/ucred/tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use libc::{getegid, geteuid, getpid};
88
target_os = "dragonfly",
99
target_os = "freebsd",
1010
target_os = "ios",
11+
target_os = "tvos",
1112
target_os = "macos",
1213
target_os = "watchos",
1314
target_os = "openbsd"

library/std/src/personality/gcc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const UNWIND_DATA_REG: (i32, i32) = (10, 11); // x10, x11
8282
// https://github.com/gcc-mirror/gcc/blob/trunk/libgcc/unwind-c.c
8383

8484
cfg_if::cfg_if! {
85-
if #[cfg(all(target_arch = "arm", not(target_os = "ios"), not(target_os = "watchos"), not(target_os = "netbsd")))] {
85+
if #[cfg(all(target_arch = "arm", not(target_os = "ios"), not(target_os = "tvos"), not(target_os = "watchos"), not(target_os = "netbsd")))] {
8686
// ARM EHABI personality routine.
8787
// https://infocenter.arm.com/help/topic/com.arm.doc.ihi0038b/IHI0038B_ehabi.pdf
8888
//

library/std/src/sys/unix/args.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ mod imp {
168168
}
169169
}
170170

171-
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos"))]
171+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
172172
mod imp {
173173
use super::Args;
174174
use crate::ffi::CStr;
@@ -209,7 +209,7 @@ mod imp {
209209
// for i in (0..[args count])
210210
// res.push([args objectAtIndex:i])
211211
// res
212-
#[cfg(any(target_os = "ios", target_os = "watchos"))]
212+
#[cfg(any(target_os = "ios", target_os = "tvos", target_os = "watchos"))]
213213
pub fn args() -> Args {
214214
use crate::ffi::OsString;
215215
use crate::mem;

library/std/src/sys/unix/env.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,17 @@ pub mod os {
3131
pub const EXE_EXTENSION: &str = "";
3232
}
3333

34+
#[cfg(target_os = "tvos")]
35+
pub mod os {
36+
pub const FAMILY: &str = "unix";
37+
pub const OS: &str = "tvos";
38+
pub const DLL_PREFIX: &str = "lib";
39+
pub const DLL_SUFFIX: &str = ".dylib";
40+
pub const DLL_EXTENSION: &str = "dylib";
41+
pub const EXE_SUFFIX: &str = "";
42+
pub const EXE_EXTENSION: &str = "";
43+
}
44+
3445
#[cfg(target_os = "watchos")]
3546
pub mod os {
3647
pub const FAMILY: &str = "unix";

0 commit comments

Comments
 (0)