From 0fa562f38993c497b28f17de3629035bcee12624 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Tue, 26 Dec 2017 22:03:05 +0100 Subject: [PATCH] Pick the right compiler for CloudABI. CloudABI is a sandboxed UNIX-like runtime environment. For CloudABI, the compiler is always named -cc or -c++. The target name is never mangled. As we use Clang, not GCC, we use -cc and -c++, as opposed to -gcc and -g++. --- src/lib.rs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 28f7a53..851bd24 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1411,20 +1411,14 @@ impl Build { } let host = self.get_host()?; let target = self.get_target()?; - let (env, msvc, gnu) = if self.cpp { - ("CXX", "cl.exe", "g++") + let (env, msvc, gnu, traditional) = if self.cpp { + ("CXX", "cl.exe", "g++", "c++") } else { - ("CC", "cl.exe", "gcc") + ("CC", "cl.exe", "gcc", "cc") }; - let default = if host.contains("solaris") { - // In this case, c++/cc unlikely to exist or be correct. - gnu - } else if self.cpp { - "c++" - } else { - "cc" - }; + // On Solaris, c++/cc unlikely to exist or be correct. + let default = if host.contains("solaris") { gnu } else { traditional }; let tool_opt: Option = self.env_tool(env) @@ -1467,6 +1461,8 @@ impl Build { } } else if target.contains("android") { format!("{}-{}", target.replace("armv7", "arm"), gnu) + } else if target.contains("cloudabi") { + format!("{}-{}", target, traditional) } else if self.get_host()? != target { // CROSS_COMPILE is of the form: "arm-linux-gnueabi-" let cc_env = self.getenv("CROSS_COMPILE");