Skip to content

Commit

Permalink
Fix zlib compilation on conan and AppleClang 12.0
Browse files Browse the repository at this point in the history
I'm not sure what these replaces were doing. Disabled them if on
AppleClang 12.0 or higher.

Related to:

- boostorg/build#638
- madler/zlib#509
  • Loading branch information
yamadapc committed Aug 17, 2020
1 parent 74c8520 commit 56ddf38
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions recipes/zlib/1.2.11/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,18 @@ def _build_zlib(self):
tools.replace_in_file('gzguts.h',
'#if defined(_WIN32) || defined(__CYGWIN__)',
'#if defined(_WIN32) || defined(__MINGW32__)')
for filename in ['zconf.h', 'zconf.h.cmakein', 'zconf.h.in']:
tools.replace_in_file(filename,
'#ifdef HAVE_UNISTD_H '
'/* may be set to #if 1 by ./configure */',
'#if defined(HAVE_UNISTD_H) && (1-HAVE_UNISTD_H-1 != 0)')
tools.replace_in_file(filename,
'#ifdef HAVE_STDARG_H '
'/* may be set to #if 1 by ./configure */',
'#if defined(HAVE_STDARG_H) && (1-HAVE_STDARG_H-1 != 0)')

is_apple_clang12 = self.settings.compiler == "apple-clang" and tools.Version(self.settings.compiler.version) >= "12.0"
if not is_apple_clang12:
for filename in ['zconf.h', 'zconf.h.cmakein', 'zconf.h.in']:
tools.replace_in_file(filename,
'#ifdef HAVE_UNISTD_H '
'/* may be set to #if 1 by ./configure */',
'#if defined(HAVE_UNISTD_H) && (1-HAVE_UNISTD_H-1 != 0)')
tools.replace_in_file(filename,
'#ifdef HAVE_STDARG_H '
'/* may be set to #if 1 by ./configure */',
'#if defined(HAVE_STDARG_H) && (1-HAVE_STDARG_H-1 != 0)')
tools.mkdir("_build")
with tools.chdir("_build"):
if self._use_autotools:
Expand Down

0 comments on commit 56ddf38

Please sign in to comment.