2021-01-21 17:00:13 +00:00
|
|
|
{ lib, stdenv, fetchurl, unzip }:
|
2012-12-31 10:13:55 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
version = "2.6.2";
|
2017-09-12 19:36:41 +00:00
|
|
|
SHLIB_EXT = stdenv.hostPlatform.extensions.sharedLibrary;
|
2012-12-31 10:13:55 +00:00
|
|
|
in stdenv.mkDerivation {
|
2019-08-13 21:52:01 +00:00
|
|
|
pname = "tinyxml";
|
|
|
|
inherit version;
|
2014-11-06 00:44:33 +00:00
|
|
|
|
2012-12-31 10:13:55 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://sourceforge/project/tinyxml/tinyxml/${version}/tinyxml_2_6_2.zip";
|
|
|
|
sha256 = "04nmw6im2d1xp12yir8va93xns5iz816pwi25n9cql3g3i8bjsxc";
|
|
|
|
};
|
2014-11-06 00:44:33 +00:00
|
|
|
|
2012-12-31 10:13:55 +00:00
|
|
|
patches = [
|
2021-01-19 06:50:56 +00:00
|
|
|
# add pkg-config file
|
2012-12-31 10:13:55 +00:00
|
|
|
./2.6.2-add-pkgconfig.patch
|
2014-11-06 00:44:33 +00:00
|
|
|
|
2018-12-01 18:49:28 +00:00
|
|
|
# https://sourceforge.net/tracker/index.php?func=detail&aid=3031828&group_id=13559&atid=313559
|
2012-12-31 10:13:55 +00:00
|
|
|
./2.6.2-entity.patch
|
2016-04-01 18:56:07 +00:00
|
|
|
|
|
|
|
# Use CC, CXX, and LD from environment
|
|
|
|
./2.6.2-cxx.patch
|
2012-12-31 10:13:55 +00:00
|
|
|
];
|
2018-05-13 01:08:06 +00:00
|
|
|
|
2020-04-02 02:18:53 +00:00
|
|
|
preConfigure = "export LD=${stdenv.cc.targetPrefix}c++";
|
2016-04-01 18:56:07 +00:00
|
|
|
|
2018-05-13 01:08:06 +00:00
|
|
|
hardeningDisable = [ "format" ];
|
|
|
|
|
2016-04-01 18:56:07 +00:00
|
|
|
NIX_CFLAGS_COMPILE =
|
2021-01-21 17:00:13 +00:00
|
|
|
lib.optionalString stdenv.isDarwin "-mmacosx-version-min=10.9";
|
2014-11-06 00:44:33 +00:00
|
|
|
|
2020-04-02 02:18:53 +00:00
|
|
|
nativeBuildInputs = [ unzip ];
|
2012-12-31 10:13:55 +00:00
|
|
|
buildPhase = ''
|
2013-03-12 00:35:16 +00: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 10:13:55 +00:00
|
|
|
# build xmltest
|
2013-03-12 01:22:59 +00:00
|
|
|
make
|
2014-11-06 00:44:33 +00:00
|
|
|
|
2012-12-31 10:13:55 +00:00
|
|
|
# build the lib as a shared library
|
2016-04-01 18:56:07 +00:00
|
|
|
''${CXX} -Wall -O2 -shared -fpic tinyxml.cpp \
|
2012-12-31 10:13:55 +00:00
|
|
|
tinyxmlerror.cpp tinyxmlparser.cpp \
|
2017-09-12 19:36:41 +00:00
|
|
|
tinystr.cpp -o libtinyxml${SHLIB_EXT}
|
2012-12-31 10:13:55 +00:00
|
|
|
'';
|
2014-11-06 00:44:33 +00:00
|
|
|
|
2012-12-31 10:13:55 +00:00
|
|
|
doCheck = true;
|
|
|
|
checkPhase = ''
|
|
|
|
./xmltest
|
|
|
|
result=$?
|
|
|
|
if [[ $result != 0 ]] ; then
|
|
|
|
exit $result
|
|
|
|
fi
|
|
|
|
'';
|
2014-11-06 00:44:33 +00:00
|
|
|
|
2012-12-31 10:13:55 +00:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -pv $out/include/
|
|
|
|
mkdir -pv $out/lib/pkgconfig/
|
|
|
|
mkdir -pv $out/share/doc/tinyxml/
|
2014-11-06 00:44:33 +00:00
|
|
|
|
2017-09-12 19:36:41 +00:00
|
|
|
cp -v libtinyxml${SHLIB_EXT} $out/lib/
|
2012-12-31 10:13:55 +00:00
|
|
|
cp -v *.h $out/include/
|
2014-11-06 00:44:33 +00:00
|
|
|
|
2012-12-31 10:13:55 +00:00
|
|
|
substituteInPlace tinyxml.pc --replace "@out@" "$out"
|
|
|
|
substituteInPlace tinyxml.pc --replace "@version@" "${version}"
|
|
|
|
cp -v tinyxml.pc $out/lib/pkgconfig/
|
2014-11-06 00:44:33 +00:00
|
|
|
|
2012-12-31 10:13:55 +00:00
|
|
|
cp -v docs/* $out/share/doc/tinyxml/
|
2021-01-21 17:00:13 +00:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
2016-10-28 23:11:58 +00:00
|
|
|
install_name_tool -id $out/lib/libtinyxml.dylib $out/lib/libtinyxml.dylib
|
2012-12-31 10:13:55 +00:00
|
|
|
'';
|
2014-11-06 00:44:33 +00:00
|
|
|
|
2012-12-31 10:13:55 +00:00
|
|
|
meta = {
|
2013-10-06 09:49:53 +00:00
|
|
|
description = "Simple, small, C++ XML parser that can be easily integrating into other programs";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "http://www.grinninglizard.com/tinyxml/index.html";
|
2021-01-21 17:00:13 +00:00
|
|
|
license = lib.licenses.free;
|
|
|
|
platforms = lib.platforms.unix;
|
2012-12-31 10:13:55 +00:00
|
|
|
};
|
|
|
|
}
|