summary refs log tree commit diff
path: root/gnu/packages/docbook.scm
diff options
context:
space:
mode:
authorBruno Victal <mirai@makinata.eu>2023-03-11 17:54:13 +0000
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-04-21 00:44:01 -0400
commit9a03afbe17be9344aa632b20467c83ac226835a6 (patch)
treeccc40f68fc7caca5b1901b526afed1ca4633f843 /gnu/packages/docbook.scm
parente9ba6d2c47bacae433be1a6c629d4d307206245a (diff)
downloadguix-9a03afbe17be9344aa632b20467c83ac226835a6.tar.gz
gnu: docbook-xml-4.1.2: Add missing catalog.xml.
* gnu/packages/aux-files/xml/docbook-xml/catalog-4.1.2.xml: New file.
* Makefile.am: Register it.
* gnu/packages/docbook.scm (docbook-xml-4.1.2)[arguments]: Use prebuilt catalog.xml.
[native-inputs]: Add libxml2.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Diffstat (limited to 'gnu/packages/docbook.scm')
-rw-r--r--gnu/packages/docbook.scm36
1 files changed, 35 insertions, 1 deletions
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index a9c92459c2..b52131b24b 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -39,6 +39,7 @@
   #:use-module (gnu packages web-browsers)
   #:use-module (gnu packages xml)
   #:use-module (guix gexp)
+  #:use-module (guix utils)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
@@ -152,7 +153,40 @@ by no means limited to these applications.)  This package provides XML DTDs.")
                                   "/docbkx412.zip"))
               (sha256
                (base32
-                "0wkp5rvnqj0ghxia0558mnn4c7s3n501j99q2isp3sp0ci069w1h"))))))
+                "0wkp5rvnqj0ghxia0558mnn4c7s3n501j99q2isp3sp0ci069w1h"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments docbook-xml)
+       ((#:phases phases)
+        #~(modify-phases #$phases
+            (add-after 'unpack 'copy-catalog-file
+              ;; docbook-xml-4.1.2 is unique in the fact that it doesn't come
+              ;; with a catalog.xml file, requiring it to be generated by hand
+              ;; from the docbook.cat SGML catalog. We could automatically
+              ;; generate it here at the cost of enlarging the package
+              ;; definition with a rudimentary (PEG) parser for the SGML
+              ;; catalog but this is overkill since this file is unlikely to
+              ;; change, therefore we ship a pre-generated catalog.xml.
+              (lambda _
+                (copy-file
+                 #$(local-file
+                    (search-auxiliary-file
+                     "xml/docbook-xml/catalog-4.1.2.xml"))
+                 "catalog.xml")))
+            (add-after 'patch-catalog-xml 'add-rewrite-entries
+              (lambda* (#:key inputs #:allow-other-keys)
+                (let ((xmlcatalog (search-input-file inputs "/bin/xmlcatalog"))
+                      (dtd-path (string-append #$output "/xml/dtd/docbook")))
+                  (for-each
+                   (lambda (type)
+                     (invoke xmlcatalog "--noout"
+                             "--add" type
+                             "http://www.oasis-open.org/docbook/xml/4.1.2/"
+                             (string-append "file://" dtd-path "/")
+                             "catalog.xml"))
+                   (list "rewriteSystem" "rewriteURI")))))))))
+    (native-inputs
+     (modify-inputs (package-native-inputs docbook-xml)
+       (prepend libxml2)))))
 
 ;;; 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