about summary refs log tree commit diff
diff options
context:
space:
mode:
authoronur-ozkan <work@onurozkan.dev>2024-12-08 18:27:22 +0300
committeronur-ozkan <work@onurozkan.dev>2024-12-08 18:27:22 +0300
commitc4d7f1d29f05e9655e3827529ba4da3438e3e1fb (patch)
tree25a658e481971ad1192911963015e3530f53ecff
parentae3703cdf271b07cbc7cbaeda0ea8ab6bba60160 (diff)
downloadrust-c4d7f1d29f05e9655e3827529ba4da3438e3e1fb.tar.gz
rust-c4d7f1d29f05e9655e3827529ba4da3438e3e1fb.zip
implement `TargetSelection::is_cygwin` function
Signed-off-by: onur-ozkan <work@onurozkan.dev>
-rw-r--r--src/bootstrap/src/core/config/config.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index b06147055f2..a07d1597746 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -565,6 +565,12 @@ impl TargetSelection {
         self.ends_with("windows-gnu")
     }
 
+    pub fn is_cygwin(&self) -> bool {
+        self.is_windows() &&
+        // ref. https://cygwin.com/pipermail/cygwin/2022-February/250802.html
+        env::var("OSTYPE").is_ok_and(|v| v.to_lowercase().contains("cygwin"))
+    }
+
     /// Path to the file defining the custom target, if any.
     pub fn filepath(&self) -> Option<&Path> {
         self.file.as_ref().map(Path::new)