Add tinyxml package.

This commit is contained in:
Alexpux
2013-12-11 22:54:53 +04:00
parent 6f13a25acb
commit e8cc649cf1
4 changed files with 137 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
# Maintainer: Alexey Pavlov <alexpux@gmail.com>
_realname=tinyxml
_mingw_suff=mingw-w64-${CARCH}
pkgname="${_mingw_suff}-${_realname}"
pkgver=2.6.2
pkgrel=1
pkgdesc="Simple, small, C++ XML parser that can be easily integrated into other programs (mingw-w64)"
arch=('any')
url="http://www.grinninglizard.com/tinyxml"
license=("zlib")
makedepends=("${_mingw_suff}-gcc")
depends=("${_mingw_suff}-crt")
options=('strip' 'staticlibs')
source=("http://downloads.sourceforge.net/tinyxml/tinyxml_${pkgver//./_}.tar.gz"
"entity.patch"
"tinyxml-2.5.3-stl.patch"
"tinyxml.pc")
sha256sums=('15bdfdcec58a7da30adc87ac2b078e4417dbe5392f3afb719f9ba6d062645593'
'ef493209b0a51160171fd834a7ecdddd02679463b85fb89a2ea254213e47f99b'
'3baf2c4dbc2c8f54a151dac8860113d2f549174f83ed85d552b094dfaebb52af'
'60bcff16486698f4d2f076f5a3c6e5566e098e3d0d30f1bdbbe7012d3d36c095')
prepare() {
cd "$srcdir/tinyxml"
patch -p0 -i "$srcdir"/entity.patch
patch -p1 -i "$srcdir"/tinyxml-2.5.3-stl.patch
}
build() {
mkdir -p "${srcdir}/${_realname}-${pkgver}-build-${MINGW_CHOST}"
cp -r "${srcdir}/tinyxml/"* "${srcdir}/${_realname}-${pkgver}-build-${MINGW_CHOST}"
cd "${srcdir}/${_realname}-${pkgver}-build-${MINGW_CHOST}"
for file in $(ls *.cpp | grep -v xmltest); do
g++ -c -Wall -Wno-unknown-pragmas -Wno-format -O3 $file
done
ar rcs -o libtinyxml.a $(ls *.o)
g++ -shared -o libtinyxml-0.dll -Xlinker --out-implib -Xlinker libtinyxml.dll.a $(ls *.o)
}
package() {
cd "${srcdir}/${_realname}-${pkgver}-build-${MINGW_CHOST}"
install -Dm644 libtinyxml.a "${pkgdir}${MINGW_PREFIX}/lib/libtinyxml.a"
install -Dm644 libtinyxml-0.dll "${pkgdir}${MINGW_PREFIX}/bin/libtinyxml-0.dll"
install -m644 libtinyxml.dll.a "${pkgdir}${MINGW_PREFIX}/lib/"
install -Dm644 "$srcdir/tinyxml.pc" "${pkgdir}${MINGW_PREFIX}/lib/pkgconfig/tinyxml.pc"
install -Dm644 tinyxml.h "${pkgdir}${MINGW_PREFIX}/include/tinyxml.h"
install -m644 tinystr.h "${pkgdir}${MINGW_PREFIX}/include/"
sed -i "s,@PREFIX@,${MINGW_PREFIX}," "${pkgdir}${MINGW_PREFIX}/lib/pkgconfig/tinyxml.pc"
find "${pkgdir}${MINGW_PREFIX}" -name '*.def' -o -name '*.exp' | xargs -rtl1 rm
}

View File

@@ -0,0 +1,64 @@
? entity.patch
Index: tinyxml.cpp
===================================================================
RCS file: /cvsroot/tinyxml/tinyxml/tinyxml.cpp,v
retrieving revision 1.105
diff -u -r1.105 tinyxml.cpp
--- tinyxml.cpp 5 Jun 2010 19:06:57 -0000 1.105
+++ tinyxml.cpp 19 Jul 2010 21:24:16 -0000
@@ -57,30 +57,7 @@
{
unsigned char c = (unsigned char) str[i];
- if ( c == '&'
- && i < ( (int)str.length() - 2 )
- && str[i+1] == '#'
- && str[i+2] == 'x' )
- {
- // Hexadecimal character reference.
- // Pass through unchanged.
- // &#xA9; -- copyright symbol, for example.
- //
- // The -1 is a bug fix from Rob Laveaux. It keeps
- // an overflow from happening if there is no ';'.
- // There are actually 2 ways to exit this loop -
- // while fails (error case) and break (semicolon found).
- // However, there is no mechanism (currently) for
- // this function to return an error.
- while ( i<(int)str.length()-1 )
- {
- outString->append( str.c_str() + i, 1 );
- ++i;
- if ( str[i] == ';' )
- break;
- }
- }
- else if ( c == '&' )
+ if ( c == '&' )
{
outString->append( entity[0].str, entity[0].strLength );
++i;
Index: xmltest.cpp
===================================================================
RCS file: /cvsroot/tinyxml/tinyxml/xmltest.cpp,v
retrieving revision 1.89
diff -u -r1.89 xmltest.cpp
--- xmltest.cpp 5 Jun 2010 17:41:52 -0000 1.89
+++ xmltest.cpp 19 Jul 2010 21:24:16 -0000
@@ -1340,6 +1340,16 @@
}*/
}
+ #ifdef TIXML_USE_STL
+ {
+ TiXmlDocument xml;
+ xml.Parse("<foo>foo&amp;#xa+bar</foo>");
+ std::string str;
+ str << xml;
+ XmlTest( "Entity escaping", "<foo>foo&amp;#xa+bar</foo>", str.c_str() );
+ }
+ #endif
+
/* 1417717 experiment
{
TiXmlDocument xml;

View File

@@ -0,0 +1,12 @@
diff -up tinyxml/tinyxml.h~ tinyxml/tinyxml.h
--- tinyxml/tinyxml.h~ 2007-11-30 22:39:36.000000000 +0100
+++ tinyxml/tinyxml.h 2007-11-30 22:39:36.000000000 +0100
@@ -26,6 +26,8 @@ distribution.
#ifndef TINYXML_INCLUDED
#define TINYXML_INCLUDED
+#define TIXML_USE_STL 1
+
#ifdef _MSC_VER
#pragma warning( push )
#pragma warning( disable : 4530 )

View File

@@ -0,0 +1,10 @@
prefix=@PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: TinyXml
Description: simple, small, C++ XML parser
Version: 2.6.2
Libs: -L${libdir} -ltinyxml
Cflags: -I${includedir}