Skip to content

Commit

Permalink
rustbuild: Tweak how we cross-compile LLVM
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alexcrichton committed Jul 28, 2017
1 parent 6f815ca commit 069a1b3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/bootstrap/native.rs
Expand Up @@ -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| {
Expand Down

0 comments on commit 069a1b3

Please sign in to comment.