Fix zlib to actually use the win32 mingw build instead of generic static only build
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 2 Sep 2008 12:49:59 +0000 (08:49 -0400)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 2 Sep 2008 12:49:59 +0000 (08:49 -0400)
libxml2/mingw-libxml2.spec
zlib/mingw-zlib.spec
zlib/zlib-win32.patch [new file with mode: 0644]

index 1651c1c..b12ba95 100644 (file)
@@ -13,6 +13,7 @@ BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  mingw-gcc
 BuildRequires:  mingw-binutils
+BuildRequires:  mingw-zlib
 
 Requires:       mingw-runtime
 
@@ -25,7 +26,7 @@ MinGW Windows libxml2 XML processing library.
 
 
 %build
-CFLAGS="$RPM_OPT_FLAGS -fno-stack-protector" \
+CFLAGS="-O2 -g -Wall -pipe" LDFLAGS="-no-undefined" \
 ./configure \
   --build=%_build \
   --host=i686-pc-mingw32 \
index bbca2dd..416bac6 100644 (file)
@@ -9,6 +9,7 @@ License:        zlib
 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
@@ -22,19 +23,30 @@ MinGW Windows zlib compression library.
 
 %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
@@ -43,9 +55,12 @@ rm -rf $RPM_BUILD_ROOT
 
 %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
diff --git a/zlib/zlib-win32.patch b/zlib/zlib-win32.patch
new file mode 100644 (file)
index 0000000..85c1bad
--- /dev/null
@@ -0,0 +1,41 @@
+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