From 069a1b3c8f514b04251788108ecebfa672e942ae Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 28 Jul 2017 12:17:52 -0700 Subject: [PATCH] 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. --- src/bootstrap/native.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index f0dfd857ab619..bb80674c8877f 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| {