gnu: r-zellkonverter: Update to 1.6.5.
[jackhill/guix/guix.git] / gnu / packages / docbook.scm
index 9f47dad..9f2869e 100644 (file)
@@ -1,11 +1,13 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2021-2022 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
-;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2021 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2021 Andrew Whatson <whatson@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
 
 (define-module (gnu packages docbook)
   #:use-module (gnu packages)
+  #:use-module (gnu packages bash)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages imagemagick)
   #:use-module (gnu packages inkscape)
   #:use-module (gnu packages tex)
+  #:use-module (gnu packages texinfo)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages python)
   #:use-module (gnu packages base)
   #:use-module (gnu packages web-browsers)
   #:use-module (gnu packages xml)
-  #:use-module (guix licenses)
+  #:use-module (guix gexp)
+  #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module ((guix build utils) #:select (alist-replace))
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system trivial)
   #:use-module (guix build-system python))
                 (string-append
                  "uri=\"file://" dtd "/")))
              #t)))))
-    (native-inputs `(("unzip" ,unzip)))
+    (native-inputs (list unzip))
     (home-page "https://docbook.org")
     (synopsis "DocBook XML DTDs for document authoring")
     (description
      "DocBook is general purpose XML and SGML document type particularly well
 suited to books and papers about computer hardware and software (though it is
 by no means limited to these applications.)  This package provides XML DTDs.")
-    (license (x11-style "" "See file headers."))))
+    (license (license:x11-style "" "See file headers."))))
 
 (define-public docbook-xml
   (package
@@ -216,14 +223,165 @@ by no means limited to these applications.)  This package provides XML DTDs.")
                                        name-version "/")))
                      #t))
        #:modules ((guix build utils))))
-    (native-inputs `(("bzip2" ,bzip2)
-                     ("xz" ,xz)         ;needed for repacked tarballs
-                     ("tar" ,tar)))
+    (native-inputs (list bzip2 xz ;needed for repacked tarballs
+                         tar))
     (home-page "https://docbook.org")
     (synopsis "DocBook XSL style sheets for document authoring")
     (description
      "This package provides XSL style sheets for DocBook.")
