1 { lib, stdenv, fetchurl, unzip }:
5 SHLIB_EXT = stdenv.hostPlatform.extensions.sharedLibrary;
6 in stdenv.mkDerivation {
11 url = "mirror://sourceforge/project/tinyxml/tinyxml/${version}/tinyxml_2_6_2.zip";
12 sha256 = "04nmw6im2d1xp12yir8va93xns5iz816pwi25n9cql3g3i8bjsxc";
17 ./2.6.2-add-pkgconfig.patch
19 # https://sourceforge.net/tracker/index.php?func=detail&aid=3031828&group_id=13559&atid=313559
22 # Use CC, CXX, and LD from environment
26 preConfigure = "export LD=${stdenv.cc.targetPrefix}c++";
28 hardeningDisable = [ "format" ];
31 lib.optionalString stdenv.isDarwin "-mmacosx-version-min=10.9";
33 nativeBuildInputs = [ unzip ];
35 # use STL (xbmc requires it)
36 sed '1i#define TIXML_USE_STL 1' -i tinyxml.h
37 sed '1i#define TIXML_USE_STL 1' -i xmltest.cpp
42 # build the lib as a shared library
43 ''${CXX} -Wall -O2 -shared -fpic tinyxml.cpp \
44 tinyxmlerror.cpp tinyxmlparser.cpp \
45 tinystr.cpp -o libtinyxml${SHLIB_EXT}
52 if [[ $result != 0 ]] ; then
58 mkdir -pv $out/include/
59 mkdir -pv $out/lib/pkgconfig/
60 mkdir -pv $out/share/doc/tinyxml/
62 cp -v libtinyxml${SHLIB_EXT} $out/lib/
63 cp -v *.h $out/include/
65 substituteInPlace tinyxml.pc --replace "@out@" "$out"
66 substituteInPlace tinyxml.pc --replace "@version@" "${version}"
67 cp -v tinyxml.pc $out/lib/pkgconfig/
69 cp -v docs/* $out/share/doc/tinyxml/
70 '' + lib.optionalString stdenv.isDarwin ''
71 install_name_tool -id $out/lib/libtinyxml.dylib $out/lib/libtinyxml.dylib
75 description = "Simple, small, C++ XML parser that can be easily integrating into other programs";
76 homepage = "http://www.grinninglizard.com/tinyxml/index.html";
77 license = lib.licenses.free;
78 platforms = lib.platforms.unix;