%define __find_provides %{_mingw32_findprovides}
Name: mingw32-xqilla
-Version: 2.1.3
+Version: 2.2.0
Release: 1%{?dist}
Summary: XQilla is an XQuery and XPath 2.0 library, built on top of Xerces-C
Source0: http://downloads.sourceforge.net/xqilla/XQilla-%{version}.tar.gz
Source1: http://www.apache.org/dist/xerces/c/2/sources/xerces-c-src_2_8_0.tar.gz
-Patch1: xqilla-xercesc-libdir.patch
+# Patch from Xerces-C.
+Patch1000: xerces-c-dllwrap.patch
+
+# Use ifdef WIN32 instead of MSVC-specific tests.
+Patch1001: xqilla-xmark-test-win32.patch
+
+# XQC (the C API) does not work. The library part compiles OK but for
+# reasons unknown the symbols never get added to the libxqilla.dll.a
+# implib. The patch disables those sample programs.
+Patch1002: xqilla-no-xqc-tests.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: mingw32-binutils
BuildRequires: mingw32-xerces-c >= 2.8.0
+BuildRequires: flex
BuildRequires: autoconf, automake, libtool
BuildRequires: doxygen, graphviz
-%define xercesc_dir xerces-c-src_2_8_0
-%define xercesc_build_root %{_builddir}/%{xercesc_dir}
-
%description
XQilla is an XQuery and XPath 2.0 implementation written in C++ and based
%prep
-%setup -q -b 1 -n XQilla-%{version}
-%patch1
+%setup -q -a 1 -n XQilla-%{version}
+
+pushd xerces-c-src_2_8_0
+%patch1000 -p1
+popd
+
+%patch1001 -p1
+%patch1002 -p1
%build
+# XQilla requires a _built_ copy of Xerces-C. Thus we have to build
+# one first, copying much of the code from 'mingw32-xerces-c.spec'.
+# Native Fedora package instead patches the configure script to look
+# at the installed copy.
+pushd xerces-c-src_2_8_0
+export XERCESCROOT="$PWD"
+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}
+%{__make} DLLWRAP=%{_mingw32_dllwrap}
+popd
+
rm -f aclocal.m4
aclocal
libtoolize --force --copy
automake --add-missing --copy --force
autoconf
+MINGW32_CFLAGS="%{_mingw32_cflags} -DXQILLA_APIS" \
+MINGW32_CXXFLAGS="%{_mingw32_cflags} -DXQILLA_APIS" \
%{_mingw32_configure} \
--disable-static \
--disable-rpath \
- --with-xerces=%{xercesc_build_root}
+ --with-xerces=$(pwd)/xerces-c-src_2_8_0
make %{?_smp_mflags}
%files
%defattr(-,root,root)
%doc LICENSE
-%{_mingw32_bindir}/foo.dll
-%{_mingw32_libdir}/foo.dll.a
+%{_mingw32_bindir}/i686-pc-mingw32-xqilla.exe
+%{_mingw32_bindir}/libxqilla-5.dll
+%{_mingw32_libdir}/libxqilla.dll.a
+%{_mingw32_includedir}/xqc.h
+%{_mingw32_includedir}/xqilla/
%changelog
-* Wed Feb 18 2009 Richard W.M. Jones <rjones@redhat.com> - 2.1.3-1
+* Wed Feb 18 2009 Richard W.M. Jones <rjones@redhat.com> - 2.2.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
--- /dev/null
+--- XQilla-2.2.0/Makefile.am 2008-12-03 18:19:55.000000000 +0000
++++ XQilla-2.2.0.mingw/Makefile.am 2009-02-19 15:16:31.000000000 +0000
+@@ -6,7 +6,7 @@
+ LDADD = libxqilla.la
+
+ bin_PROGRAMS = xqilla
+-noinst_PROGRAMS = xqtsRunner xmarkRunner simple-basic simple-context-item xqc-basic xqc-context-item
++noinst_PROGRAMS = xqtsRunner xmarkRunner simple-basic simple-context-item
+
+ if BUILD_DOM_SAMPLES
+ noinst_PROGRAMS += dom-basic dom-context-item dom-resolver
+@@ -622,14 +622,14 @@
+ src/samples/dom-api/dom-resolver.cpp
+
+ # Dummy C++ source to cause C++ linking.
+-nodist_EXTRA_xqc_basic_SOURCES = dummy.cpp
+-xqc_basic_SOURCES = \
+-src/samples/xqc-api/xqc-basic.c
++#nodist_EXTRA_xqc_basic_SOURCES = dummy.cpp
++#xqc_basic_SOURCES = \
++#src/samples/xqc-api/xqc-basic.c
+
+ # Dummy C++ source to cause C++ linking.
+-nodist_EXTRA_xqc_context_item_SOURCES = dummy.cpp
+-xqc_context_item_SOURCES = \
+-src/samples/xqc-api/xqc-context-item.c
++#nodist_EXTRA_xqc_context_item_SOURCES = dummy.cpp
++#xqc_context_item_SOURCES = \
++#src/samples/xqc-api/xqc-context-item.c
+
+ LEXERFILE = $(top_srcdir)/src/lexer/XQLexer.cpp
+ LEXTEMPLATE = $(top_srcdir)/src/lexer/XQLexer.l