diff options
| author | bors <bors@rust-lang.org> | 2016-04-02 10:30:03 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-04-02 10:30:03 -0700 |
| commit | 3ec71b033a81f2a7d7c24db265d1e1c2c437339a (patch) | |
| tree | 4b14c3469710215dff674b17c33b1518c84c6b04 | |
| parent | 1af79cf34e1fd6f38ba256631e2997ca650e490b (diff) | |
| parent | 08ca5d955832ee412250a776ce811c9d6abf2100 (diff) | |
| download | rust-3ec71b033a81f2a7d7c24db265d1e1c2c437339a.tar.gz rust-3ec71b033a81f2a7d7c24db265d1e1c2c437339a.zip | |
Auto merge of #32598 - alexcrichton:rustbuild-osx, r=aturon
rustbuild: Fix compile on OSX for 10.7 This commit should help configure our OSX rustbuild builder for targeting 10.7. A key part of this is using `libc++` instead of `libstdc++` as apparently it's more filled out and otherwise LLVM's cmake configuration would fail.
| -rw-r--r-- | src/bootstrap/build/mod.rs | 27 | ||||
| -rw-r--r-- | src/bootstrap/build/native.rs | 3 | ||||
| -rw-r--r-- | src/rustc/Cargo.lock | 6 |
3 files changed, 24 insertions, 12 deletions
diff --git a/src/bootstrap/build/mod.rs b/src/bootstrap/build/mod.rs index bd217940bfb..248bf6cb4ea 100644 --- a/src/bootstrap/build/mod.rs +++ b/src/bootstrap/build/mod.rs @@ -326,7 +326,13 @@ impl Build { if !target.contains("msvc") { cargo.env(format!("CC_{}", target), self.cc(target)) .env(format!("AR_{}", target), self.ar(target)) - .env(format!("CFLAGS_{}", target), self.cflags(target)); + .env(format!("CFLAGS_{}", target), self.cflags(target).join(" ")); + } + + // If we're building for OSX, inform the compiler and the linker that + // we want to build a compiler runnable on 10.7 + if target.contains("apple-darwin") { + cargo.env("MACOSX_DEPLOYMENT_TARGET", "10.7"); } // Environment variables *required* needed throughout the build @@ -497,11 +503,20 @@ impl Build { self.cc[target].0.path() } - fn cflags(&self, target: &str) -> String { - self.cc[target].0.args().iter() - .map(|s| s.to_string_lossy()) - .collect::<Vec<_>>() - .join(" ") + fn cflags(&self, target: &str) -> Vec<String> { + let mut base = self.cc[target].0.args().iter() + .map(|s| s.to_string_lossy().into_owned()) + .collect::<Vec<_>>(); + + // If we're compiling on OSX then we add a few unconditional flags + // indicating that we want libc++ (more filled out than libstdc++) and + // we want to compile for 10.7. This way we can ensure that + // LLVM/jemalloc/etc are all properly compiled. + if target.contains("apple-darwin") { + base.push("-stdlib=libc++".into()); + base.push("-mmacosx-version-min=10.7".into()); + } + return base } fn ar(&self, target: &str) -> &Path { diff --git a/src/bootstrap/build/native.rs b/src/bootstrap/build/native.rs index b3bd6b92299..bf0494bcd8c 100644 --- a/src/bootstrap/build/native.rs +++ b/src/bootstrap/build/native.rs @@ -86,6 +86,9 @@ pub fn llvm(build: &Build, target: &str) { .define("CMAKE_CXX_COMPILER", build.cxx(target)); } cfg.build_arg("-j").build_arg(build.jobs().to_string()); + + cfg.define("CMAKE_C_FLAGS", build.cflags(target).join(" ")); + cfg.define("CMAKE_CXX_FLAGS", build.cflags(target).join(" ")); } // FIXME: we don't actually need to build all LLVM tools and all LLVM diff --git a/src/rustc/Cargo.lock b/src/rustc/Cargo.lock index 3548e0c8f49..3f0d5086a17 100644 --- a/src/rustc/Cargo.lock +++ b/src/rustc/Cargo.lock @@ -76,7 +76,6 @@ dependencies = [ "rustc_const_eval 0.0.0", "rustc_data_structures 0.0.0", "rustc_front 0.0.0", - "rustc_llvm 0.0.0", "serialize 0.0.0", "syntax 0.0.0", ] @@ -87,7 +86,6 @@ version = "0.0.0" dependencies = [ "log 0.0.0", "rustc_front 0.0.0", - "rustc_llvm 0.0.0", "serialize 0.0.0", "syntax 0.0.0", ] @@ -227,10 +225,6 @@ dependencies = [ [[package]] name = "rustc_platform_intrinsics" version = "0.0.0" -dependencies = [ - "rustc 0.0.0", - "rustc_llvm 0.0.0", -] [[package]] name = "rustc_plugin" |
