From 4a1e82b3a363cd28d4a2caeac806902d678071fc Mon Sep 17 00:00:00 2001 From: Robert Hodaszi Date: Thu, 8 Aug 2024 17:26:30 +0200 Subject: [PATCH] Add custom CC wrapper to the wrapper whitelist Some toolchains use custom (or at least not widely used) CC wrappers, and passes that through the CC env var before the compiler, like: CC = -gcc Add support to CC_KNOWN_WRAPPER_CUSTOM env var, to be able to extend the 'known_wrappers' list with this , and handle these special cases. --- src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 0c0a0450..36e7d6d0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3120,7 +3120,11 @@ impl Build { // // It's true that everything here is a bit of a pain, but apparently if // you're not literally make or bash then you get a lot of bug reports. - let known_wrappers = ["ccache", "distcc", "sccache", "icecc", "cachepot"]; + let mut known_wrappers = vec!["ccache", "distcc", "sccache", "icecc", "cachepot"]; + let custom_wrapper = self.getenv("CC_KNOWN_WRAPPER_CUSTOM"); + if custom_wrapper.is_some() { + known_wrappers.push(custom_wrapper.as_deref().unwrap().to_str().unwrap()); + } let mut parts = tool.split_whitespace(); let maybe_wrapper = match parts.next() {