summaryrefslogtreecommitdiff
path: root/gnu/packages/docbook.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/docbook.scm')
-rw-r--r--gnu/packages/docbook.scm173
1 files changed, 136 insertions, 37 deletions
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index ae0ea07dbf..9f2869ed25 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -4,7 +4,7 @@
;;; 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>
@@ -37,9 +37,11 @@
#:use-module (gnu packages base)
#:use-module (gnu packages web-browsers)
#:use-module (gnu packages xml)
+ #: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)
@@ -229,55 +231,152 @@ by no means limited to these applications.) This package provides XML DTDs.")
"This package provides XSL style sheets for DocBook.")
(license (license:x11-style "" "See 'COPYING' file."))))
-(define-public docbook-xsl-ns
+;;; 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-ns")
+ (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 "/" version "/"
- name "-" version ".tar.bz2"))
+ name "-ns/" version "/"
+ name "-ns-" version ".tar.bz2"))
(sha256
(base32
"170ggf5dgjar65kkn5n33kvjr3pdinpj66nnxfx8b2avw0k91jin"))))
(build-system copy-build-system)
(outputs '("out" "doc"))
(arguments
- `(#:phases
- (modify-phases %standard-phases
- ;; XXX: The copy-build-system doesn't seem to allow installing to a
- ;; different output.
- (replace 'install
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (xml (string-append out "/xml/xsl/" ,name "-" ,version))
- (doc (string-append (assoc-ref %outputs "doc")
- "/share/doc/" ,name "-" ,version))
+ (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)))))))
+ ;; 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