2012-12-31 14:13:55 +04:00
|
|
|
{ stdenv, fetchurl, unzip }:
|
|
|
|
|
|
|
|
let
|
|
|
|
version = "2.6.2";
|
|
|
|
in stdenv.mkDerivation {
|
|
|
|
name = "tinyxml-${version}";
|
2014-11-06 03:44:33 +03:00
|
|
|
|
2012-12-31 14:13:55 +04:00
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://sourceforge/project/tinyxml/tinyxml/${version}/tinyxml_2_6_2.zip";
|
|
|
|
sha256 = "04nmw6im2d1xp12yir8va93xns5iz816pwi25n9cql3g3i8bjsxc";
|
|
|
|
};
|
2014-11-06 03:44:33 +03:00
|
|
|
|
2012-12-31 14:13:55 +04:00
|
|
|
patches = [
|
|
|
|
# add pkgconfig file
|
|
|
|
./2.6.2-add-pkgconfig.patch
|
2014-11-06 03:44:33 +03:00
|
|
|
|
2012-12-31 14:13:55 +04:00
|
|
|
# http://sourceforge.net/tracker/index.php?func=detail&aid=3031828&group_id=13559&atid=313559
|
|
|
|
./2.6.2-entity.patch
|
|
|
|
];
|
2014-11-06 03:44:33 +03:00
|
|
|
|
2012-12-31 14:13:55 +04:00
|
|
|
buildInputs = [ unzip ];
|
|
|
|
buildPhase = ''
|
2013-03-12 04:35:16 +04:00
|
|
|
# use STL (xbmc requires it)
|
|
|
|
sed '1i#define TIXML_USE_STL 1' -i tinyxml.h
|
|
|
|
sed '1i#define TIXML_USE_STL 1' -i xmltest.cpp
|
|
|
|
|
2012-12-31 14:13:55 +04:00
|
|
|
# build xmltest
|
2013-03-12 05:22:59 +04:00
|
|
|
make
|
2014-11-06 03:44:33 +03:00
|
|
|
|
2012-12-31 14:13:55 +04:00
|
|
|
# build the lib as a shared library
|
|
|
|
g++ -Wall -O2 -shared -fpic tinyxml.cpp \
|
|
|
|
tinyxmlerror.cpp tinyxmlparser.cpp \
|
|
|
|
tinystr.cpp -o libtinyxml.so
|
|
|
|
'';
|
2014-11-06 03:44:33 +03:00
|
|
|
|
2012-12-31 14:13:55 +04:00
|
|
|
doCheck = true;
|
|
|
|
checkPhase = ''
|
|
|
|
./xmltest
|
|
|
|
result=$?
|
|
|
|
if [[ $result != 0 ]] ; then
|
|
|
|
exit $result
|
|
|
|
fi
|
|
|
|
'';
|
2014-11-06 03:44:33 +03:00
|
|
|
|
2012-12-31 14:13:55 +04:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -pv $out/include/
|
|
|
|
mkdir -pv $out/lib/pkgconfig/
|
|
|
|
mkdir -pv $out/share/doc/tinyxml/
|
2014-11-06 03:44:33 +03:00
|
|
|
|
2012-12-31 14:13:55 +04:00
|
|
|
cp -v libtinyxml.so $out/lib/
|
|
|
|
cp -v *.h $out/include/
|
2014-11-06 03:44:33 +03:00
|
|
|
|
2012-12-31 14:13:55 +04:00
|
|
|
substituteInPlace tinyxml.pc --replace "@out@" "$out"
|
|
|
|
substituteInPlace tinyxml.pc --replace "@version@" "${version}"
|
|
|
|
cp -v tinyxml.pc $out/lib/pkgconfig/
|
2014-11-06 03:44:33 +03:00
|
|
|
|
2012-12-31 14:13:55 +04:00
|
|
|
cp -v docs/* $out/share/doc/tinyxml/
|
|
|
|
'';
|
2014-11-06 03:44:33 +03:00
|
|
|
|
2012-12-31 14:13:55 +04:00
|
|
|
meta = {
|
2013-10-06 13:49:53 +04:00
|
|
|
description = "Simple, small, C++ XML parser that can be easily integrating into other programs";
|
2012-12-31 14:13:55 +04:00
|
|
|
homepage = "http://www.grinninglizard.com/tinyxml/index.html";
|
2014-11-06 03:44:33 +03:00
|
|
|
license = stdenv.lib.licenses.free;
|
2012-12-31 14:13:55 +04:00
|
|
|
};
|
|
|
|
}
|