diff --git a/mingw32-libxml2-static-build-compile-fix.patch b/mingw32-libxml2-static-build-compile-fix.patch new file mode 100644 index 0000000..e4c32e4 --- /dev/null +++ b/mingw32-libxml2-static-build-compile-fix.patch @@ -0,0 +1,13 @@ +--- threads.c.orig 2009-04-03 19:12:55.382657819 +0200 ++++ threads.c 2009-04-03 19:13:10.362407937 +0200 +@@ -975,8 +975,8 @@ + */ + #if defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)) + #if defined(LIBXML_STATIC_FOR_DLL) +-BOOL XMLCALL +-xmlDllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) ++int XMLCALL ++xmlDllMain(void *hinstDLL, unsigned long fdwReason, void *lpvReserved) + #else + BOOL WINAPI + DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) diff --git a/mingw32-libxml2.spec b/mingw32-libxml2.spec index 78098da..db14fd3 100644 --- a/mingw32-libxml2.spec +++ b/mingw32-libxml2.spec @@ -6,7 +6,7 @@ Name: mingw32-libxml2 Version: 2.7.2 -Release: 8%{?dist} +Release: 9%{?dist} Summary: MinGW Windows libxml2 XML processing library License: MIT @@ -20,6 +20,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) # MinGW-specific patches. Patch1000: mingw32-libxml2-2.7.2-with-modules.patch +Patch1001: mingw32-libxml2-static-build-compile-fix.patch BuildArch: noarch @@ -41,10 +42,20 @@ Requires: pkgconfig MinGW Windows libxml2 XML processing library. +%package static +Summary: Static version of the MinGW Windows XML processing library +Requires: %{name} = %{version}-%{release} +Group: Development/Libraries + +%description static +Static version of the MinGW Windows XML processing library. + + %prep %setup -q -n libxml2-%{version} %patch1000 -p1 +%patch1001 -p0 # Patched configure.in, so rebuild configure. libtoolize --force --copy @@ -52,15 +63,39 @@ autoreconf %build -LDFLAGS="-no-undefined" \ -%{_mingw32_configure} --without-python --with-modules --disable-static -make %{?_smp_mflags} +# LibXML2 can't build static and shared libraries in one go, so we +# build LibXML2 twice here +mkdir build_static +pushd build_static + LDFLAGS="-no-undefined" \ + %{_mingw32_configure} --without-python --with-modules --enable-static --disable-shared CFLAGS="$CFLAGS -DLIBXML_STATIC_FOR_DLL" + make %{?_smp_mflags} +popd + +mkdir build_shared +pushd build_shared + LDFLAGS="-no-undefined" \ + %{_mingw32_configure} --without-python --with-modules --disable-static --enable-shared + make %{?_smp_mflags} +popd %install rm -rf $RPM_BUILD_ROOT -make DESTDIR=$RPM_BUILD_ROOT install +# First install all the files belonging to the shared build +make -C build_shared DESTDIR=$RPM_BUILD_ROOT install + +# Install all the files from the static build in a seperate folder +# and move the static libraries to the right location +make -C build_static DESTDIR=$RPM_BUILD_ROOT/build_static install +mv $RPM_BUILD_ROOT/build_static%{_mingw32_libdir}/*.a $RPM_BUILD_ROOT%{_mingw32_libdir} + +# Manually merge the libtool files +sed -i s/"old_library=''"/"old_library='libxml2.a'"/ $RPM_BUILD_ROOT%{_mingw32_libdir}/libxml2.la + +# Drop the folder which was temporary used for installing the static bits +rm -rf $RPM_BUILD_ROOT/build_static # Remove manpages which duplicate Fedora native. rm -rf $RPM_BUILD_ROOT%{_mingw32_mandir} @@ -71,14 +106,13 @@ rm -rf $RPM_BUILD_ROOT %files -%defattr(-,root,root) +%defattr(-,root,root,-) %{_mingw32_bindir}/libxml2-2.dll %{_mingw32_bindir}/xml2-config %{_mingw32_bindir}/xmlcatalog.exe %{_mingw32_bindir}/xmllint.exe %{_mingw32_libdir}/libxml2.dll.a %{_mingw32_libdir}/libxml2.la -%{_mingw32_libdir}/pkgconfig %{_mingw32_libdir}/pkgconfig/libxml-2.0.pc %{_mingw32_libdir}/xml2Conf.sh %{_mingw32_includedir}/libxml2 @@ -87,7 +121,17 @@ rm -rf $RPM_BUILD_ROOT %{_mingw32_datadir}/gtk-doc/html/libxml2/ +%files static +%defattr(-,root,root,-) +%{_mingw32_libdir}/libxml2.a + %changelog +* Fri Apr 3 2009 Erik van Pienbroek - 2.7.2-9 +- Fixed %%defattr line +- Added -static subpackage. Applications which want to link + against this static library needs to add -DLIBXML_STATIC to the CFLAGS +- This package shouldn't own %%{_mingw32_libdir}/pkgconfig + * Wed Feb 25 2009 Fedora Release Engineering - 2.7.2-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild