Skip to content

Commit

Permalink
Merge pull request #2403 from yamadapc/bug/fix-zlib-on-clang-12
Browse files Browse the repository at this point in the history
Fix zlib compilation on conan and AppleClang 12.0
  • Loading branch information
uilianries authored Aug 19, 2020
2 parents d1518a1 + 56ddf38 commit ed9ec83
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 ed9ec83

Please sign in to comment.