1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-24 06:50:08 +03:00

xinclude: Allow build without XPath

This disables XPath queries and makes the tests fail, but might be
useful.
This commit is contained in:
Nick Wellnhofer 2024-12-21 20:47:40 +01:00
parent c134e8b4dc
commit afeff9c52b
4 changed files with 10 additions and 16 deletions

View File

@ -47,6 +47,7 @@ option(LIBXML2_WITH_TESTS "Build tests" ON)
option(LIBXML2_WITH_THREADS "Add multithread support" ON)
option(LIBXML2_WITH_TLS "Enable thread-local storage" OFF)
option(LIBXML2_WITH_VALID "Add the DTD validation support" ON)
option(LIBXML2_WITH_XINCLUDE "Add the XInclude support" ON)
option(LIBXML2_WITH_XPATH "Add the XPATH support" ON)
option(LIBXML2_WITH_ZLIB "Use libz" OFF)
@ -71,9 +72,6 @@ cmake_dependent_option(
cmake_dependent_option(
LIBXML2_WITH_WRITER "Add the xmlWriter saving interface" ON
"LIBXML2_WITH_OUTPUT;LIBXML2_WITH_PUSH" OFF)
cmake_dependent_option(
LIBXML2_WITH_XINCLUDE "Add the XInclude support" ON
"LIBXML2_WITH_XPATH" OFF)
cmake_dependent_option(
LIBXML2_WITH_XPTR "Add the XPointer support" ON
"LIBXML2_WITH_XPATH" OFF)

View File

@ -194,12 +194,6 @@ if test "$with_writer" = "yes"; then
fi
with_push=yes
fi
if test "$with_xinclude" = "yes"; then
if test "$with_xpath" = "no"; then
echo WARNING: --with-xinclude overrides --without-xpath
fi
with_xpath=yes
fi
if test "$with_xptr" = "yes"; then
if test "$with_xpath" = "no"; then
echo WARNING: --with-xptr overrides --without-xpath
@ -271,7 +265,6 @@ else
if test "$with_xpath" = "no"; then
with_c14n=no
with_schematron=no
with_xinclude=no
with_xptr=no
fi
fi

View File

@ -121,6 +121,9 @@ want_threads = want_minimum ? feature.enabled() : feature.allowed()
feature = get_option('valid')
want_valid = want_minimum ? feature.enabled() : feature.allowed()
feature = get_option('xinclude')
want_xinclude = want_minimum ? feature.enabled() : feature.allowed()
# default depends on legacy option
feature = get_option('http')
@ -165,7 +168,6 @@ feature = get_option('xpath')
want_xpath = not want_minimum \
or get_option('c14n').enabled() \
or get_option('schematron').enabled() \
or get_option('xinclude').enabled() \
or get_option('xptr').enabled() ? \
feature.allowed() : feature.enabled()
@ -197,10 +199,6 @@ feature = get_option('writer') \
.require(want_push, error_message: 'writer requires push')
want_writer = want_minimum ? feature.enabled() : feature.allowed()
feature = get_option('xinclude') \
.require(want_xpath, error_message: 'xinclude requires xpath')
want_xinclude = want_minimum ? feature.enabled() : feature.allowed()
feature = get_option('xptr') \
.require(want_xpath, error_message: 'xptr requires xpath')
want_xptr = want_minimum ? feature.enabled() : feature.allowed()

View File

@ -103,7 +103,9 @@ struct _xmlXIncludeCtxt {
int depth; /* recursion depth */
int isStream; /* streaming mode */
#ifdef LIBXML_XPTR_ENABLED
xmlXPathContextPtr xpctxt;
#endif
xmlStructuredErrorFunc errorHandler;
void *errorCtxt;
@ -308,8 +310,10 @@ xmlXIncludeFreeContext(xmlXIncludeCtxtPtr ctxt) {
}
xmlFree(ctxt->txtTab);
}
#ifdef LIBXML_XPTR_ENABLED
if (ctxt->xpctxt != NULL)
xmlXPathFreeContext(ctxt->xpctxt);
#endif
xmlFree(ctxt);
}
@ -1331,9 +1335,10 @@ loaded:
ref->inc = xmlXIncludeCopyXPointer(ctxt, xptr, ref->base);
xmlXPathFreeObject(xptr);
}
#endif
done:
#endif
ret = 0;
error: