Skip to content

Commit

Permalink
Do not check pkg-config when cross-compiling for android/haiku
Browse files Browse the repository at this point in the history
Currently when compiling for android/haiku target we check pkg-config
for zlib then fallback to using shipped zlib,
this can cause problems as pkg-config sometimes returns host's zlib.

This patch makes it to always use shipped zlib instead of pkg-config one.

Signed-off-by: sagudev <[email protected]>
  • Loading branch information
sagudev committed Jul 26, 2024
1 parent 37d0a5d commit 80e5a0c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ fn main() {
return build_zlib_ng(&target, true);
}

// All android compilers should come with libz by default, so let's just use
// the one already there. Likewise, Haiku always ships with libz, so we can
// link to it even when cross-compiling.
if target.contains("android") || target.contains("haiku") {
println!("cargo:rustc-link-lib=z");
return;
}

// Don't run pkg-config if we're linking statically (we'll build below) and
// also don't run pkg-config on FreeBSD/DragonFly. That'll end up printing
// `-L /usr/lib` which wreaks havoc with linking to an OpenSSL in /usr/local/lib
Expand Down Expand Up @@ -63,14 +71,6 @@ fn main() {
}
}

// All android compilers should come with libz by default, so let's just use
// the one already there. Likewise, Haiku always ships with libz, so we can
// link to it even when cross-compiling.
if target.contains("android") || target.contains("haiku") {
println!("cargo:rustc-link-lib=z");
return;
}

let mut cfg = cc::Build::new();

// Situations where we build unconditionally.
Expand Down

0 comments on commit 80e5a0c

Please sign in to comment.