From 954d69800ec694cf5edb5425bb6f9818174f737d Mon Sep 17 00:00:00 2001 From: Pooya Moradi Date: Thu, 1 Sep 2022 19:09:11 +0430 Subject: [PATCH] new package: libtinyxml --- packages/libtinyxml/build.sh | 33 ++++++++++ .../libtinyxml/tinyxml-2.6.1-entity.patch | 64 +++++++++++++++++++ .../libtinyxml/tinyxml-2.6.2-defineSTL.patch | 12 ++++ 3 files changed, 109 insertions(+) create mode 100644 packages/libtinyxml/build.sh create mode 100644 packages/libtinyxml/tinyxml-2.6.1-entity.patch create mode 100644 packages/libtinyxml/tinyxml-2.6.2-defineSTL.patch diff --git a/packages/libtinyxml/build.sh b/packages/libtinyxml/build.sh new file mode 100644 index 0000000000..45412f2f4d --- /dev/null +++ b/packages/libtinyxml/build.sh @@ -0,0 +1,33 @@ +TERMUX_PKG_HOMEPAGE="https://sourceforge.net/projects/tinyxml" +TERMUX_PKG_DESCRIPTION="A simple, small, C++ XML parser" +TERMUX_PKG_LICENSE="ZLIB" +TERMUX_PKG_LICENSE_FILE="readme.txt" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION="2.6.2" +TERMUX_PKG_SRCURL="http://downloads.sourceforge.net/tinyxml/tinyxml_${TERMUX_PKG_VERSION//./_}.tar.gz" +TERMUX_PKG_SHA256=15bdfdcec58a7da30adc87ac2b078e4417dbe5392f3afb719f9ba6d062645593 +TERMUX_PKG_BUILD_IN_SRC=true +TERMUX_PKG_DEPENDS="libc++" +TERMUX_PKG_BLACKLISTED_ARCHES="aarch64, arm, i686" + +termux_step_pre_configure() { + sed -i Makefile \ + -e '/^TINYXML_USE_STL/ s|=.*|=YES|' \ + -e "s|^RELEASE_CFLAGS.*|& ${CXXFLAGS/-Oz/-Os} -fPIC|" +} + +termux_step_make() { + make -j $TERMUX_MAKE_PROCESSES + g++ -fPIC $CXXFLAGS -shared -o libtinyxml.so.0.$TERMUX_PKG_VERSION \ + -Wl,-soname,libtinyxml.so.0 $(ls *.o | grep -v xmltest) +} + +termux_step_make_install() { + install -m 0755 "libtinyxml.so.0.$TERMUX_PKG_VERSION" \ + "$TERMUX_PREFIX/lib/" + install -m 0644 tinyxml.h tinystr.h \ + "$TERMUX_PREFIX/include/" + cd "$TERMUX_PREFIX/lib" + ln -s "libtinyxml.so.0.$TERMUX_PKG_VERSION" libtinyxml.so + ln -s "libtinyxml.so.0.$TERMUX_PKG_VERSION" libtinyxml.so.0 +} diff --git a/packages/libtinyxml/tinyxml-2.6.1-entity.patch b/packages/libtinyxml/tinyxml-2.6.1-entity.patch new file mode 100644 index 0000000000..2ccbd701ac --- /dev/null +++ b/packages/libtinyxml/tinyxml-2.6.1-entity.patch @@ -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 +--- a/tinyxml.cpp 5 Jun 2010 19:06:57 -0000 1.105 ++++ b/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. +- // © -- 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 +--- a/xmltest.cpp 5 Jun 2010 17:41:52 -0000 1.89 ++++ b/xmltest.cpp 19 Jul 2010 21:24:16 -0000 +@@ -1340,6 +1340,16 @@ + }*/ + } + ++ #ifdef TIXML_USE_STL ++ { ++ TiXmlDocument xml; ++ xml.Parse("foo&#xa+bar"); ++ std::string str; ++ str << xml; ++ XmlTest( "Entity escaping", "foo&#xa+bar", str.c_str() ); ++ } ++ #endif ++ + /* 1417717 experiment + { + TiXmlDocument xml; diff --git a/packages/libtinyxml/tinyxml-2.6.2-defineSTL.patch b/packages/libtinyxml/tinyxml-2.6.2-defineSTL.patch new file mode 100644 index 0000000000..7bcde59ff9 --- /dev/null +++ b/packages/libtinyxml/tinyxml-2.6.2-defineSTL.patch @@ -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 )