summary refs log tree commit diff
path: root/compiler/rustc_llvm/build.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-09-02 07:48:21 +0200
committerGitHub <noreply@github.com>2023-09-02 07:48:21 +0200
commit4e2231803b4d4223552bbee675242e5959e11444 (patch)
treee5341dbcb80f899776ea9d77936f75e730fa98b7 /compiler/rustc_llvm/build.rs
parent9dc11a13fa848c1b09b7248c540528190dcb79c5 (diff)
parent6ef7813cf0a7f591ec6709e06a4ce1c1ebc8f223 (diff)
downloadrust-4e2231803b4d4223552bbee675242e5959e11444.tar.gz
rust-4e2231803b4d4223552bbee675242e5959e11444.zip
Rollup merge of #114349 - inferiorhumanorgans:dragonfly-link-libz, r=cuviper
rustc_llvm: Link to `zlib` on dragonfly and solaris

On native builds `llvm-config` picks up `zlib` and this gets pased into
the rust build tools, but on cross builds `llvm-config` is explicitly
ignored as it contains information for the host system and cannot be
trusted to be accurate for the target system.

Both DragonFly and Solaris contain `zlib` in the base system, so this is
both a safe assumption and required for a successful cross build unless
`zlib` support is disabled in LLVM.

This is more or less in the same vein as rust-lang#75713 and rust-lang#75655.
Diffstat (limited to 'compiler/rustc_llvm/build.rs')
-rw-r--r--compiler/rustc_llvm/build.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs
index 4302b161833..f606fa483ca 100644
--- a/compiler/rustc_llvm/build.rs
+++ b/compiler/rustc_llvm/build.rs
@@ -252,7 +252,10 @@ fn main() {
     } else if target.contains("windows-gnu") {
         println!("cargo:rustc-link-lib=shell32");
         println!("cargo:rustc-link-lib=uuid");
-    } else if target.contains("haiku") || target.contains("darwin") {
+    } else if target.contains("haiku")
+        || target.contains("darwin")
+        || (is_crossed && (target.contains("dragonfly") || target.contains("solaris")))
+    {
         println!("cargo:rustc-link-lib=z");
     } else if target.contains("netbsd") {
         println!("cargo:rustc-link-lib=z");