From 9ea97f6436449b709c297ef4f7a3b057c47150e0 Mon Sep 17 00:00:00 2001 From: Nathaniel Daniel Date: Sun, 26 Nov 2023 23:46:04 -0800 Subject: [PATCH 1/3] Replace \ with / in prefix on msvc --- src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 1230a994..5b44ae5f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -139,6 +139,8 @@ impl Build { // Change the install directory to happen inside of the build directory. if host.contains("pc-windows-gnu") { configure.arg(&format!("--prefix={}", sanitize_sh(&install_dir))); + } else if host.contains("pc-windows-msvc") { + configure.arg(&format!("--prefix={}", install_dir.to_str().unwrap().replace("\\", "/"))); } else { configure.arg(&format!("--prefix={}", install_dir.display())); } From dac957cdf87a25edb94960355b781c637ba5a47a Mon Sep 17 00:00:00 2001 From: Nathaniel Daniel Date: Tue, 28 Nov 2023 18:50:09 -0800 Subject: [PATCH 2/3] Run cargo fmt --- src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 5b44ae5f..20f08670 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -140,7 +140,10 @@ impl Build { if host.contains("pc-windows-gnu") { configure.arg(&format!("--prefix={}", sanitize_sh(&install_dir))); } else if host.contains("pc-windows-msvc") { - configure.arg(&format!("--prefix={}", install_dir.to_str().unwrap().replace("\\", "/"))); + configure.arg(&format!( + "--prefix={}", + install_dir.to_str().unwrap().replace("\\", "/") + )); } else { configure.arg(&format!("--prefix={}", install_dir.display())); } From b82df193a231b25efe70fa4351ed1ed3a916a23c Mon Sep 17 00:00:00 2001 From: Nathaniel Daniel Date: Wed, 29 Nov 2023 23:01:47 -0800 Subject: [PATCH 3/3] Add comment for path seperator replacement --- src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 20f08670..e3444a67 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -140,6 +140,10 @@ impl Build { if host.contains("pc-windows-gnu") { configure.arg(&format!("--prefix={}", sanitize_sh(&install_dir))); } else if host.contains("pc-windows-msvc") { + // On Windows, the prefix argument does not support \ path seperators + // when cross compiling. + // Always use / as a path seperator instead of \, since that works for both + // native and cross builds. configure.arg(&format!( "--prefix={}", install_dir.to_str().unwrap().replace("\\", "/")