Skip to content

Commit bdc3db9

Browse files
committed
wip: Support Apple tvOS in libstd
1 parent 006a26c commit bdc3db9

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
@@ -18,6 +18,7 @@ fn main() {
1818
|| target.contains("illumos")
1919
|| target.contains("apple-darwin")
2020
|| target.contains("apple-ios")
21+
|| target.contains("apple-tvos")
2122
|| target.contains("apple-watchos")
2223
|| target.contains("uwp")
2324
|| target.contains("windows")
@@ -48,7 +49,6 @@ fn main() {
4849
// - mipsel-sony-psp
4950
// - nvptx64-nvidia-cuda
5051
// - arch=avr
51-
// - tvos (aarch64-apple-tvos, x86_64-apple-tvos)
5252
// - uefi (x86_64-unknown-uefi, i686-unknown-uefi)
5353
// - JSON targets
5454
// - 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
@@ -6,7 +6,7 @@ use crate::sys_common::{AsInner, AsInnerMut, IntoInner};
66
use crate::time::SystemTime;
77

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

1111
/// OS-specific extensions to [`fs::Metadata`].
1212
///

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 = "vita")]
141144
pub mod vita;
142145
#[cfg(target_os = "vxworks")]

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 = "vita")]
7779
pub use crate::os::vita::*;
7880
#[cfg(target_os = "vxworks")]
@@ -96,6 +98,7 @@ pub mod thread;
9698
target_os = "dragonfly",
9799
target_os = "freebsd",
98100
target_os = "ios",
101+
target_os = "tvos",
99102
target_os = "watchos",
100103
target_os = "macos",
101104
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",
@@ -238,6 +240,7 @@ impl UnixStream {
238240
target_os = "dragonfly",
239241
target_os = "freebsd",
240242
target_os = "ios",
243+
target_os = "tvos",
241244
target_os = "macos",
242245
target_os = "watchos",
243246
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
@@ -85,7 +85,7 @@ const UNWIND_DATA_REG: (i32, i32) = (4, 5); // a0, a1
8585
// https://github.com/gcc-mirror/gcc/blob/trunk/libgcc/unwind-c.c
8686

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

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)