From d708d0c36e202bbad7255c3b8a55ca0afdd18cb3 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Tue, 24 Nov 2015 13:35:44 -0500 Subject: [PATCH 1/3] gnu: Add tinyxml. * gnu/packages/xml.scm (tinyxml): New variable. * gnu/packages/patches/tinyxml-use-stl.patch: New file. * gnu-system.am (dist_patch_DATA): Add it. --- gnu-system.am | 1 + gnu/packages/patches/tinyxml-use-stl.patch | 38 +++++++++++++++++ gnu/packages/xml.scm | 67 ++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 gnu/packages/patches/tinyxml-use-stl.patch diff --git a/gnu-system.am b/gnu-system.am index 61dfced..c97430f 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -695,6 +695,7 @@ dist_patch_DATA = \ gnu/packages/patches/texi2html-document-encoding.patch \ gnu/packages/patches/texi2html-i18n.patch \ gnu/packages/patches/tidy-CVE-2015-5522+5523.patch \ + gnu/packages/patches/tinyxml-use-stl.patch \ gnu/packages/patches/torsocks-dns-test.patch \ gnu/packages/patches/tvtime-gcc41.patch \ gnu/packages/patches/tvtime-pngoutput.patch \ diff --git a/gnu/packages/patches/tinyxml-use-stl.patch b/gnu/packages/patches/tinyxml-use-stl.patch new file mode 100644 index 0000000..ddc21d8 --- /dev/null +++ b/gnu/packages/patches/tinyxml-use-stl.patch @@ -0,0 +1,38 @@ +From a53b6ee4519a7657164610ac14a82c57b1273bf6 Mon Sep 17 00:00:00 2001 +From: David Thompson +Date: Mon, 23 Nov 2015 06:54:36 -0500 +Subject: [PATCH] Use STL. + +--- + tinyxml.h | 2 ++ + xmltest.cpp | 1 + + 2 files changed, 3 insertions(+) + +diff --git a/tinyxml.h b/tinyxml.h +index a3589e5..6cbfc7d 100644 +--- a/tinyxml.h ++++ b/tinyxml.h +@@ -43,6 +43,8 @@ distribution. + #define DEBUG + #endif + ++#define TIXML_USE_STL 1 ++ + #ifdef TIXML_USE_STL + #include + #include +diff --git a/xmltest.cpp b/xmltest.cpp +index 663c157..057dbfe 100644 +--- a/xmltest.cpp ++++ b/xmltest.cpp +@@ -2,6 +2,7 @@ + Test program for TinyXML. + */ + ++#define TIXML_USE_STL 1 + + #ifdef TIXML_USE_STL + #include +-- +2.5.0 + diff --git a/gnu/packages/xml.scm b/gnu/packages/xml.scm index a296e0a..7d7e167 100644 --- a/gnu/packages/xml.scm +++ b/gnu/packages/xml.scm @@ -511,3 +511,70 @@ Libxml2).") UTF-8 and UTF-16 encoding.") ;; LGPL 2.0+ with additional exceptions for static linking (license license:lgpl2.0+))) + +;; TinyXML is an unmaintained piece of software, so the patches and build +;; system massaging have no upstream potential. +(define-public tinyxml + (package + (name "tinyxml") + (version "2.6.2") + (source (origin + (method url-fetch) + (uri (string-append "mirror://sourceforge/tinyxml/tinyxml_" + (string-join (string-split version #\.) "_") + ".tar.gz")) + (sha256 + (base32 + "14smciid19lvkxqznfig77jxn5s4iq3jpb47vh5a6zcaqp7gvg8m")) + (patches (list (search-patch "tinyxml-use-stl.patch"))))) + (build-system gnu-build-system) + ;; This library is missing *a lot* of the steps to make it usable, so we + ;; have to add them here, like every other distro must do. + (arguments + `(#:phases + (modify-phases %standard-phases + (delete 'configure) + (add-after 'build 'build-shared-library + (lambda _ + (zero? (system* "g++" "-Wall" "-O2" "-shared" "-fpic" + "tinyxml.cpp" "tinyxmlerror.cpp" + "tinyxmlparser.cpp" "tinystr.cpp" + "-o" "libtinyxml.so")))) + (replace 'check + (lambda _ (zero? (system "./xmltest")))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (include (string-append out "/include")) + (lib (string-append out "/lib")) + (pkgconfig (string-append out "/lib/pkgconfig")) + (doc (string-append out "/share/doc"))) + ;; Install libs and headers. + (install-file "libtinyxml.so" lib) + (install-file "tinystr.h" include) + (install-file "tinyxml.h" include) + ;; Generate and install pkg-config file. + (mkdir-p pkgconfig) + (call-with-output-file (string-append pkgconfig "/tinyxml.pc") + (lambda (port) + (format port "prefix=~a +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: TinyXML +Description: A simple, small, C++ XML parser +Version: ~a +Libs: -L${libdir} -ltinyxml +Cflags: -I${includedir} +" + out ,version))) + ;; Install docs. + (mkdir-p doc) + (copy-recursively "docs" (string-append doc "tinyxml")) + #t)))))) + (synopsis "Small XML parser for C++") + (description "TinyXML is a small and simple XML parsing library for the +C++ programming langauge.") + (home-page "http://www.grinninglizard.com/tinyxml/index.html") + (license license:zlib))) -- 2.5.0