Skip to content

Commit 069a1b3

Browse files
committed
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.
1 parent 6f815ca commit 069a1b3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/bootstrap/native.rs

+8
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,14 @@ impl Step for Llvm {
154154
let host = build.llvm_out(build.build).join("bin/llvm-tblgen");
155155
cfg.define("CMAKE_CROSSCOMPILING", "True")
156156
.define("LLVM_TABLEGEN", &host);
157+
158+
if target.contains("netbsd") {
159+
cfg.define("CMAKE_SYSTEM_NAME", "NetBSD");
160+
} else if target.contains("freebsd") {
161+
cfg.define("CMAKE_SYSTEM_NAME", "FreeBSD");
162+
}
163+
164+
cfg.define("LLVM_NATIVE_BUILD", build.llvm_out(build.build).join("build"));
157165
}
158166

159167
let sanitize_cc = |cc: &Path| {

0 commit comments

Comments
 (0)