BuildRequires: mingw-gcc
BuildRequires: mingw-binutils
+BuildRequires: mingw-zlib
Requires: mingw-runtime
%build
-CFLAGS="$RPM_OPT_FLAGS -fno-stack-protector" \
+CFLAGS="-O2 -g -Wall -pipe" LDFLAGS="-no-undefined" \
./configure \
--build=%_build \
--host=i686-pc-mingw32 \
Group: Development/Libraries
URL: http://www.zlib.net/
Source0: http://www.zlib.net/zlib-%{version}.tar.gz
+Patch1: zlib-win32.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: mingw-gcc
%prep
%setup -q -n zlib-1.2.3
-
+%patch1 -p1
%build
-CFLAGS="$RPM_OPT_FLAGS" \
+CFLAGS="-O2 -g -pipe -Wall" \
CC=i686-pc-mingw32-gcc RANLIB=i686-pc-mingw32-ranlib ./configure
-make all
-
+make -f win32/Makefile.gcc \
+ CC=i686-pc-mingw32-gcc \
+ AR=i686-pc-mingw32-ar \
+ RC=i686-pc-mingw32-windres \
+ DLLWRAP=i686-pc-mingw32-dllwrap \
+ STRIP=i686-pc-mingw32-strip \
+ all
%install
rm -rf $RPM_BUILD_ROOT
-make prefix=$RPM_BUILD_ROOT%{_prefix}/i686-pc-mingw32/sys-root/mingw install
+make -f win32/Makefile.gcc \
+ INCLUDE_PATH=$RPM_BUILD_ROOT%{_prefix}/i686-pc-mingw32/sys-root/mingw/include \
+ LIBRARY_PATH=$RPM_BUILD_ROOT%{_prefix}/i686-pc-mingw32/sys-root/mingw/lib \
+ install
+
+mkdir -p $RPM_BUILD_ROOT%{_prefix}/i686-pc-mingw32/sys-root/mingw/share/man/man3
+%__install zlib.3 $RPM_BUILD_ROOT%{_prefix}/i686-pc-mingw32/sys-root/mingw/share/man/man3
%clean
%files
%defattr(-,root,root)
-%{_prefix}/i686-pc-mingw32/sys-root/mingw/include/*
-%{_prefix}/i686-pc-mingw32/sys-root/mingw/lib/*
-%{_prefix}/i686-pc-mingw32/sys-root/mingw/share/man/man3/*
+%{_prefix}/i686-pc-mingw32/sys-root/mingw/include/zconf.h
+%{_prefix}/i686-pc-mingw32/sys-root/mingw/include/zlib.h
+%{_prefix}/i686-pc-mingw32/sys-root/mingw/lib/libz.a
+%{_prefix}/i686-pc-mingw32/sys-root/mingw/lib/libzdll.a
+%{_prefix}/i686-pc-mingw32/sys-root/mingw/lib/libz.dll
+%{_prefix}/i686-pc-mingw32/sys-root/mingw/share/man/man3/zlib.3
%changelog
--- /dev/null
+diff -rup zlib-1.2.3.orig/win32/Makefile.gcc zlib-1.2.3.new/win32/Makefile.gcc
+--- zlib-1.2.3.orig/win32/Makefile.gcc 2003-08-01 23:49:00.000000000 -0400
++++ zlib-1.2.3.new/win32/Makefile.gcc 2008-09-02 08:24:44.000000000 -0400
+@@ -45,6 +45,9 @@ ARFLAGS = rcs
+ RC = windres
+ RCFLAGS = --define GCC_WINDRES
+
++DLLWARP = dllwrap
++STRIP = strip
++
+ CP = cp -fp
+ # If GNU install is available, replace $(CP) with install.
+ INSTALL = $(CP)
+@@ -79,9 +82,9 @@ $(STATICLIB): $(OBJS) $(OBJA)
+ $(IMPLIB): $(SHAREDLIB)
+
+ $(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlibrc.o
+- dllwrap --driver-name $(CC) --def win32/zlib.def \
++ $(DLLWRAP) --driver-name $(CC) --def win32/zlib.def \
+ --implib $(IMPLIB) -o $@ $(OBJS) $(OBJA) zlibrc.o
+- strip $@
++ $(STRIP) $@
+
+ example: example.o $(STATICLIB)
+ $(LD) $(LDFLAGS) -o $@ example.o $(STATICLIB)
+@@ -104,12 +107,13 @@ zlibrc.o: win32/zlib1.rc
+ .PHONY: install uninstall clean
+
+ install: zlib.h zconf.h $(LIB)
+- -@if not exist $(INCLUDE_PATH)/nul mkdir $(INCLUDE_PATH)
+- -@if not exist $(LIBRARY_PATH)/nul mkdir $(LIBRARY_PATH)
++ -mkdir -p $(INCLUDE_PATH)
++ -mkdir -p $(LIBRARY_PATH)
+ -$(INSTALL) zlib.h $(INCLUDE_PATH)
+ -$(INSTALL) zconf.h $(INCLUDE_PATH)
+ -$(INSTALL) $(STATICLIB) $(LIBRARY_PATH)
+ -$(INSTALL) $(IMPLIB) $(LIBRARY_PATH)
++ -$(INSTALL) $(SHAREDLIB) $(LIBRARY_PATH)/libz.dll
+
+ uninstall:
+ -$(RM) $(INCLUDE_PATH)/zlib.h