From d382873704cf914c47e2793013734c102c4ce84a Mon Sep 17 00:00:00 2001 From: Brennan Kinney <5098581+polarathene@users.noreply.github.com> Date: Wed, 2 Jul 2025 19:41:01 +1200 Subject: [PATCH] fix: Remove forcing static builds when cross-compiling This constraint is no longer necessary, due to improvements since it's original introduction in Feb 2016. The zlib library will be linked dynamically (provided no explicit opt-in to static link) or fallback to building from source. --- build.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/build.rs b/build.rs index 6e17cc88..cd11af8b 100644 --- a/build.rs +++ b/build.rs @@ -75,17 +75,12 @@ fn main() { // Situations where we build unconditionally. // - // MSVC basically never has it preinstalled, MinGW picks up a bunch of weird - // paths we don't like, `want_static` may force us, and cross compiling almost - // never has a prebuilt version. - // - // Apple platforms have libz.1.dylib, and it's usually available even when - // cross compiling (via fat binary or in the target's Xcode SDK) - let cross_compiling = target != host; + // - MSVC basically never has zlib preinstalled + // - MinGW picks up a bunch of weird paths we don't like + // - Explicit opt-in via `want_static` if target.contains("msvc") || target.contains("pc-windows-gnu") || want_static - || (cross_compiling && !target.contains("-apple-")) { return build_zlib(&mut cfg, &target); } @@ -101,6 +96,7 @@ fn main() { return; } + // For convenience fallback to building zlib if attempting to link zlib failed build_zlib(&mut cfg, &target) }