iOS initial support

Usage:

	IPHONEOS_DEPLOYMENT_TARGET="13.1 cargo build --target aarch64-apple-ios --release
	codesign -d -s - --entitlements build_tools/ios_entitlements.xml target/aarch64-apple-ios/release/fish

Closes #10993
This commit is contained in:
kekeimiku
2024-04-05 21:42:50 +08:00
committed by Johannes Altmanninger
parent 039df1c7c7
commit 841687a1af
13 changed files with 419 additions and 22 deletions

View File

@@ -88,6 +88,7 @@ fn detect_cfgs(target: &mut Target) {
"",
&(|_: &Target| Ok(false)) as &dyn Fn(&Target) -> Result<bool, Box<dyn Error>>,
),
("apple", &detect_apple),
("bsd", &detect_bsd),
("gettext", &have_gettext),
("small_main_stack", &has_small_stack),
@@ -123,6 +124,10 @@ fn detect_cfgs(target: &mut Target) {
}
}
fn detect_apple(_: &Target) -> Result<bool, Box<dyn Error>> {
Ok(cfg!(any(target_os = "ios", target_os = "macos")))
}
/// Detect if we're being compiled for a BSD-derived OS, allowing targeting code conditionally with
/// `#[cfg(bsd)]`.
///
@@ -199,14 +204,14 @@ fn have_gettext(target: &Target) -> Result<bool, Box<dyn Error>> {
/// 0.5 MiB is small enough that we'd have to drastically reduce MAX_STACK_DEPTH to less than 10, so
/// we instead use a workaround to increase the main thread size.
fn has_small_stack(_: &Target) -> Result<bool, Box<dyn Error>> {
#[cfg(not(any(target_os = "macos", target_os = "netbsd")))]
#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "netbsd")))]
return Ok(false);
// NetBSD 10 also needs this but can't find pthread_get_stacksize_np.
#[cfg(target_os = "netbsd")]
return Ok(true);
#[cfg(target_os = "macos")]
#[cfg(any(target_os = "ios", target_os = "macos"))]
{
use core::ffi;