minizip: fix build with Apple Clang 12 (#20554)

This commit is contained in:
Adam J. Stewart 2020-12-28 08:43:37 -06:00 committed by GitHub
parent 7f997f82c2
commit 808f55fa1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 0 deletions

View file

@ -0,0 +1,10 @@
--- a/contrib/minizip/miniunz.c 2010-07-18 11:04:24.000000000 -0500
+++ b/contrib/minizip/miniunz.c 2020-12-25 21:39:19.000000000 -0600
@@ -45,6 +45,7 @@
#include <time.h>
#include <errno.h>
#include <fcntl.h>
+#include <sys/stat.h>
#ifdef _WIN32
# include <direct.h>

View file

@ -22,6 +22,13 @@ class Minizip(AutotoolsPackage):
depends_on('m4', type='build')
depends_on('zlib')
# error: implicit declaration of function 'mkdir' is invalid in C99
patch('implicit.patch', when='%apple-clang@12:')
# statically link to libz.a
# https://github.com/Homebrew/homebrew-core/blob/master/Formula/minizip.rb
patch('static.patch')
# build minizip and miniunz
@run_before('autoreconf')
def build_minizip_binary(self):

View file

@ -0,0 +1,26 @@
--- a/contrib/minizip/Makefile.am 2012-03-26 22:17:41.000000000 -0500
+++ b/contrib/minizip/Makefile.am 2020-12-26 12:48:31.000000000 -0600
@@ -8,7 +8,7 @@
zlib_top_builddir = $(top_builddir)/../..
AM_CPPFLAGS = -I$(zlib_top_srcdir)
-AM_LDFLAGS = -L$(zlib_top_builddir)
+AM_LDFLAGS = $(zlib_top_builddir)/libz.a
if WIN32
iowin32_src = iowin32.c
@@ -22,7 +22,7 @@
zip.c \
${iowin32_src}
-libminizip_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:0:0 -lz
+libminizip_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:0:0
minizip_includedir = $(includedir)/minizip
minizip_include_HEADERS = \
@@ -42,4 +42,4 @@
miniunzip_LDADD = libminizip.la
minizip_SOURCES = minizip.c
-minizip_LDADD = libminizip.la -lz
+minizip_LDADD = libminizip.la