-    (license (x11-style "" "See 'COPYING' file."))))
+    (license (license:x11-style "" "See 'COPYING' file."))))
+
+;;; TODO: Make this the default docbook-xsl on core-updates.  There's an issue
+;;; in docbook-xsl 1.79.2 that causes manpages to be generated incorrectly and
+;;; embed raw nroff syntax such as '.PP' when there is a
+;;; namespace/non-namespace mismatch between the sources and the stylesheets
+;;; used (see: https://github.com/docbook/xslt10-stylesheets/issues/109).
+(define-public docbook-xsl-next
+  (let ((commit "fe16c90013b64e316c3e21ef92d1e8813c10f88c")
+        (revision "0")
+        (base-version (package-version docbook-xsl)))
+    (package
+      (inherit docbook-xsl)
+      (name "docbook-xsl")
+      (version (git-version base-version revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/docbook/xslt10-stylesheets")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                ;; Multiple .jar files are bundled with the sources.
+                (modules '((guix build utils)))
+                (snippet '(for-each delete-file (find-files "." "\\.jar$")))
+                (sha256
+                 (base32
+                  "1bl8dwrcy7skrlh80fpsmiw045bv2j0aym231ikcv3hvm2pi98dj"))))
+      (build-system gnu-build-system)
+      (arguments
+       (list
+        #:make-flags #~(list "XSLTENGINE=xsltproc")
+        #:phases
+        #~(modify-phases %standard-phases
+            (replace 'configure
+              (lambda _
+                ;; The build systems insist on a ~/.xmlc, and it is simpler to
+                ;; create a dummy config file than to patch it into
+                ;; submission.
+                (setenv "HOME" "/tmp")
+                (call-with-output-file "/tmp/.xmlc"
+                  (lambda (port)
+                    (format port "\
+<?xml version='1.0' encoding='utf-8'?> <!-- -*- nxml -*- -->
+<config>
+  <java xml:id=\"bigmem\">
+    <java-option name=\"Xmx512m\"/>
+  </java>
+  <xsltproc xml:id=\"xsltproc\" exec=\"xsltproc\"></xsltproc>
+  <xmllint xml:id=\"xmllint\" exec=\"xmllint\"></xmllint>
+</config>\n")))
+                (substitute* "xsl/Makefile"
+                  ;; Do not build webhelp files, as they require a Saxon from
+                  ;; 2005, which is not packaged in Guix.
+                  ((" webhelp") ""))))
+            (add-before 'install 'generate-catalog.xml
+              (lambda* (#:key make-flags #:allow-other-keys)
+                (apply invoke "make" "-C" "xsl" "catalog.xml" make-flags)))
+            (replace 'install
+              (lambda _
+                (let ((xml (string-append #$output "/xml/xsl/"
+                                          #$name "-" #$version))
+                      (select-rx (make-regexp
+                                  "(\\.xml$|\\.xsl$|\\.dtd$|\\.ent$)")))
+                  ;; Install catalog.
+                  (chdir "xsl")
+                  (install-file "catalog.xml" xml)
+                  (install-file "VERSION.xsl" xml)
+                  (substitute* (string-append xml "/catalog.xml")
+                    ;; Re-add the no longer present compatibility entries.
+                    ((".*</catalog>.*" anchor)
+                     (string-append "\
+  <!-- Also support old URI of v1.79.1 or earlier -->
+  <rewriteURI uriStartString=\"http://docbook.sourceforge.net\
+/release/xsl/current/\" rewritePrefix=\"./\"/>
+  <rewriteSystem systemIdStartString=\"http://docbook.sourceforge.net\
+/release/xsl/current/\" rewritePrefix=\"./\"/>\n" anchor))
+                    (("/snapshot/")
+                     (string-append "/" #$base-version "/"))
+                    (("rewritePrefix=\"./")
+                     (string-append "rewritePrefix=\"file://" xml "/")))
+                  ;; Install style sheets.
+                  (for-each (lambda (dir)
+                              (for-each (lambda (f)
+                                          (install-file
+                                           f (string-append xml "/" (dirname f))))
+                                        (find-files dir select-rx)))
+                            '("assembly" "common" "eclipse" "epub" "epub3" "fo"
+                              "highlighting" "html" "htmlhelp" "javahelp" "lib"
+                              "manpages" "params" "profiling" "roundtrip"
+                              "template" "website"
+                              "xhtml" "xhtml-1_1" "xhtml5"))))))))
+      (native-inputs (list libxml2
+                           libxslt
+                           perl
+                           perl-xml-xpath)))))
+
+(define-public docbook-xsl-1.79.1
+  (package
+    (name "docbook-xsl")
+    (version "1.79.1")
+    (source (origin
+              (method url-fetch)
+              ;; At the time, the non namespaced version was still the
+              ;; default; our latest docbook-xsl is namespaced, so for
+              ;; consistency preserves this property for older versions too.
+              (uri (string-append "mirror://sourceforge/docbook/"
+                                  name "-ns/" version "/"
+                                  name "-ns-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "170ggf5dgjar65kkn5n33kvjr3pdinpj66nnxfx8b2avw0k91jin"))))
+    (build-system copy-build-system)
+    (outputs '("out" "doc"))
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          ;; XXX: The copy-build-system doesn't seem to allow installing to a
+          ;; different output.
+          (replace 'install
+            (lambda _
+              (let ((xml (string-append #$output "/xml/xsl/" #$name "-" #$version))
+                    (doc (string-append #$output:doc
+                                        "/share/doc/" #$name "-" #$version))
+                    (select-rx (make-regexp
+                                "(\\.xml$|\\.xsl$|\\.dtd$|\\.ent$)")))
+                ;; Install catalog.
+                (install-file "catalog.xml" xml)
+                (install-file "VERSION.xsl" xml)
+                (substitute* (string-append xml "/catalog.xml")
+                  (("rewritePrefix=\"./")
+                   (string-append "rewritePrefix=\"file://" xml "/")))
+                ;; Install style sheets.
+                (for-each (lambda (dir)
+                            (for-each (lambda (f)
+                                        (install-file
+                                         f (string-append xml "/" (dirname f))))
+                                      (find-files dir select-rx)))
+                          '("assembly" "common" "eclipse" "epub" "epub3" "fo"
+                            "highlighting" "html" "htmlhelp" "javahelp" "lib"
+                            "manpages" "params" "profiling" "roundtrip"
+                            "template" "website"
+                            "xhtml" "xhtml-1_1" "xhtml5"))
+                ;; Install documentation.
+                (install-file "NEWS" doc)
+                (install-file "RELEASE-NOTES.html" doc)
+                (copy-recursively "slides" doc)
+                (copy-recursively "webhelp" doc)))))))
+    (home-page "https://docbook.org")
+    (synopsis "DocBook XSL namespaced style sheets for document authoring")
+    (description "This package provides the @emph{namespaced} XSL style sheets
+for DocBook.")
+    (license (license:x11-style "" "See 'COPYING' file."))))
 
 (define-public docbook-dsssl
   (package
@@ -257,14 +415,13 @@ by no means limited to these applications.)  This package provides XML DTDs.")
            ;; The doc output contains 1.4 MiB of HTML documentation.
            (symlink docbook-dsssl-doc doc)))))
     (inputs
-     `(("docbook-dsssl-doc" ,docbook-dsssl-doc)))
+     (list docbook-dsssl-doc))
     (native-inputs
-     `(("bzip2" ,bzip2)
-       ("tar" ,tar)))
+     (list bzip2 tar))
     (home-page "https://docbook.org/")
     (synopsis "DSSSL style sheets for DocBook")
     (description "This package provides DSSSL style sheets for DocBook.")
-    (license (non-copyleft "file://README"))))
+    (license (license:non-copyleft "file://README"))))
 
 ;;; Private variable, used as the 'doc' output of the docbook-dsssl package.
 (define docbook-dsssl-doc
@@ -302,19 +459,20 @@ by no means limited to these applications.)  This package provides XML DTDs.")
     (home-page "https://docbook.org/")
     (synopsis "DocBook DSSSL style sheets documentation")
     (description "Documentation for the DocBook DSSSL style sheets.")
-    (license (non-copyleft "file://doc/LEGALNOTICE.htm"))))
+    (license (license:non-copyleft "file://doc/LEGALNOTICE.htm"))))
 
-(define-public docbook-sgml
+(define-public docbook-sgml-4.2
   (package
     (name "docbook-sgml")
-    (version "4.1")
+    (version "4.2")
     (source (origin
               (method url-fetch)
-              (uri (string-append "https://www.oasis-open.org/docbook/sgml/"
-                                  version "/docbk41.zip"))
+              (uri (string-append
+                    "https://www.oasis-open.org/docbook/sgml/4.2/docbook-"
+                    version ".zip"))
               (sha256
                (base32
-                "04b3gp4zkh9c5g9kvnywdkdfkcqx3kjc04j4mpkr4xk7lgqgrany"))))
+                "1hrm4qmmzi285bkxkc74lxvjvw2gbl7ycbaxhv31h9rl9g4x5sv7"))))
     (build-system trivial-build-system)
     (arguments
      '(#:modules ((guix build utils))
@@ -335,16 +493,30 @@ by no means limited to these applications.)  This package provides XML DTDs.")
            ;; Reference the ISO 8879 character entities.
            ;; e.g. "iso-lat1.gml" --> "<iso-entities-dir>/ISOlat1"
            (substitute* "docbook.cat"
-             (("(.*ISO 8879.*)\"iso-(.*)\\.gml\"" _ head name)
-              (string-append head "\"" iso-entities-dir "/ISO" name "\"")))))))
+             (("\"iso-(.*)\\.gml\"" _ name)
+              (string-append "\"" iso-entities-dir "/ISO" name "\"")))))))
     (native-inputs
-     `(("unzip" ,unzip)))
+     (list unzip))
     (inputs
-     `(("iso-8879-entities" ,iso-8879-entities)))
+     (list iso-8879-entities))
     (home-page "https://docbook.org")
     (synopsis "DocBook SGML style sheets for document authoring")
     (description "This package provides SGML style sheets for DocBook.")
