From e1913587889b0b1147531c370d9c810b46b5971e Mon Sep 17 00:00:00 2001 From: aspen Date: Tue, 30 Jun 2020 17:21:49 -0400 Subject: [PATCH] Changes required for rustc/cargo to build for iOS targets --- src/bootstrap/lib.rs | 5 +++++ src/bootstrap/native.rs | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index b611af54565..b11a7fc6255 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -811,6 +811,11 @@ fn cflags(&self, target: Interned, which: GitRepo) -> Vec { if target.contains("apple-darwin") { base.push("-stdlib=libc++".into()); } + + // Required for LLVM to properly compile. + if target.contains("apple-ios") { + base.push("-miphoneos-version-min=10.0".into()); + } // Work around an apparently bad MinGW / GCC optimization, // See: http://lists.llvm.org/pipermail/cfe-dev/2016-December/051980.html diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 106db90b2d0..e35ffb304bc 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -175,6 +175,14 @@ fn run(self, builder: &Builder<'_>) -> PathBuf { cfg.define("LLVM_ENABLE_ZLIB", "OFF"); } + // Are we compiling for iOS/tvOS? + if target.contains("apple") && !target.contains("darwin") { + cfg.define("CMAKE_OSX_SYSROOT", "/"); + cfg.define("CMAKE_OSX_DEPLOYMENT_TARGET", ""); + cfg.define("LLVM_ENABLE_PLUGINS", "OFF"); // Prevent cmake from adding -bundle to CFLAGS automatically. + cfg.define("LLVM_ENABLE_ZLIB", "OFF"); + } + if builder.config.llvm_thin_lto { cfg.define("LLVM_ENABLE_LTO", "Thin"); if !target.contains("apple") { -- 2.44.0