gnu: docbook-xsl-1.79.1: Refactor package.

* gnu/packages/docbook.scm
(docbook-xsl-1.79.1)[source]: Remove bundled binary files.
[arguments]: Use #:install-plan. Patch catalog.xml using xmlcatalog.
Add phase 'install-doc.
[native-inputs]: Add libxml2.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
This commit is contained in:
Bruno Victal 2023-04-26 01:56:56 +01:00 committed by Ludovic Courtès
parent d55feb010d
commit 860d17d70b
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -345,44 +345,72 @@ by no means limited to these applications.) This package provides XML DTDs.")
name "-ns-" version ".tar.bz2")) name "-ns-" version ".tar.bz2"))
(sha256 (sha256
(base32 (base32
"170ggf5dgjar65kkn5n33kvjr3pdinpj66nnxfx8b2avw0k91jin")))) "170ggf5dgjar65kkn5n33kvjr3pdinpj66nnxfx8b2avw0k91jin"))
(modules '((guix build utils)))
;; Bundled binary files.
(snippet
#~(delete-file-recursively "tools"))))
(build-system copy-build-system) (build-system copy-build-system)
(outputs '("out" "doc")) (outputs '("out" "doc"))
(arguments (arguments
(list (list
#:install-plan
(let ((target (format #f "xml/xsl/~a-~a/" name version))
(select-rx '("\\.xml$" "\\.xsl$" "\\.dtd$" "\\.ent$")))
#~`(#$@(map
(lambda (directory)
;; XXX: When filters are used, the source basename
;; isn't kept under the target path, append it again.
(let ((target* (string-append target directory)))
(list directory target* #:include-regexp select-rx)))
(list "assembly" "common" "eclipse" "epub" "epub3" "fo"
"highlighting" "html" "htmlhelp" "javahelp" "lib"
"manpages" "params" "profiling" "roundtrip"
"template" "website"
"xhtml" "xhtml-1_1" "xhtml5"))
("catalog.xml" #$target)
("VERSION.xsl" #$target)))
#:phases #:phases
#~(modify-phases %standard-phases #~(let ((dest-path (format #f "~a/xml/xsl/~a-~a"
;; XXX: The copy-build-system doesn't seem to allow installing to a #$output #$name #$version)))
;; different output. (modify-phases %standard-phases
(replace 'install (add-before 'install 'patch-catalog-xml
(lambda _ (lambda* (#:key inputs #:allow-other-keys)
(let ((xml (string-append #$output "/xml/xsl/" #$name "-" #$version)) (let ((xmlcatalog (search-input-file inputs
(doc (string-append #$output:doc "/bin/xmlcatalog"))
"/share/doc/" #$name "-" #$version)) (catalog-files (find-files "." "catalog\\.xml$"))
(select-rx (make-regexp (store-uri (string-append "file://" dest-path "/")))
"(\\.xml$|\\.xsl$|\\.dtd$|\\.ent$)"))) (for-each
;; Install catalog. (lambda (catalog)
(install-file "catalog.xml" xml) (for-each
(install-file "VERSION.xsl" xml) (lambda (type)
(substitute* (string-append xml "/catalog.xml") ;; Patch /current/ references to point to /gnu/store/….
(("rewritePrefix=\"./") (invoke xmlcatalog "--noout"
(string-append "rewritePrefix=\"file://" xml "/"))) "--add" type
;; Install style sheets. "http://docbook.sourceforge.net/release/xsl-ns/current/"
(for-each (lambda (dir) store-uri
(for-each (lambda (f) catalog)
(install-file ;; Patch versioned references to point to /gnu/store/….
f (string-append xml "/" (dirname f)))) (invoke xmlcatalog "--noout"
(find-files dir select-rx))) "--add" type
'("assembly" "common" "eclipse" "epub" "epub3" "fo" (format
"highlighting" "html" "htmlhelp" "javahelp" "lib" #f "http://docbook.sourceforge.net/release/xsl-ns/~a/"
"manpages" "params" "profiling" "roundtrip" #$version)
"template" "website" store-uri
"xhtml" "xhtml-1_1" "xhtml5")) catalog))
;; Install documentation. (list "rewriteSystem" "rewriteURI")))
(install-file "NEWS" doc) catalog-files))))
(install-file "RELEASE-NOTES.html" doc) ;; XXX: The copy-build-system doesn't seem to allow installing to a
(copy-recursively "slides" doc) ;; different output.
(copy-recursively "webhelp" doc))))))) (add-after 'install 'install-doc
(lambda _
(let ((doc (format #f "~a/share/doc/~a-~a"
#$output:doc #$name #$version)))
(install-file "NEWS" doc)
(install-file "RELEASE-NOTES.html" doc)
(copy-recursively "slides" doc)
(copy-recursively "webhelp" doc))))))))
(native-inputs (list libxml2))
(home-page "https://docbook.org") (home-page "https://docbook.org")
(synopsis "DocBook XSL namespaced style sheets for document authoring") (synopsis "DocBook XSL namespaced style sheets for document authoring")
(description "This package provides the @emph{namespaced} XSL style sheets (description "This package provides the @emph{namespaced} XSL style sheets