From 21bedbb14739809ba4ec247f22632ee3cca64c55 Mon Sep 17 00:00:00 2001
From: "Kirill A. Korinsky" <kirill@korins.ky>
Date: Wed, 9 Feb 2022 05:47:47 +0100
Subject: [PATCH] `curl-sys`: never try to link with `/lib/darwin`

`clang --print-search-dirs` may return `libraries: =` that leads to
`/lib/darwin` which may leads to attempt to find `clang_rt.osx` inside
this wired path and which fails the build.
---
 vendor/curl-sys/build.rs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/vendor/curl-sys/build.rs b/vendor/curl-sys/build.rs
index 64df41e995..3213c66b33 100644
--- a/vendor/curl-sys/build.rs
+++ b/vendor/curl-sys/build.rs
@@ -532,7 +532,9 @@ fn macos_link_search_path() -> Option<String> {
     for line in stdout.lines() {
         if line.contains("libraries: =") {
             let path = line.split('=').skip(1).next()?;
-            return Some(format!("{}/lib/darwin", path));
+            if !path.is_empty() {
+                return Some(format!("{}/lib/darwin", path));
+            }
         }
     }
 
-- 
2.37.2

