rustc_llvm: Link zlib on cross Solaris builds

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 #75713 and #75655.
This commit is contained in:
Alex Zepeda 2023-08-07 17:11:01 -07:00
parent 14dd4e97a8
commit 6ef7813cf0

View File

@ -251,7 +251,9 @@ fn main() {
} else if target.contains("windows-gnu") { } else if target.contains("windows-gnu") {
println!("cargo:rustc-link-lib=shell32"); println!("cargo:rustc-link-lib=shell32");
println!("cargo:rustc-link-lib=uuid"); println!("cargo:rustc-link-lib=uuid");
} else if target.contains("haiku") || target.contains("darwin") || target.contains("dragonfly") } else if target.contains("haiku")
|| target.contains("darwin")
|| (is_crossed && (target.contains("dragonfly") || target.contains("solaris")))
{ {
println!("cargo:rustc-link-lib=z"); println!("cargo:rustc-link-lib=z");
} else if target.contains("netbsd") { } else if target.contains("netbsd") {