--- /dev/null
+%define __strip %{_mingw32_strip}
+%define __objdump %{_mingw32_objdump}
+%define _use_internal_dependency_generator 0
+%define __find_requires %{_mingw32_findrequires}
+%define __find_provides %{_mingw32_findprovides}
+
+Name: mingw32-xerces-c
+Version: 2.8.0
+Release: 1%{?dist}
+Summary: Validating XML parser
+
+License: ASL 2.0
+Group: Development/Libraries
+
+URL: http://xml.apache.org/xerces-c/
+Source0: http://www.apache.org/dist/xerces/c/2/sources/xerces-c-src_2_8_0.tar.gz
+
+# Patch allows dllwrap to be overridden.
+Patch1000: xerces-c-dllwrap.patch
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildArch: noarch
+
+BuildRequires: mingw32-filesystem >= 35
+BuildRequires: mingw32-gcc
+BuildRequires: mingw32-gcc-c++
+BuildRequires: mingw32-binutils
+
+
+%description
+Xerces-C is a validating XML parser written in a portable subset of
+C++. Xerces-C makes it easy to give your application the ability to
+read and write XML data. A shared library is provided for parsing,
+generating, manipulating, and validating XML documents. Xerces-C is
+faithful to the XML 1.0 recommendation and associated standards (DOM
+1.0, DOM 2.0. SAX 1.0, SAX 2.0, Namespaces).
+
+
+%prep
+%setup -q -n xerces-c-src_2_8_0
+
+%patch1000 -p1
+
+rm -rf doc/html/resources/.svn
+find ./doc -type f -perm 755 -exec chmod 644 {} \;
+find ./samples -type f -perm 755 -exec chmod 644 {} \;
+%{__perl} -pi.orig -e 's|(PREFIX.)/lib\b|$1/%{_lib}|g' src/xercesc/configure */Makefile.in
+rm doc/html/apiDocs/XMLRegisterCleanup_8hpp__incl.map
+rm doc/html/apiDocs/XSConstants_8hpp__incl.map
+
+# make rpmlint happy
+sed -i 's/\r//' doc/charter.xml
+iconv -f iso8859-1 -t utf-8 credits.txt > credits.utf8 && mv -f credits.{utf8,txt}
+iconv -f iso8859-1 -t utf-8 doc/feedback.xml > doc/feedback.utf8 && mv -f doc/feedback.{utf8,xml}
+iconv -f iso8859-1 -t utf-8 doc/migration.xml > doc/migration.utf8 && mv -f doc/migration.{utf8,xml}
+iconv -f iso8859-1 -t utf-8 doc/releases_archive.xml > doc/releases_archive.utf8 && mv -f doc/releases_archive.{utf8,xml}
+
+
+%build
+export XERCESCROOT="$PWD"
+
+# Let Makefiles be verbose
+find -name 'Makefile.*' | while read f; do
+ sed -i -e 's/$Q//g' \
+ -e 's/{MAKE} -s/(MAKE)/g' \
+ -e '/echo \" (/d' \
+ $f
+done
+
+# Remove conflicting flags from runConfigure
+find -name runConfigure | while read f; do
+ sed -i -e 's/-w -O -DNDEBUG/-DNDEBUG/g' $f
+done
+
+cd $XERCESCROOT/src/xercesc
+CXXFLAGS="%{_mingw32_cflags}" \
+CFLAGS="%{_mingw32_cflags}" \
+./runConfigure \
+ -pmingw-msys \
+ -c%{_mingw32_cc} \
+ -x%{_mingw32_cxx} \
+ -minmem \
+ -nwinsock \
+ -tWin32 \
+ -b32 \
+ -P %{_mingw32_prefix} \
+ -C --libdir="%{_mingw32_libdir}" -C --host=%{_mingw32_host}
+
+# not smp safe
+%{__make} DLLWRAP=%{_mingw32_dllwrap}
+
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+export XERCESCROOT="$PWD"
+%{__make} install -C src/xercesc DESTDIR="$RPM_BUILD_ROOT"
+
+# Move the DLLs into the bindir.
+mv $RPM_BUILD_ROOT%{_mingw32_libdir}/*.dll $RPM_BUILD_ROOT%{_mingw32_bindir}/
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+
+%files
+%defattr(-,root,root)
+%doc LICENSE
+%{_mingw32_include}/xercesc/
+%{_mingw32_bindir}/libxerces-c2_8_0.dll
+%{_mingw32_bindir}/libxerces-depdom2_8_0.dll
+
+
+%changelog
+* Wed Feb 18 2009 Richard W.M. Jones <rjones@redhat.com> - 2.8.0-1
+- Initial RPM release.
--- /dev/null
+--- xerces-c-src_2_8_0/src/xercesc/Makefile.incl.orig 2009-02-18 15:47:24.000000000 +0000
++++ xerces-c-src_2_8_0/src/xercesc/Makefile.incl 2009-02-18 15:47:45.000000000 +0000
+@@ -459,11 +459,12 @@
+ endif
+
+ #=============== MINGW SPECIFIC OPTIONS =========================
++DLLWRAP = dllwrap
+ ifeq (${PLATFORM}, MINGW)
+ PLATFORM_COMPILE_OPTIONS = -D${PLATFORM} -fexceptions -D__GNUWIN32__ -DWIN32 -D_WINDOWS -DNDEBUG -DPLATFORM_WIN32
+
+ ifeq (${LIBTYPE},shared)
+- MAKE_SHARED = dllwrap --export-all-symbols --driver-name ${CXX} ${LDFLAGS}
++ MAKE_SHARED = $(DLLWRAP) --export-all-symbols --driver-name ${CXX} ${LDFLAGS}
+ MAKE_SHARED_C = ${CC} -D${PLATFORM} ${LDFLAGS}
+ else
+ PLATFORM_COMPILE_OPTIONS += -DXML_LIBRARY # switch off import/export