From 2e74353eb1d021ed272bc606242b2c700de9cbaa Mon Sep 17 00:00:00 2001 From: Masato TOYOSHIMA Date: Sat, 11 Jan 2025 19:31:02 +0900 Subject: [PATCH 1/4] Adjusted zig cc judgment and avoided zigbuild errors(#1360) Adjusted is_zig_cc judgment and adjusted how supports_path_delimiter is handled. --- src/lib.rs | 5 ++++- src/tool.rs | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 280ff7bb..503c4718 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1800,7 +1800,10 @@ impl Build { cmd.args(self.asm_flags.iter().map(std::ops::Deref::deref)); } - if compiler.supports_path_delimiter() && !is_assembler_msvc { + if compiler.supports_path_delimiter() + && !is_assembler_msvc + && matches!(compiler.family, ToolFamily::Clang { zig_cc: false }) + { // #513: For `clang-cl`, separate flags/options from the input file. // When cross-compiling macOS -> Windows, this avoids interpreting // common `/Users/...` paths as the `/U` flag and triggering diff --git a/src/tool.rs b/src/tool.rs index af43a918..8793257b 100644 --- a/src/tool.rs +++ b/src/tool.rs @@ -103,6 +103,12 @@ impl Tool { ) .map(|o| String::from_utf8_lossy(&o).contains("ziglang")) .unwrap_or_default() + || { + match path.file_name().map(OsStr::to_string_lossy) { + Some(fname) => fname.contains("zig"), + _ => false, + } + } } fn guess_family_from_stdout( From a69d8bbd51417941cd92df68fb62ead8c213d1a9 Mon Sep 17 00:00:00 2001 From: Masato TOYOSHIMA <77603626+phoepsilonix@users.noreply.github.com> Date: Sun, 12 Jan 2025 13:29:14 +0900 Subject: [PATCH 2/4] Update src/lib.rs Co-authored-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 503c4718..ec3346c4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1802,7 +1802,7 @@ impl Build { if compiler.supports_path_delimiter() && !is_assembler_msvc - && matches!(compiler.family, ToolFamily::Clang { zig_cc: false }) + && matches!(compiler.family, ToolFamily::Clang { zig_cc: false } | ToolFamilt::Msvc { clang_cl: true }) { // #513: For `clang-cl`, separate flags/options from the input file. // When cross-compiling macOS -> Windows, this avoids interpreting From 60669a93acc82a7d3cd17e02ad50f778b2f76220 Mon Sep 17 00:00:00 2001 From: Masato TOYOSHIMA Date: Sun, 12 Jan 2025 13:31:12 +0900 Subject: [PATCH 3/4] typo fix and format check cargo fmt --check --- src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index ec3346c4..844641a6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1802,7 +1802,10 @@ impl Build { if compiler.supports_path_delimiter() && !is_assembler_msvc - && matches!(compiler.family, ToolFamily::Clang { zig_cc: false } | ToolFamilt::Msvc { clang_cl: true }) + && matches!( + compiler.family, + ToolFamily::Clang { zig_cc: false } | ToolFamily::Msvc { clang_cl: true } + ) { // #513: For `clang-cl`, separate flags/options from the input file. // When cross-compiling macOS -> Windows, this avoids interpreting From fe7e2ce9c33787fb6762d557c623643bb72efadd Mon Sep 17 00:00:00 2001 From: Masato TOYOSHIMA Date: Sun, 12 Jan 2025 14:33:00 +0900 Subject: [PATCH 4/4] Revert "Update src/lib.rs" This reverts commit a69d8bbd51417941cd92df68fb62ead8c213d1a9. --- src/lib.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 844641a6..280ff7bb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1800,13 +1800,7 @@ impl Build { cmd.args(self.asm_flags.iter().map(std::ops::Deref::deref)); } - if compiler.supports_path_delimiter() - && !is_assembler_msvc - && matches!( - compiler.family, - ToolFamily::Clang { zig_cc: false } | ToolFamily::Msvc { clang_cl: true } - ) - { + if compiler.supports_path_delimiter() && !is_assembler_msvc { // #513: For `clang-cl`, separate flags/options from the input file. // When cross-compiling macOS -> Windows, this avoids interpreting // common `/Users/...` paths as the `/U` flag and triggering