about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2017-07-28 12:17:52 -0700
committerAlex Crichton <alex@alexcrichton.com>2017-07-28 12:20:47 -0700
commit069a1b3c8f514b04251788108ecebfa672e942ae (patch)
tree1d253919e7ad41d3df10121639d3b6fb9a0bec8c /src
parent6f815ca771b59fe652a5f88f198810b5dc37a4c9 (diff)
downloadrust-069a1b3c8f514b04251788108ecebfa672e942ae.tar.gz
rust-069a1b3c8f514b04251788108ecebfa672e942ae.zip
rustbuild: Tweak how we cross-compile LLVM
In preparation for upgrading to LLVM 5.0 it looks like we need to tweak how we
cross compile LLVM slightly. It's using `CMAKE_SYSTEM_NAME` to infer whether to
build libFuzzer which only works on some platforms, and then once we configure
that it needs to apparently reach into the host build area to try to compile
`llvm-config` as well. Once these are both configured, though, it looks like we
can successfully cross-compile LLVM.
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/native.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs
index f0dfd857ab6..bb80674c887 100644
--- a/src/bootstrap/native.rs
+++ b/src/bootstrap/native.rs
@@ -154,6 +154,14 @@ impl Step for Llvm {
             let host = build.llvm_out(build.build).join("bin/llvm-tblgen");
             cfg.define("CMAKE_CROSSCOMPILING", "True")
                .define("LLVM_TABLEGEN", &host);
+
+            if target.contains("netbsd") {
+               cfg.define("CMAKE_SYSTEM_NAME", "NetBSD");
+            } else if target.contains("freebsd") {
+               cfg.define("CMAKE_SYSTEM_NAME", "FreeBSD");
+            }
+
+            cfg.define("LLVM_NATIVE_BUILD", build.llvm_out(build.build).join("build"));
         }
 
         let sanitize_cc = |cc: &Path| {