Skip to content

Commit 1c2c7b0

Browse files
authored
Merge pull request #244 from polarathene/patch-1
fix: Remove forcing static builds when cross-compiling
2 parents 9c453d3 + d382873 commit 1c2c7b0

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

build.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,12 @@ fn main() {
7575

7676
// Situations where we build unconditionally.
7777
//
78-
// MSVC basically never has it preinstalled, MinGW picks up a bunch of weird
79-
// paths we don't like, `want_static` may force us, and cross compiling almost
80-
// never has a prebuilt version.
81-
//
82-
// Apple platforms have libz.1.dylib, and it's usually available even when
83-
// cross compiling (via fat binary or in the target's Xcode SDK)
84-
let cross_compiling = target != host;
78+
// - MSVC basically never has zlib preinstalled
79+
// - MinGW picks up a bunch of weird paths we don't like
80+
// - Explicit opt-in via `want_static`
8581
if target.contains("msvc")
8682
|| target.contains("pc-windows-gnu")
8783
|| want_static
88-
|| (cross_compiling && !target.contains("-apple-"))
8984
{
9085
return build_zlib(&mut cfg, &target);
9186
}
@@ -101,6 +96,7 @@ fn main() {
10196
return;
10297
}
10398

99+
// For convenience fallback to building zlib if attempting to link zlib failed
104100
build_zlib(&mut cfg, &target)
105101
}
106102

0 commit comments

Comments
 (0)