1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-26 09:46:09 +00:00

Make glest use xerces-c3

Obtained from:	Gentoo
This commit is contained in:
Baptiste Daroussin 2014-02-24 14:32:27 +00:00
parent 79daa04885
commit e7158abc3a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=345851
2 changed files with 51 additions and 3 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= glest
PORTVERSION= 3.2.2
PORTREVISION= 6
PORTREVISION= 7
CATEGORIES= games
MASTER_SITES= SF/${PORTNAME}/${PORTNAME}%20source/${PORTVERSION}
DISTNAME= ${PORTNAME}_source_${PORTVERSION}
@ -12,8 +12,8 @@ DIST_SUBDIR= ${PORTNAME}
MAINTAINER= acm@FreeBSD.org
COMMENT= Free 3D real-time customizable strategy game
LIB_DEPENDS= xerces-c.27:${PORTSDIR}/textproc/xerces-c2 \
vorbis.4:${PORTSDIR}/audio/libvorbis
LIB_DEPENDS= libxerces-c.so:${PORTSDIR}/textproc/xerces-c3 \
libvorbis.so:${PORTSDIR}/audio/libvorbis
BUILD_DEPENDS= jam:${PORTSDIR}/devel/jam
RUN_DEPENDS= ${DATADIR}/servers.ini:${PORTSDIR}/games/glest-data

View File

@ -0,0 +1,48 @@
--- source/shared_lib/sources/xml/xml_parser.cpp.orig 2014-02-24 15:26:00.412992000 +0100
+++ source/shared_lib/sources/xml/xml_parser.cpp 2014-02-24 15:28:23.623987237 +0100
@@ -87,10 +87,17 @@
try{
ErrorHandler errorHandler;
- DOMBuilder *parser= (static_cast<DOMImplementationLS*>(implementation))->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0);
- parser->setErrorHandler(&errorHandler);
- parser->setFeature(XMLUni::fgXercesSchemaFullChecking, true);
- parser->setFeature(XMLUni::fgDOMValidation, true);
+#if XERCES_VERSION_MAJOR < 3
+ DOMBuilder *parser= (static_cast<DOMImplementationLS*>(implementation))->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0);
+ parser->setErrorHandler(&errorHandler);
+ parser->setFeature(XMLUni::fgXercesSchemaFullChecking, true);
+ parser->setFeature(XMLUni::fgDOMValidation, true);
+#else
+ DOMLSParser *parser = (static_cast<DOMImplementationLS*>(implementation))->createLSParser(DOMImplementationLS::MODE_SYNCHRONOUS, 0);
+ DOMConfiguration *config = parser->getDomConfig();
+ config->setParameter(XMLUni::fgXercesSchemaFullChecking, true);
+ config->setParameter(XMLUni::fgDOMValidate, true);
+#endif
DOMDocument *document= parser->parseURI(path.c_str());
if(document==NULL){
@@ -119,9 +126,20 @@
}
LocalFileFormatTarget file(path.c_str());
- DOMWriter* writer = implementation->createDOMWriter();
- writer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
- writer->writeNode(&file, *document);
+#if XERCES_VERSION_MAJOR < 3
+ DOMWriter* writer = implementation->createDOMWriter();
+ writer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
+ writer->writeNode(&file, *document);
+#else
+ DOMLSSerializer *serializer = implementation->createLSSerializer();
+ DOMLSOutput* output=implementation->createLSOutput();
+ DOMConfiguration* config=serializer->getDomConfig();
+ config->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint,true);
+ output->setByteStream(&file);
+ serializer->write(document,output);
+ output->release();
+ serializer->release();
+#endif
document->release();
}
catch(const DOMException &e){