-    (license (x11-style "" "See file headers."))))
+    (license (license:x11-style "" "See file headers."))))
+
+(define-public docbook-sgml-4.1
+  (package
+    (inherit docbook-sgml-4.2)
+    (version "4.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://www.oasis-open.org/docbook/sgml/"
+                                  version "/docbk41.zip"))
+              (sha256
+               (base32
+                "04b3gp4zkh9c5g9kvnywdkdfkcqx3kjc04j4mpkr4xk7lgqgrany"))))))
+
+(define-public docbook-sgml docbook-sgml-4.1)
 
 (define-public docbook-sgml-3.1
   (package
@@ -385,7 +557,7 @@ by no means limited to these applications.)  This package provides XML DTDs.")
     (synopsis "ISO 8879 character entities")
     (description "ISO 8879 character entities that are typically used in
 the in DocBook SGML DTDs.")
-    (license (x11-style "" "See file headers."))))
+    (license (license:x11-style "" "See file headers."))))
 
 (define-public dblatex
   (package
@@ -403,33 +575,37 @@ the in DocBook SGML DTDs.")
     ;; TODO: Add xfig/transfig for fig2dev utility
     (inputs
      `(("texlive" ,(texlive-updmap.cfg (list texlive-amsfonts
-                                        texlive-latex-anysize
-                                        texlive-latex-appendix
-                                        texlive-latex-bookmark
-                                        texlive-latex-changebar
-                                        texlive-latex-colortbl
-                                        texlive-latex-fancybox
-                                        texlive-latex-fancyhdr
-                                        texlive-latex-fancyvrb
-                                        texlive-latex-float
-                                        texlive-latex-footmisc
-                                        texlive-latex-hyperref
-                                        texlive-latex-jknapltx
-                                        texlive-latex-listings
-                                        texlive-latex-multirow
-                                        texlive-latex-overpic
-                                        texlive-latex-pdfpages
-                                        texlive-latex-refcount
-                                        texlive-latex-subfigure
-                                        texlive-latex-titlesec
-                                        texlive-latex-wasysym
+                                             texlive-latex-anysize
+                                             texlive-latex-appendix
+                                             texlive-latex-bookmark
+                                             texlive-latex-changebar
+                                             texlive-latex-colortbl
+                                             texlive-latex-fancybox
+                                             texlive-latex-fancyhdr
+                                             texlive-latex-fancyvrb
+                                             texlive-latex-float
+                                             texlive-latex-footmisc
+                                             texlive-hyperref
+                                             texlive-latex-jknapltx
 
-                                        texlive-fonts-rsfs
-                                        texlive-fonts-stmaryrd
+                                             ;; TODO: Use non-deprecated name on
+                                             ;; next rebuild cycle.
+                                             texlive-latex-listings
 
-                                        texlive-generic-iftex)))
+                                             texlive-latex-multirow
+                                             texlive-latex-overpic
+                                             texlive-latex-pdfpages
+                                             texlive-latex-refcount
+                                             texlive-latex-subfigure
+                                             texlive-latex-titlesec
+                                             texlive-wasysym
+
+                                             texlive-fonts-rsfs
+                                             texlive-stmaryrd
+
+                                             texlive-generic-iftex)))
        ("imagemagick" ,imagemagick)     ;for convert
-       ("inkscape" ,inkscape)           ;for svg conversion
+       ("inkscape" ,inkscape/stable)    ;for svg conversion
        ("docbook" ,docbook-xml)
        ("libxslt" ,libxslt)))           ;for xsltproc
     (arguments
@@ -455,8 +631,7 @@ the in DocBook SGML DTDs.")
                            (string-append (assoc-ref inputs input)
                                           "/bin"))
                          '("libxslt" "texlive"
-                           "imagemagick" "inkscape"))))
-               #t))))))
+                           "imagemagick" "inkscape"))))))))))
     (home-page "http://dblatex.sourceforge.net")
     (synopsis "DocBook to LaTeX Publishing")
     (description
@@ -465,7 +640,7 @@ to DVI, PostScript or PDF by translating them in pure LaTeX as a first
 process.  MathML 2.0 markups are supported too.  It started as a clone of
 DB2LaTeX.")
     ;; lib/contrib/which is under an X11 license
-    (license gpl2+)))
+    (license license:gpl2+)))
 
 ;; This is a variant of the 'dblatex' package that is not updated often.  It
 ;; is intended to be used as a native-input at build-time only, e.g. by
@@ -532,13 +707,13 @@ DB2LaTeX.")
     ;; Propagated for convenience.  All these tools are used at run time to
     ;; provide the complete functionality of the docbook-utils commands.
     (propagated-inputs
-     `(("texlive-jadetex" ,texlive-jadetex)
-       ("docbook-sgml" ,docbook-sgml-3.1)
-       ("docbook-dsssl" ,docbook-dsssl)
-       ("openjade" ,openjade)
-       ("opensp" ,opensp)
-       ("lynx" ,lynx)
-       ("perl-sgmls" ,perl-sgmls)))
+     (list texlive-jadetex
+           docbook-sgml-3.1
+           docbook-dsssl
+           openjade
+           opensp
+           lynx
+           perl-sgmls))
     (home-page "https://packages.debian.org/sid/docbook-utils")
     (synopsis "DocBook converter to other formats")
     (description "The docbook-utils package is a collection of utilities
@@ -561,4 +736,93 @@ more conveniently via the following wrappers:
 @item sgmldiff
 Detect the differences in markup between two SGML files.
 @end table")
-    (license gpl2+)))
+    (license license:gpl2+)))
+
+(define-public docbook2x
+  (package
+    (name "docbook2x")
+    (version "0.8.8")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://sourceforge/docbook2x/docbook2x/"
+                                  version "/docbook2X-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0ifwzk99rzjws0ixzimbvs83x6cxqk1xzmg84wa1p7bs6rypaxs0"))))
+    (build-system gnu-build-system)
+    (inputs
+     `(("bash-minimal" ,bash-minimal)
+       ("docbook-xml" ,docbook-xml)
+       ("perl" ,perl)
+       ("perl-xml-namespacesupport" ,perl-xml-namespacesupport)
+       ("perl-xml-parser" ,perl-xml-parser)
+       ("perl-xml-sax" ,perl-xml-sax)
+       ("perl-xml-sax-base" ,perl-xml-sax-base)
+       ("texinfo" ,texinfo)
+       ("xsltproc" ,libxslt)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'configure 'patch-sources
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             ;; Fix failed substitution in config.pl
+             (substitute* "perl/config.pl"
+               (("\\$\\{prefix\\}")
+                (assoc-ref outputs "out")))
+             ;; Fix a failing test (maybe it worked with old texinfo?)
+             (substitute* "test/complete-manuals/at1.xml"
+               (("<bridgehead>")
+                "<bridgehead renderas=\"sect2\">"))
+             ;; Patch all the tests use DocBook 4.5
+             (substitute* (find-files "test" "\\.xml$")
+               (("\"-//OASIS//DTD DocBook XML V4\\..+//EN\"")
+                "\"-//OASIS//DTD DocBook XML V4.5//EN\"")
+               (("\"http://www\\.oasis-open\\.org/docbook/xml/4\\..+/docbookx.dtd\"")
+                "\"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd\""))
+             ;; Set XML catalogs for tests to pass
+             (setenv "XML_CATALOG_FILES"
+                     (string-append (assoc-ref inputs "docbook-xml")
+                                    "/xml/dtd/docbook/catalog.xml"))))
+         (add-after 'install 'wrap-programs
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (programs
+                     (map (lambda (p)
+                            (string-append out "/bin/" p))
+                          '("db2x_manxml" "db2x_texixml" "db2x_xsltproc"
+                            "docbook2man" "docbook2texi")))
+                    (perl5lib
+                     (map (lambda (i)
+                            (string-append (assoc-ref inputs i)
+                                           "/lib/perl5/site_perl"))
+                          '("perl-xml-namespacesupport"
+                            "perl-xml-parser"
+                            "perl-xml-sax"
+                            "perl-xml-sax-base")))
+                    (xml-catalog-files
+                     (list (string-append (assoc-ref inputs "docbook-xml")
+                                          "/xml/dtd/docbook/catalog.xml"))))
+               (map (lambda (program)
+                      (wrap-program program
+                        `("PERL5LIB" ":" prefix
+                          ,perl5lib)
+                        `("XML_CATALOG_FILES" " " prefix
+                          ,xml-catalog-files)))
+                    programs))))
+         (add-after 'install 'create-symlinks
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               ;; Create db2x_* symlinks to satisfy some configure scripts
+               ;; which use these names to differentiate from an older
+               ;; docbook2man script provided by docbook-utils.
+               (map (lambda (prog)
+                      (symlink prog (string-append out "/bin/db2x_" prog)))
+                    '("docbook2man" "docbook2texi"))))))))
+    (home-page "http://docbook2x.sourceforge.net")
+    (synopsis "Convert DocBook to man page and Texinfo format")
+    (description
+     "docbook2X is a software package that converts DocBook documents into the
+traditional Unix man page format and the GNU Texinfo format.  Notable features
+include table support for man pages, internationalization support, and easy
+customization of the output using XSLT.")
+    (license license:expat)))