diff --git a/mingw32-zlib.spec b/mingw32-zlib.spec index 5fcc2f2..974f644 100644 --- a/mingw32-zlib.spec +++ b/mingw32-zlib.spec @@ -6,27 +6,25 @@ Name: mingw32-zlib Version: 1.2.3 -Release: 15%{?dist} +Release: 16%{?dist} Summary: MinGW Windows zlib compression library License: zlib Group: Development/Libraries URL: http://www.zlib.net/ Source0: http://www.zlib.net/zlib-%{version}.tar.gz +Patch3: zlib-1.2.3-autotools.patch +Patch6: minizip-1.2.3-malloc.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch -# From Fedora native package, none is applicable to us. -#Patch3: zlib-1.2.3-autotools.patch -#Patch4: minizip-1.2.3-autotools.patch -#Patch5: zlib-1.2.3-minizip.patch - # MinGW-specific patches. Patch100: zlib-win32.patch BuildRequires: mingw32-filesystem >= 49 BuildRequires: mingw32-gcc BuildRequires: mingw32-binutils +BuildRequires: perl %description @@ -40,14 +38,29 @@ Requires: mingw32-zlib = %{version}-%{release} %description static The mingw32-zlib-static package contains static library for mingw32-zlib development. +%package -n mingw32-minizip +Summary: Minizip manipulates files from a .zip archive +Group: Development/Libraries +Requires: mingw32-zlib = %{version}-%{release} + +%description -n mingw32-minizip +MinGW Minizip manipulates files from a .zip archive. + %prep %setup -q -n zlib-1.2.3 - %patch100 -p1 - +cp -r . x || : +%patch3 -p1 -b .atools +# patch cannot create an empty dir +mkdir m4 +%patch6 -p1 -b .mal +iconv -f windows-1252 -t utf-8 ChangeLog.tmp +mv ChangeLog.tmp ChangeLog +cp Makefile Makefile.old %build +pushd x CC=%{_mingw32_cc} \ CFLAGS="%{_mingw32_cflags}" \ RANLIB=%{_mingw32_ranlib} \ @@ -61,28 +74,30 @@ make -f win32/Makefile.gcc \ DLLWRAP=i686-pc-mingw32-dllwrap \ STRIP=%{_mingw32_strip} \ all +popd + +autoreconf --install; +%{_mingw32_configure} +make %{?_smp_mflags} libz.la +perl -i -pe 's,libz-1.dll,zlib1.dll,' libz.la +rm -f libz.dll.a +cp x/libzdll.a libz.dll.a +cp x/zlib1.dll . +rm -f .libs/libz.dll.a +cp x/libzdll.a .libs/libz.dll.a +cp x/zlib1.dll .libs/ +make %{?_smp_mflags} %install rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT%{_mingw32_bindir} -mkdir -p $RPM_BUILD_ROOT%{_mingw32_includedir} -mkdir -p $RPM_BUILD_ROOT%{_mingw32_libdir} +make install DESTDIR=$RPM_BUILD_ROOT -make -f win32/Makefile.gcc \ - INCLUDE_PATH=$RPM_BUILD_ROOT%{_mingw32_includedir} \ - LIBRARY_PATH=$RPM_BUILD_ROOT%{_mingw32_libdir} \ - BINARY_PATH=$RPM_BUILD_ROOT%{_mingw32_bindir} \ - install - -# .dll.a file is misnamed for some reason - fix that. -mv $RPM_BUILD_ROOT%{_mingw32_libdir}/libzdll.a \ - $RPM_BUILD_ROOT%{_mingw32_libdir}/libz.dll.a - -# Do NOT remove static library. -# rm $RPM_BUILD_ROOT%{_mingw32_libdir}/libz.a +rm -rf $RPM_BUILD_ROOT/%{_mingw32_mandir} +rm -f $RPM_BUILD_ROOT/%{_mingw32_bindir}/libz-1.dll +install x/zlib1.dll $RPM_BUILD_ROOT/%{_mingw32_bindir}/ %clean rm -rf $RPM_BUILD_ROOT @@ -94,6 +109,7 @@ rm -rf $RPM_BUILD_ROOT %{_mingw32_includedir}/zlib.h %{_mingw32_libdir}/libz.dll.a %{_mingw32_bindir}/zlib1.dll +%{_mingw32_libdir}/libz.la %files static @@ -101,7 +117,21 @@ rm -rf $RPM_BUILD_ROOT %{_mingw32_libdir}/libz.a +%files -n mingw32-minizip +%defattr(-,root,root,-) +%doc contrib/minizip/ChangeLogUnzip +%{_mingw32_libdir}/libminizip.dll.a +%{_mingw32_libdir}/libminizip.la +%{_mingw32_bindir}/libminizip-1.dll +%dir %{_mingw32_includedir}/minizip +%{_mingw32_includedir}/minizip/*.h +%{_mingw32_libdir}/pkgconfig/minizip.pc + + %changelog +* Thu Apr 30 2009 Thomas Sailer - 1.2.3-16 +- use autotools build system from native package + * Mon Mar 3 2009 W. Pilorz - 1.2.3-15 - Add static subpackage. diff --git a/minizip-1.2.3-malloc.patch b/minizip-1.2.3-malloc.patch new file mode 100644 index 0000000..1f4c3fd --- /dev/null +++ b/minizip-1.2.3-malloc.patch @@ -0,0 +1,15 @@ +diff -up zlib-1.2.3/contrib/minizip/miniunz.c.pom zlib-1.2.3/contrib/minizip/miniunz.c +--- zlib-1.2.3/contrib/minizip/miniunz.c.pom 2005-07-12 20:08:40.000000000 +0200 ++++ zlib-1.2.3/contrib/minizip/miniunz.c 2008-12-01 11:12:23.000000000 +0100 +@@ -112,6 +112,11 @@ int makedir (newdir) + return 0; + + buffer = (char*)malloc(len+1); ++ if (buffer==NULL) ++ { ++ printf("Error allocating memory\n"); ++ return UNZ_INTERNALERROR; ++ } + strcpy(buffer,newdir); + + if (buffer[len-1] == '/') { diff --git a/zlib-1.2.3-autotools.patch b/zlib-1.2.3-autotools.patch new file mode 100644 index 0000000..d52427a --- /dev/null +++ b/zlib-1.2.3-autotools.patch @@ -0,0 +1,115 @@ +diff -urN zlib-1.2.3.orig/Makefile.am zlib-1.2.3.kasal/Makefile.am +--- zlib-1.2.3.orig/Makefile.am 1970-01-01 01:00:00.000000000 +0100 ++++ zlib-1.2.3.kasal/Makefile.am 2009-03-17 17:58:36.000000000 +0100 +@@ -0,0 +1,67 @@ ++ACLOCAL_AMFLAGS = -I m4 --install ++ ++lib_LTLIBRARIES = libz.la ++ ++libz_la_SOURCES = \ ++ adler32.c \ ++ compress.c \ ++ crc32.c \ ++ crc32.h \ ++ gzio.c \ ++ uncompr.c \ ++ deflate.c \ ++ deflate.h \ ++ trees.c \ ++ trees.h \ ++ zutil.c \ ++ zutil.h \ ++ inflate.c \ ++ inflate.h \ ++ infback.c \ ++ inftrees.c \ ++ inftrees.h \ ++ inffast.c \ ++ inffast.h \ ++ infflate.h ++ ++# Use -version-number to match the file name used before autoconfiscation. ++libz_la_LDFLAGS = -version-number 1:2:3 -no-undefined ++ ++include_HEADERS = zlib.h ++nodist_include_HEADERS = zconf.h ++ ++dist_man_MANS = zlib.3 ++ ++## libminizip: ++ ++lib_LTLIBRARIES += libminizip.la ++ ++libminizip_la_SOURCES = \ ++ contrib/minizip/ioapi.c \ ++ contrib/minizip/mztools.c \ ++ contrib/minizip/unzip.c \ ++ contrib/minizip/zip.c ++ ++# do not build the static version of libminizip ++libminizip_la_CFLAGS = -shared ++libminizip_la_LDFLAGS = -version-info 1:0:0 -no-undefined ++libminizip_la_LIBADD = libz.la ++ ++minizip_includedir = $(includedir)/minizip ++minizip_include_HEADERS = \ ++ contrib/minizip/crypt.h \ ++ contrib/minizip/ioapi.h \ ++ contrib/minizip/mztools.h \ ++ contrib/minizip/unzip.h \ ++ contrib/minizip/zip.h ++ ++pkgconfigdir = $(libdir)/pkgconfig ++pkgconfig_DATA = minizip.pc ++ ++EXTRA_PROGRAMS = miniunzip minizip ++ ++miniunzip_SOURCES = contrib/minizip/miniunz.c ++miniunzip_LDADD = libminizip.la ++ ++minizip_SOURCES = contrib/minizip/minizip.c ++minizip_LDADD = libminizip.la +diff -urN zlib-1.2.3.orig/configure.ac zlib-1.2.3.kasal/configure.ac +--- zlib-1.2.3.orig/configure.ac 1970-01-01 01:00:00.000000000 +0100 ++++ zlib-1.2.3.kasal/configure.ac 2009-03-17 17:28:41.000000000 +0100 +@@ -0,0 +1,13 @@ ++# -*- Autoconf -*- ++# Process this file with autoconf to produce a configure script. ++ ++AC_INIT([zlib], [1.2.3], [bugzilla.redhat.com]) ++AC_CONFIG_SRCDIR([minigzip.c]) ++AC_CONFIG_MACRO_DIR([m4]) ++AM_INIT_AUTOMAKE([foreign]) ++LT_INIT ++ ++AC_SUBST([HAVE_UNISTD_H], [0]) ++AC_CHECK_HEADER([unistd.h], [HAVE_UNISTD_H=1], []) ++AC_CONFIG_FILES([Makefile minizip.pc zconf.h:zconf.in.h]) ++AC_OUTPUT +diff -urN zlib-1.2.3.orig/minizip.pc.in zlib-1.2.3.kasal/minizip.pc.in +--- zlib-1.2.3.orig/minizip.pc.in 1970-01-01 01:00:00.000000000 +0100 ++++ zlib-1.2.3.kasal/minizip.pc.in 2009-01-07 15:49:34.000000000 +0100 +@@ -0,0 +1,11 @@ ++prefix=@prefix@ ++exec_prefix=@exec_prefix@ ++libdir=@libdir@ ++includedir=@includedir@/minizip ++ ++Name: minizip ++Description: Minizip zip file manipulation library ++Requires: ++Version: @PACKAGE_VERSION@ ++Libs: -L${libdir} -lminizip -lz ++Cflags: -I${includedir} +diff -urN zlib-1.2.3.orig/zconf.in.h zlib-1.2.3.kasal/zconf.in.h +--- zlib-1.2.3.orig/zconf.in.h 2005-05-28 08:40:35.000000000 +0200 ++++ zlib-1.2.3.kasal/zconf.in.h 2009-03-17 17:17:11.000000000 +0100 +@@ -284,7 +284,7 @@ + typedef Byte *voidp; + #endif + +-#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ ++#if @HAVE_UNISTD_H@ /* HAVE_UNISTD_H -- this line is updated by ./configure */ + # include /* for off_t */ + # include /* for SEEK_* and off_t */ + # ifdef VMS