summary refs log tree commit diff
path: root/gnu/packages/xml.scm
diff options
context:
space:
mode:
authorJulien Lepiller <julien@lepiller.eu>2018-02-10 18:10:49 +0100
committerJulien Lepiller <julien@lepiller.eu>2018-02-10 19:04:19 +0100
commit605c23df5bd81b95590ca0af06fa12f19711e297 (patch)
tree8d62c3a8d6258643232244e5f594ac292ea7e455 /gnu/packages/xml.scm
parent9421f682244d5e8b1dcb17a042b38c0c83fc43d8 (diff)
downloadguix-605c23df5bd81b95590ca0af06fa12f19711e297.tar.gz
gnu: Add java-dom4j.
gnu/packages/xml.scm (java-dom4j): New variable.
Diffstat (limited to 'gnu/packages/xml.scm')
-rw-r--r--gnu/packages/xml.scm72
1 files changed, 72 insertions, 0 deletions
diff --git a/gnu/packages/xml.scm b/gnu/packages/xml.scm
index af2097a70d..b95a38797c 100644
--- a/gnu/packages/xml.scm
+++ b/gnu/packages/xml.scm
@@ -1750,3 +1750,75 @@ parser and should be used when there is a need to process quickly and
 efficiently all input elements (for example in SOAP processors).  This
 package is in maintenance mode.")
     (license (license:non-copyleft "file:///LICENSE.txt"))))
+
+(define-public java-dom4j
+  (package
+    (name "java-dom4j")
+    (version "2.1.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/dom4j/dom4j/archive/"
+                                  "version-" version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "101drpnw6agmcvsi1jrfi0kn97r7liazrh5jbrip9vx26axn2fx9"))
+              (modules '((guix build utils)))
+              (snippet
+                '(begin ;; Delete bundled jar archives.
+                   (for-each delete-file (find-files "." ".*\\.jar"))
+                   #t))))
+    (build-system ant-build-system)
+    (arguments
+     `(#:jar-name "dom4j.jar"
+       #:jdk ,icedtea-8
+       #:source-dir "src/main/java"
+       ;; FIXME: Requires xalan, but xalan depends on java-cup which has a
+       ;; dependency on itself through jflex.
+       #:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'copy-jaxen-sources
+           ;; java-jaxen-bootstrap is not enough. These files have a circular
+           ;; dependency and there is no subset of dom4j that would allow
+           ;; breaking the circle.
+           (lambda* (#:key inputs #:allow-other-keys)
+             (mkdir-p "jaxen-sources")
+             (with-directory-excursion "jaxen-sources"
+               (system* "jar" "xf" (assoc-ref inputs "java-jaxen-sources")))
+             (mkdir-p "src/main/java/org/jaxen/dom4j")
+             (copy-file "jaxen-sources/org/jaxen/dom4j/DocumentNavigator.java"
+                        "src/main/java/org/jaxen/dom4j/DocumentNavigator.java")
+             (copy-file "jaxen-sources/org/jaxen/dom4j/Dom4jXPath.java"
+                        "src/main/java/org/jaxen/dom4j/Dom4jXPath.java")
+             #t))
+         (add-before 'build 'fix-old-xpp2
+           (lambda _
+             ;; This package normally depends on xpp2 2.0, but version 2.1.10
+             ;; is the only version whose source code is published.
+             (substitute* "src/main/java/org/dom4j/xpp/ProxyXmlStartTag.java"
+               (("public void resetStartTag")
+                "public boolean removeAttributeByRawName(String name) {\n
+  return false;\n
+}\n
+public boolean removeAttributeByName(String name, String name2) {\n
+  return false;\n
+}\n\npublic void resetStartTag")
+               (("Atttribute") "Attribute"))
+             #t)))))
+    (inputs
+     `(("java-jaxen-bootstrap" ,java-jaxen-bootstrap)
+       ("java-jaxen-sources" ,(package-source java-jaxen-bootstrap))
+       ("java-xmlpull2" ,java-xmlpull2)
+       ("java-xpp3" ,java-xpp3)
+       ("java-xsdlib" ,java-xsdlib)))
+    (native-inputs
+     `(("java-testng" ,java-testng)
+       ("java-xerces" ,java-xerces)))
+    (home-page "https://dom4j.github.io/")
+    (synopsis "Flexible XML framework for Java")
+    (description "Dom4j is a flexible XML framework for Java.  DOM4J works
+with DOM, SAX, XPath, and XSLT.  It can parse large XML documents with very
+low memory footprint.")
+    ;; some BSD-like 5-clause license
+    (license (license:non-copyleft "file://LICENSE"))))