summaryrefslogtreecommitdiff
path: root/external/libxml2
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2013-10-18 22:25:22 +0200
committerDavid Tardon <dtardon@redhat.com>2013-10-19 07:40:52 +0000
commitf2b51cdfd6fee45ff2062fa6fb46893eba56c02c (patch)
tree5cbcaa583dc98e965ae83d2b68bc5c17212a5b1f /external/libxml2
parent27d0ddf6b4526ffdf2e166e20a03a4c40a0f9936 (diff)
fdo#70393: move libxml2 to a subdir of external
Change-Id: Ifea928fc56239043f976ed1e0d2c986bc5cfb934 Reviewed-on: https://gerrit.libreoffice.org/6339 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'external/libxml2')
-rw-r--r--external/libxml2/ExternalPackage_xml2.mk43
-rw-r--r--external/libxml2/ExternalProject_xml2.mk52
-rw-r--r--external/libxml2/Makefile7
-rw-r--r--external/libxml2/Module_libxml2.mk18
-rw-r--r--external/libxml2/README1
-rw-r--r--external/libxml2/UnpackedTarball_xml2.mk27
-rw-r--r--external/libxml2/libxml2-aix.patch21
-rw-r--r--external/libxml2/libxml2-android.patch27
-rw-r--r--external/libxml2/libxml2-configure.patch152
-rw-r--r--external/libxml2/libxml2-global-symbols.patch59
-rw-r--r--external/libxml2/libxml2-gnome599717.patch20
-rw-r--r--external/libxml2/libxml2-latin.patch32
-rw-r--r--external/libxml2/libxml2-long-path.patch34
-rw-r--r--external/libxml2/libxml2-mingw.patch11
-rw-r--r--external/libxml2/libxml2-vc10.patch23
-rw-r--r--external/libxml2/libxml2-xpath.patch70
16 files changed, 597 insertions, 0 deletions
diff --git a/external/libxml2/ExternalPackage_xml2.mk b/external/libxml2/ExternalPackage_xml2.mk
new file mode 100644
index 000000000000..24dd5ef68835
--- /dev/null
+++ b/external/libxml2/ExternalPackage_xml2.mk
@@ -0,0 +1,43 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalPackage_ExternalPackage,xml2,xml2))
+
+$(eval $(call gb_ExternalPackage_use_external_project,xml2,xml2))
+
+ifneq ($(COM),MSC)
+$(eval $(call gb_ExternalPackage_add_file,xml2,bin/xml2-config,xml2-config))
+endif
+
+ifeq ($(OS),MACOSX)
+$(eval $(call gb_ExternalPackage_add_library_for_install,xml2,lib/libxml2.2.dylib,.libs/libxml2.2.dylib,xml2))
+$(eval $(call gb_ExternalPackage_add_file,xml2,lib/libxml2.dylib,.libs/libxml2.2.dylib))
+$(eval $(call gb_ExternalPackage_add_file,xml2,bin/xmllint,.libs/xmllint))
+else ifeq ($(DISABLE_DYNLOADING),TRUE)
+$(eval $(call gb_ExternalPackage_add_file,xml2,lib/libxml2.a,.libs/libxml2.a))
+ifneq ($(CROSS_COMPILING),YES)
+$(eval $(call gb_ExternalPackage_add_file,xml2,bin/xmllint,.libs/xmllint))
+endif
+else ifeq ($(OS),WNT)
+ifeq ($(COM),GCC)
+$(eval $(call gb_ExternalPackage_add_file,xml2,lib/libxml2.dll.a,.libs/libxml2.dll.a))
+$(eval $(call gb_ExternalPackage_add_library_for_install,xml2,bin/libxml2.dll,.libs/libxml2.dll,xml2))
+$(eval $(call gb_ExternalPackage_add_file,xml2,bin/xmllint.exe,.libs/xmllint.exe))
+else # COM=MSC
+$(eval $(call gb_ExternalPackage_add_file,xml2,lib/libxml2.lib,win32/bin.msvc/libxml2.lib))
+$(eval $(call gb_ExternalPackage_add_library_for_install,xml2,bin/libxml2.dll,win32/bin.msvc/libxml2.dll,xml2))
+$(eval $(call gb_ExternalPackage_add_file,xml2,bin/xmllint.exe,win32/bin.msvc/xmllint.exe))
+endif
+else # OS!=WNT
+$(eval $(call gb_ExternalPackage_add_file,xml2,lib/libxml2.so.2.7.6,.libs/libxml2.so.2.7.6))
+$(eval $(call gb_ExternalPackage_add_library_for_install,xml2,lib/libxml2.so.2,.libs/libxml2.so.2.7.6,xml2))
+$(eval $(call gb_ExternalPackage_add_file,xml2,lib/libxml2.so,.libs/libxml2.so.2.7.6))
+$(eval $(call gb_ExternalPackage_add_file,xml2,bin/xmllint,.libs/xmllint))
+endif
+# vim: set noet sw=4 ts=4:
diff --git a/external/libxml2/ExternalProject_xml2.mk b/external/libxml2/ExternalProject_xml2.mk
new file mode 100644
index 000000000000..a2d613d8c8d6
--- /dev/null
+++ b/external/libxml2/ExternalProject_xml2.mk
@@ -0,0 +1,52 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalProject_ExternalProject,xml2))
+
+$(eval $(call gb_ExternalProject_register_targets,xml2,\
+ build \
+))
+
+ifeq ($(OS),WNT)
+ifeq ($(COM),GCC)
+$(call gb_ExternalProject_get_state_target,xml2,build):
+ $(call gb_ExternalProject_run,build,\
+ ./configure --disable-ipv6 --without-python --without-zlib \
+ --disable-static --without-debug lt_cv_cc_dll_switch="-shared" \
+ $(if $(filter YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
+ CC="$(CC) -mthreads $(if $(filter YES,$(MINGW_SHARED_GCCLIB)),-shared-libgcc)" \
+ LIBS="-lws2_32 $(if $(filter YES,$(MINGW_SHARED_GXXLIB)),$(MINGW_SHARED_LIBSTDCPP))" \
+ LDFLAGS="-Wl$(COMMA)--no-undefined -Wl$(COMMA)--enable-runtime-pseudo-reloc-v2" \
+ OBJDUMP=objdump \
+ && $(MAKE) \
+ )
+else # COM=MSC
+$(call gb_ExternalProject_get_state_target,xml2,build):
+ $(call gb_ExternalProject_run,build,\
+ cscript configure.js \
+ iconv=no sax1=yes $(if $(MSVC_USE_DEBUG_RUNTIME),cruntime=/MDd) \
+ && unset MAKEFLAGS \
+ && LIB="$(ILIB)" nmake \
+ ,win32)
+endif
+else # OS!=WNT
+$(call gb_ExternalProject_get_state_target,xml2,build):
+ $(call gb_ExternalProject_run,build,\
+ ./configure --disable-ipv6 --without-python --without-zlib --with-sax1 \
+ $(if $(debug),--with-run-debug) \
+ $(if $(filter YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
+ $(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________URELIB) \
+ LDFLAGS="$(if $(SYSBASE),-L$(SYSBASE)/usr/lib)" \
+ CFLAGS="$(if $(SYSBASE),-I$(SYSBASE)/usr/include) $(if $(debug),-g)" \
+ $(if $(filter TRUE,$(DISABLE_DYNLOADING)),--disable-shared,--disable-static) \
+ && $(MAKE) \
+ )
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libxml2/Makefile b/external/libxml2/Makefile
new file mode 100644
index 000000000000..e4968cf85fb6
--- /dev/null
+++ b/external/libxml2/Makefile
@@ -0,0 +1,7 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libxml2/Module_libxml2.mk b/external/libxml2/Module_libxml2.mk
new file mode 100644
index 000000000000..f6bca3f80e4f
--- /dev/null
+++ b/external/libxml2/Module_libxml2.mk
@@ -0,0 +1,18 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Module_Module,libxml2))
+
+$(eval $(call gb_Module_add_targets,libxml2,\
+ ExternalPackage_xml2 \
+ ExternalProject_xml2 \
+ UnpackedTarball_xml2 \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libxml2/README b/external/libxml2/README
new file mode 100644
index 000000000000..12d96977c44a
--- /dev/null
+++ b/external/libxml2/README
@@ -0,0 +1 @@
+Gnome xml parser library written in C, from [http://xmlsoft.org/]
diff --git a/external/libxml2/UnpackedTarball_xml2.mk b/external/libxml2/UnpackedTarball_xml2.mk
new file mode 100644
index 000000000000..796ff5e2eb35
--- /dev/null
+++ b/external/libxml2/UnpackedTarball_xml2.mk
@@ -0,0 +1,27 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_UnpackedTarball_UnpackedTarball,xml2))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,xml2,$(LIBXML_TARBALL),,libxml2))
+
+$(eval $(call gb_UnpackedTarball_add_patches,xml2,\
+ external/libxml2/libxml2-configure.patch \
+ external/libxml2/libxml2-gnome599717.patch \
+ external/libxml2/libxml2-xpath.patch \
+ external/libxml2/libxml2-global-symbols.patch \
+ external/libxml2/libxml2-aix.patch \
+ external/libxml2/libxml2-vc10.patch \
+ external/libxml2/libxml2-latin.patch \
+ $(if $(filter ANDROID,$(OS)),external/libxml2/libxml2-android.patch) \
+ $(if $(filter WNT,$(OS)),external/libxml2/libxml2-long-path.patch \
+ $(if $(filter GCC,$(COM)),external/libxml2/libxml2-mingw.patch)) \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libxml2/libxml2-aix.patch b/external/libxml2/libxml2-aix.patch
new file mode 100644
index 000000000000..d187ea0f807f
--- /dev/null
+++ b/external/libxml2/libxml2-aix.patch
@@ -0,0 +1,21 @@
+--- misc/libxml2-2.7.6/config.guess 2010-09-15 14:53:52.000000000 -0500
++++ misc/build/libxml2-2.7.6/config.guess 2010-09-15 14:56:09.000000000 -0500
+@@ -548,7 +548,7 @@
+ echo rs6000-ibm-aix3.2
+ fi
+ exit ;;
+- *:AIX:*:[456])
++ *:AIX:*:[4567])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+@@ -560,6 +560,9 @@
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
++ if [ "$IBM_REV" == "V7BETA" ]; then
++ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
++ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:*:*)
diff --git a/external/libxml2/libxml2-android.patch b/external/libxml2/libxml2-android.patch
new file mode 100644
index 000000000000..06d5e57ad31d
--- /dev/null
+++ b/external/libxml2/libxml2-android.patch
@@ -0,0 +1,27 @@
+--- misc/libxml2-2.7.6/ltmain.sh
++++ misc/build/libxml2-2.7.6/ltmain.sh
+@@ -3228,6 +3228,12 @@
+ func_warning "\`-release' is ignored for convenience libraries"
+ else
+
++ # Force no versioning suffix for Android thanks to silly
++ # apkbuilder which doesn't add extra native libs unless their
++ # name ends with .so
++
++ version_type=none
++
+ # Parse the version information argument.
+ save_ifs="$IFS"; IFS=':'
+ set dummy $vinfo 0 0 0
+--- misc/libxml2-2.7.6/trionan.c
++++ misc/build/libxml2-2.7.6/trionan.c
+@@ -327,7 +327,7 @@
+
+ if (result == 0.0) {
+
+-#if defined(TRIO_COMPILER_SUPPORTS_C99)
++#if defined(TRIO_COMPILER_SUPPORTS_C99) && !(defined(__ANDROID__) && defined(__clang__))
+ result = nan("");
+
+ #elif defined(NAN) && defined(__STDC_IEC_559__)
+
diff --git a/external/libxml2/libxml2-configure.patch b/external/libxml2/libxml2-configure.patch
new file mode 100644
index 000000000000..d8515016df5c
--- /dev/null
+++ b/external/libxml2/libxml2-configure.patch
@@ -0,0 +1,152 @@
+--- misc/libxml2-2.7.6/config.sub 2009-06-11 11:29:50.000000000 +0200
++++ misc/build/libxml2-2.7.6/config.sub 2011-09-26 18:05:31.000000000 +0200
+@@ -120,7 +120,7 @@
+ # Here we must recognize all the valid KERNEL-OS combinations.
+ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+ case $maybe_os in
+- nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
++ nto-qnx* | linux-gnu* | linux-dietlibc | linux-android* | linux-newlib* | linux-uclibc* | \
+ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+ kopensolaris*-gnu* | \
+ storm-chaos* | os2-emx* | rtmk-nova*)
+@@ -1275,7 +1275,7 @@
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -chorusos* | -chorusrdb* | -cegcc* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+- | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
++ | -mingw32* | -linux-gnu* | -linux-androideabi* | -linux-newlib* | -linux-uclibc* \
+ | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+--- misc/libxml2-2.7.6/Makefile.in
++++ misc/build/libxml2-2.7.6/Makefile.in
+@@ -41,9 +41,9 @@
+ testSAX$(EXEEXT) testHTML$(EXEEXT) testXPath$(EXEEXT) \
+ testURI$(EXEEXT) testThreads$(EXEEXT) testC14N$(EXEEXT) \
+ testAutomata$(EXEEXT) testRegexp$(EXEEXT) testReader$(EXEEXT) \
+- testapi$(EXEEXT) testModule$(EXEEXT) runtest$(EXEEXT) \
++ testapi$(EXEEXT) testModule$(EXEEXT) \
+ runsuite$(EXEEXT) testchar$(EXEEXT) testdict$(EXEEXT) \
+- runxmlconf$(EXEEXT) testrecurse$(EXEEXT)
++ runxmlconf$(EXEEXT)
+ bin_PROGRAMS = xmllint$(EXEEXT) xmlcatalog$(EXEEXT)
+ subdir = .
+ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+--- misc/libxml2-2.7.6/ltmain.sh 2009-10-06 17:39:54.000000000 +0100
++++ misc/build/libxml2-2.7.6/ltmain.sh 2009-12-17 11:43:56.000000000 +0000
+@@ -6271,8 +6271,8 @@
+ ;;
+
+ freebsd-elf)
+- major=".$current"
+- versuffix=".$current"
++ major=.`expr $current - $age`
++ versuffix=".$major.$age.$revision";
+ ;;
+
+ irix | nonstopux)
+--- misc/libxml2-2.7.6/include/libxml/xmlversion.h 2009-12-17 11:45:19.000000000 +0000
++++ misc/build/libxml2-2.7.6/include/libxml/xmlversion.h 2009-12-17 11:45:36.000000000 +0000
+@@ -264,7 +264,7 @@
+ *
+ * Whether iconv support is available
+ */
+-#if 1
++#if 0
+ #define LIBXML_ICONV_ENABLED
+ #endif
+
+@@ -282,7 +282,7 @@
+ *
+ * Whether Debugging module is configured in
+ */
+-#if 1
++#if 0
+ #define LIBXML_DEBUG_ENABLED
+ #endif
+
+@@ -291,7 +291,7 @@
+ *
+ * Whether the memory debugging is configured in
+ */
+-#if 1
++#if 0
+ #define DEBUG_MEMORY_LOCATION
+ #endif
+
+@@ -300,7 +300,7 @@
+ *
+ * Whether the runtime debugging is configured in
+ */
+-#if 1
++#if 0
+ #define LIBXML_DEBUG_RUNTIME
+ #endif
+
+--- misc/libxml2-2.7.6/xml2-config.in 2009-12-17 11:45:20.000000000 +0000
++++ misc/build/libxml2-2.7.6/xml2-config.in 2009-12-17 11:45:36.000000000 +0000
+@@ -1,9 +1,14 @@
+ #! /bin/sh
+
+-prefix=@prefix@
+-exec_prefix=@exec_prefix@
+-includedir=@includedir@
+-libdir=@libdir@
++#prefix=@prefix@
++#exec_prefix=@exec_prefix@
++#includedir=@includedir@
++#libdir=@libdir@
++
++prefix=${SOLARVERSION}/${INPATH}
++exec_prefix=${SOLARVERSION}/${INPATH}
++includedir=${WORKDIR}/UnpackedTarball/xml2/include
++libdir=${SOLARVERSION}/${INPATH}/lib${UPDMINOREXT}
+
+ usage()
+ {
+@@ -67,7 +72,8 @@
+ ;;
+
+ --cflags)
+- echo @XML_INCLUDEDIR@ @XML_CFLAGS@
++ echo -I${includedir}
++# echo @XML_INCLUDEDIR@ @XML_CFLAGS@
+ ;;
+
+ --libtool-libs)
+@@ -82,19 +88,24 @@
+ ;;
+
+ --libs)
+- if [ "`uname`" = "Linux" ]
+- then
+- if [ "@XML_LIBDIR@" = "-L/usr/lib" -o "@XML_LIBDIR@" = "-L/usr/lib64" ]
+- then
+- echo @XML_LIBS@
+- else
+- echo @XML_LIBDIR@ @XML_LIBS@
+- fi
+- else
+- echo @XML_LIBDIR@ @XML_LIBS@ @WIN32_EXTRA_LIBADD@
+- fi
++ echo -L${libdir} -lxml2 -lm
++# if [ "`uname`" = "Linux" ]
++# then
++# if [ "@XML_LIBDIR@" = "-L/usr/lib" -o "@XML_LIBDIR@" = "-L/usr/lib64" ]
++# then
++# echo @XML_LIBS@
++# else
++# echo @XML_LIBDIR@ @XML_LIBS@
++# fi
++# else
++# echo @XML_LIBDIR@ @XML_LIBS@ @WIN32_EXTRA_LIBADD@
++# fi
+ ;;
+
++ print) # ugly configure hack
++ exit 0
++ ;;
++
+ *)
+ usage
+ exit 1
diff --git a/external/libxml2/libxml2-global-symbols.patch b/external/libxml2/libxml2-global-symbols.patch
new file mode 100644
index 000000000000..20cd273d745c
--- /dev/null
+++ b/external/libxml2/libxml2-global-symbols.patch
@@ -0,0 +1,59 @@
+--- misc/libxml2-2.7.6/libxml2.syms Tue Oct 6 18:31:35 2009
++++ misc/build/libxml2-2.7.6/libxml2.syms Wed Jul 7 15:43:17 2010
+@@ -2184,10 +2184,10 @@
+ } LIBXML2_2.6.27;
+
+ LIBXML2_2.6.29 {
+- global:
++# global:
+
+ # threads
+- xmlDllMain;
++#WIN32 only! xmlDllMain;
+ } LIBXML2_2.6.28;
+
+ LIBXML2_2.6.32 {
+@@ -2231,3 +2231,43 @@
+ xmlXIncludeProcessTreeFlagsData;
+ } LIBXML2_2.7.3;
+
++# HACK: export global variable accessor functions (globals.h)
++LIBXML2_GLOBAL_VARIABLES {
++ global:
++# __xmlMalloc;
++# __xmlMallocAtomic;
++# __xmlRealloc;
++# __xmlFree;
++# __xmlMemStrdup;
++ __docbDefaultSAXHandler;
++ __htmlDefaultSAXHandler;
++ __xmlLastError;
++ __oldXMLWDcompatibility;
++ __xmlBufferAllocScheme;
++ __xmlDefaultBufferSize;
++ __xmlDefaultSAXHandler;
++ __xmlDefaultSAXLocator;
++ __xmlDoValidityCheckingDefaultValue;
++ __xmlGenericError;
++ __xmlStructuredError;
++ __xmlGenericErrorContext;
++ __xmlStructuredErrorContext;
++ __xmlGetWarningsDefaultValue;
++ __xmlIndentTreeOutput;
++ __xmlTreeIndentString;
++ __xmlKeepBlanksDefaultValue;
++ __xmlLineNumbersDefaultValue;
++ __xmlLoadExtDtdDefaultValue;
++ __xmlParserDebugEntities;
++ __xmlParserVersion;
++ __xmlPedanticParserDefaultValue;
++ __xmlSaveNoEmptyTags;
++ __xmlSubstituteEntitiesDefaultValue;
++ __xmlRegisterNodeDefaultValue;
++ __xmlDeregisterNodeDefaultValue;
++ __xmlParserInputBufferCreateFilenameValue;
++ __xmlOutputBufferCreateFilenameValue;
++# Solaris ld needs explicit auto-reduction (or, alternatively, "-B local")
++ local:
++ *;
++} LIBXML2_2.7.4;
diff --git a/external/libxml2/libxml2-gnome599717.patch b/external/libxml2/libxml2-gnome599717.patch
new file mode 100644
index 000000000000..cc6617d0e699
--- /dev/null
+++ b/external/libxml2/libxml2-gnome599717.patch
@@ -0,0 +1,20 @@
+--- misc/libxml2-2.7.6/relaxng.c 2009-12-17 11:53:12.000000000 +0000
++++ misc/build/libxml2-2.7.6/relaxng.c 2009-12-17 16:30:43.000000000 +0000
+@@ -5369,7 +5369,7 @@
+ } else {
+ xmlRngPErr(ctxt, node, XML_RNGP_CHOICE_CONTENT,
+ "expecting name, anyName, nsName or choice : got %s\n",
+- (node == NULL ? "nothing" : node->name), NULL);
++ (node == NULL ? BAD_CAST "nothing" : node->name), NULL);
+ return (NULL);
+ }
+ if (ret != def) {
+@@ -9459,7 +9459,7 @@
+ ctxt->states = NULL;
+ if (found == 0) {
+ if (cur == NULL) {
+- VALID_ERR2(XML_RELAXNG_ERR_INTEREXTRA, "noname");
++ VALID_ERR2(XML_RELAXNG_ERR_INTEREXTRA, BAD_CAST "noname");
+ } else {
+ VALID_ERR2(XML_RELAXNG_ERR_INTEREXTRA, cur->name);
+ }
diff --git a/external/libxml2/libxml2-latin.patch b/external/libxml2/libxml2-latin.patch
new file mode 100644
index 000000000000..d1744138497e
--- /dev/null
+++ b/external/libxml2/libxml2-latin.patch
@@ -0,0 +1,32 @@
+--- misc/libxml2-2.7.6//runtest.c 2011-08-29 02:41:07.876872800 +0900
++++ misc/build/libxml2-2.7.6/runtest.c 2011-08-29 02:47:09.068970800 +0900
+@@ -2728,7 +2728,7 @@
+ "file:///path/to/a%20b.html",
+ "/path/to/a b.html",
+ "/path/to/a%20b.html",
+- "urip://example.com/résumé.html",
++ "urip://example.com/r" "\xe9" "sum" "\xe9" ".html",
+ "urip://example.com/test?a=1&b=2%263&c=4#foo",
+ NULL
+ };
+--- misc/libxml2-2.7.6//testapi.c 2011-08-29 02:41:28.088620300 +0900
++++ misc/build/libxml2-2.7.6/testapi.c 2011-08-29 02:46:32.966174100 +0900
+@@ -291,7 +291,7 @@
+ static xmlChar gen_xmlChar(int no, int nr ATTRIBUTE_UNUSED) {
+ if (no == 0) return('a');
+ if (no == 1) return(' ');
+- if (no == 2) return((xmlChar) 'ø');
++ if (no == 2) return((xmlChar) '\xf8');
+ return(0);
+ }
+
+@@ -399,7 +399,7 @@
+ static xmlChar *gen_const_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
+ if (no == 0) return((xmlChar *) "foo");
+ if (no == 1) return((xmlChar *) "<foo/>");
+- if (no == 2) return((xmlChar *) "nøne");
++ if (no == 2) return((xmlChar *) "n" "\xf8" "ne");
+ if (no == 3) return((xmlChar *) " 2ab ");
+ return(NULL);
+ }
+
diff --git a/external/libxml2/libxml2-long-path.patch b/external/libxml2/libxml2-long-path.patch
new file mode 100644
index 000000000000..d1596301ef99
--- /dev/null
+++ b/external/libxml2/libxml2-long-path.patch
@@ -0,0 +1,34 @@
+--- misc/libxml2-2.7.6/uri.c 2009-10-02 17:28:55.000000000 +0200
++++ misc/build/libxml2-2.7.6/uri.c 2011-02-24 13:47:19.349299000 +0100
+@@ -2479,7 +2479,16 @@
+ if (path == NULL)
+ return(NULL);
+
+- /* sanitize filename starting with // so it can be used as URI */
++#if defined(_WIN32)
++ //We must not change the backslashes to slashes if the path starts with
++ // \\?\
++ //Those paths can be up to 32k characters long.
++ len = xmlStrlen(path);
++ if ((len > 3) && (path[0] == '\\') && (path[1] == '\\') && (path[2] == '?') && (path[3] == '\\') )
++ return xmlStrdup((const xmlChar *) path);
++#endif
++
++ /* sanitize filename starting with // so it can be used as URI */
+ if ((path[0] == '/') && (path[1] == '/') && (path[2] != '/'))
+ path++;
+
+--- misc/libxml2-2.7.6/xmlIO.c 2009-09-24 17:32:00.000000000 +0200
++++ misc/build/libxml2-2.7.6/xmlIO.c 2011-02-24 13:47:26.163762000 +0100
+@@ -772,6 +772,11 @@
+
+ #ifdef HAVE_STAT
+ #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
++ //On Windows stat and wstat do not work with long pathname,
++ //which start with '\\?\'
++ if ((xmlStrlen(path) > 3) && (path[0] == '\\') && (path[1] == '\\') && (path[2] == '?') && (path[3] == '\\') )
++ return 1;
++
+ if (xmlWrapStat(path, &stat_buffer) == -1)
+ return 0;
+ #else
diff --git a/external/libxml2/libxml2-mingw.patch b/external/libxml2/libxml2-mingw.patch
new file mode 100644
index 000000000000..1dda894cb6e0
--- /dev/null
+++ b/external/libxml2/libxml2-mingw.patch
@@ -0,0 +1,11 @@
+--- misc/build/libxml2-2.7.6/include/libxml/xmlexports.h.orig 2011-08-23 10:26:54.000000000 +0200
++++ misc/build/libxml2-2.7.6/include/libxml/xmlexports.h 2011-08-23 10:27:21.000000000 +0200
+@@ -56,7 +56,7 @@
+ #undef XMLPUBVAR
+ #undef XMLCALL
+ #undef XMLCDECL
+- #if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
++ #if 0
+ #define XMLPUBFUN __declspec(dllexport)
+ #define XMLPUBVAR __declspec(dllexport)
+ #else
diff --git a/external/libxml2/libxml2-vc10.patch b/external/libxml2/libxml2-vc10.patch
new file mode 100644
index 000000000000..f29858029b27
--- /dev/null
+++ b/external/libxml2/libxml2-vc10.patch
@@ -0,0 +1,23 @@
+--- build/libxml2-2.7.6/win32/Makefile.msvc.old 2010-09-20 20:22:41.500000000 +0200
++++ build/libxml2-2.7.6/win32/Makefile.msvc 2010-09-20 20:23:00.250000000 +0200
+@@ -59,6 +59,7 @@
+ CFLAGS = $(CFLAGS) /D "HAVE_ZLIB_H"
+ !endif
+ CFLAGS = $(CFLAGS) /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE
++CFLAGS = $(CFLAGS) $(SOLARINC)
+
+ # The linker and its options.
+ LD = link.exe
+@@ -91,8 +91,12 @@
+ LDFLAGS = $(LDFLAGS) /DEBUG
+ !else
+ CFLAGS = $(CFLAGS) /D "NDEBUG" /O2
++!if "$(_NMAKE_VER)" >= "10.00.30319.01"
++LDFLAGS = $(LDFLAGS)
++!else
+ LDFLAGS = $(LDFLAGS) /OPT:NOWIN98
+ !endif
++!endif
+
+ # Libxml object files.
+ XML_OBJS = $(XML_INTDIR)\c14n.obj\
diff --git a/external/libxml2/libxml2-xpath.patch b/external/libxml2/libxml2-xpath.patch
new file mode 100644
index 000000000000..107de91ed862
--- /dev/null
+++ b/external/libxml2/libxml2-xpath.patch
@@ -0,0 +1,70 @@
+--- misc/libxml2-2.7.6/xpath.c 2009-09-24 17:32:00.000000000 +0200
++++ misc/build/libxml2-2.7.6/xpath.c 2011-01-03 17:21:08.788256100 +0100
+@@ -8106,9 +8106,17 @@
+ xmlNodePtr
+ xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
+ if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
+- if (cur != NULL && cur->children != NULL)
+- return cur->children ;
+- if (cur == NULL) cur = ctxt->context->node;
++ if ((cur != NULL) && (cur->type != XML_ATTRIBUTE_NODE) &&
++ (cur->type != XML_NAMESPACE_DECL) && (cur->children != NULL))
++ return(cur->children);
++
++ if (cur == NULL) {
++ cur = ctxt->context->node;
++ if (cur->type == XML_NAMESPACE_DECL)
++ return(NULL);
++ if (cur->type == XML_ATTRIBUTE_NODE)
++ cur = cur->parent;
++ }
+ if (cur == NULL) return(NULL) ; /* ERROR */
+ if (cur->next != NULL) return(cur->next) ;
+ do {
+@@ -8162,8 +8170,13 @@
+ xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, xmlNodePtr cur)
+ {
+ if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
+- if (cur == NULL)
++ if (cur == NULL) {
+ cur = ctxt->context->node;
++ if (cur->type == XML_NAMESPACE_DECL)
++ return(NULL);
++ if (cur->type == XML_ATTRIBUTE_NODE)
++ return(cur->parent);
++ }
+ if (cur == NULL)
+ return (NULL);
+ if ((cur->prev != NULL) && (cur->prev->type == XML_DTD_NODE))
+@@ -8207,8 +8220,8 @@
+ cur = ctxt->context->node;
+ if (cur == NULL)
+ return (NULL);
+- if (cur->type == XML_NAMESPACE_DECL)
+- cur = (xmlNodePtr)((xmlNsPtr)cur)->next;
++ if (cur->type == XML_NAMESPACE_DECL)
++ return (NULL);
+ ctxt->ancestor = cur->parent;
+ }
+ if ((cur->prev != NULL) && (cur->prev->type == XML_DTD_NODE))
+@@ -11737,11 +11750,16 @@
+
+ if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) {
+ xmlXPathObjectPtr tmp;
+- /* pop the result */
++ /* pop the result if any */
+ tmp = valuePop(ctxt);
+- xmlXPathReleaseObject(xpctxt, tmp);
+- /* then pop off contextObj, which will be freed later */
+- valuePop(ctxt);
++ if (tmp != contextObj) {
++ /*
++ * Free up the result
++ * then pop off contextObj, which will be freed later
++ */
++ xmlXPathReleaseObject(xpctxt, tmp);
++ valuePop(ctxt);
++ }
+ goto evaluation_error;
+ }
+