Skip to content

Commit

Permalink
Fix build on macOS
Browse files Browse the repository at this point in the history
Current zlib-ng defines _POSIX_C_SOURCE, which causes macOS sys/types.h
to not define types like u_char and u_int, which leads to compilation
errors when including other headers that use those types.

Define _DARWIN_C_SOURCE to work around this, which causes macOS
sys/types.h to define these types again.
  • Loading branch information
joshtriplett committed Mar 8, 2022
1 parent 698f11f commit 031b841
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ fn build_zlib_ng(target: &str) {
.define("WITH_DFLTCC_INFLATE", "1")
.cflag("-DDFLTCC_LEVEL_MASK=0x7e");
}
if target.contains("apple") {
cmake.cflag("-D_DARWIN_C_SOURCE=1");
}

let install_dir = cmake.build();

Expand Down

0 comments on commit 031b841

Please sign in to comment.