* [bug#63081] [PATCH 2/8] gnu: Add docbook-xml-5.0.1.
2023-04-26 0:56 ` [bug#63081] [PATCH 1/8] gnu: docbook-xml: Fix installation paths Bruno Victal
@ 2023-04-26 0:56 ` Bruno Victal
2023-04-26 0:56 ` [bug#63081] [PATCH 3/8] gnu: docbook-xsl: Refactor package Bruno Victal
` (5 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Bruno Victal @ 2023-04-26 0:56 UTC (permalink / raw)
To: 63081; +Cc: andreas, Bruno Victal, maxim.cournoyer
* gnu/packages/docbook.xml (docbook-xml-5.0.1): New variable.
---
gnu/packages/docbook.scm | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 73a14855b9..79d5069fb0 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -120,6 +120,30 @@ (define-public docbook-xml-5.1
;; substitution has no effect.
((#:install-plan _ #f)
#~`(("schemas/" #$dest-dir)))))))))
+
+(define-public docbook-xml-5.0.1
+ (let* ((version "5.0.1")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "https://docbook.org/xml/" version
+ "/docbook-" version ".zip"))
+ (sha256
+ (base32
+ "1iz3hq1lqgnshvlz4j9gvh4jy1ml74qf90vqf2ikbq0h4i2xzybs"))))
+ (template (docbook-xml-package source version)))
+ (package
+ (inherit template)
+ (arguments
+ (let ((dest-dir (format #f "xml/docbook/~a/" version)))
+ (substitute-keyword-arguments (package-arguments template)
+ ((#:install-plan _ #f)
+ #~`(("catalog.xml" #$dest-dir)
+ ("docbook.nvdl" #$dest-dir)
+ ("dtd" #$dest-dir)
+ ("rng" #$dest-dir)
+ ("sch" #$dest-dir)
+ ("xsd" #$dest-dir)))))))))
+
;; XXX: docbook-xml-4.x versions use the same #:install-plan but since the
;; paths are versioned we can't use (inherit …).
(define* (docbook-xml-4.x-package source version)
--
2.39.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [bug#63081] [PATCH 3/8] gnu: docbook-xsl: Refactor package.
2023-04-26 0:56 ` [bug#63081] [PATCH 1/8] gnu: docbook-xml: Fix installation paths Bruno Victal
2023-04-26 0:56 ` [bug#63081] [PATCH 2/8] gnu: Add docbook-xml-5.0.1 Bruno Victal
@ 2023-04-26 0:56 ` Bruno Victal
2023-04-26 0:56 ` [bug#63081] [PATCH 4/8] gnu: docbook-xsl-1.79.1: " Bruno Victal
` (4 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Bruno Victal @ 2023-04-26 0:56 UTC (permalink / raw)
To: 63081; +Cc: andreas, Bruno Victal, maxim.cournoyer
* gnu/packages/docbook.scm (docbook-xsl)[source]: Patch in snippet.
[arguments]: Use sxml representation for xmlc file.
Use xmlcatalog to manipulate catalog.xml instead of substitute*.
Use #:install-plan instead of replacing 'install phase.
[native-inputs]: Add docbook-xml-4.4 and libxml2, required for tests.
---
gnu/packages/docbook.scm | 158 +++++++++++++++++++++++++--------------
1 file changed, 102 insertions(+), 56 deletions(-)
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 79d5069fb0..2fe0c2dbc5 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -290,9 +290,16 @@ (define-public docbook-xsl
(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$")))
+ (snippet
+ #~(begin
+ ;; Multiple .jar files are bundled with the sources.
+ (for-each delete-file
+ (find-files "." "\\.jar$"))
+ ;; Do not build webhelp files, as they require a Saxon from
+ ;; 2005, which is not packaged in Guix.
+ (substitute* "xsl/Makefile"
+ ((" webhelp") ""))))
(sha256
(base32
"1bl8dwrcy7skrlh80fpsmiw045bv2j0aym231ikcv3hvm2pi98dj"))))
@@ -300,67 +307,106 @@ (define-public docbook-xsl
(arguments
(list
#:make-flags #~(list "XSLTENGINE=xsltproc")
+ #:modules '((guix build gnu-build-system)
+ (guix build utils)
+ (sxml simple))
#: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)))
+ #~(let ((dest-path (format #f "~a/xml/xsl/~a-~a"
+ #$output #$name #$version)))
+ (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)
+ (sxml->xml
+ '(*TOP*
+ (*PI* xml "version='1.0'")
+ (config
+ (java (@ (xml:id "bigmem"))
+ (java-options (@ (name "Xmx512m"))))
+ (xsltproc (@ (xml:id "xsltproc")
+ (exec "xsltproc")))
+ (xmllint (@ (xml:id "xmllint")
+ (exec "xmllint")))))
+ port)))))
+ (add-before 'install 'generate-catalog.xml
+ (lambda* (#:key make-flags #:allow-other-keys)
+ (apply invoke "make" "-C" "xsl" "catalog.xml" make-flags)))
+ (add-before 'install 'patch-catalog-xml
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((xmlcatalog (search-input-file inputs
+ "/bin/xmlcatalog"))
+ (catalog-files (find-files "." "catalog\\.xml$"))
+ (store-uri (string-append "file://" dest-path "/")))
+ (for-each
+ (lambda (catalog)
+ ;; Replace /snapshot/ reference with one based on
+ ;; BASE-VERSION.
+ (let ((versioned-uri
+ (format
+ #f "https://cdn.docbook.org/release/xsl/~a/"
+ #$base-version)))
+ (invoke xmlcatalog "--noout"
+ "--del"
+ "https://cdn.docbook.org/release/xsl/snapshot/"
+ catalog)
+ (for-each
+ (lambda (type)
+ (invoke xmlcatalog "--noout"
+ "--add" type
+ versioned-uri
+ store-uri
+ catalog))
+ (list "rewriteSystem" "rewriteURI")))
+
+ ;; Patch /current/ references to point to /gnu/store/….
+ (for-each
+ (lambda (type)
+ (invoke xmlcatalog "--noout"
+ "--add" type
+ "https://cdn.docbook.org/release/xsl/current/"
+ store-uri
+ catalog))
+ (list "rewriteSystem" "rewriteURI"))
+
+ ;; Re-add the no longer present compatibility entries for
+ ;; v.1.79.1 or earlier URIs.
+ (for-each
+ (lambda (type)
+ (invoke xmlcatalog "--noout"
+ "--add" type
+ "http://docbook.sourceforge.net/release/xsl/current/"
+ store-uri
+ catalog))
+ (list "rewriteSystem" "rewriteURI")))
+ catalog-files))))
(replace 'install
(lambda _
- (let ((xml (string-append #$output "/xml/xsl/"
- #$name "-" #$version))
- (select-rx (make-regexp
+ (let ((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-file "catalog.xml" dest-path)
+ (install-file "VERSION.xsl" dest-path)
;; 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
+ (for-each
+ (lambda (dir)
+ (for-each (lambda (f)
+ (install-file
+ f
+ (string-append dest-path "/" (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 docbook-xml-4.4 ; for tests
+ libxml2
libxslt
perl
perl-xml-xpath))
--
2.39.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [bug#63081] [PATCH 4/8] gnu: docbook-xsl-1.79.1: Refactor package.
2023-04-26 0:56 ` [bug#63081] [PATCH 1/8] gnu: docbook-xml: Fix installation paths Bruno Victal
2023-04-26 0:56 ` [bug#63081] [PATCH 2/8] gnu: Add docbook-xml-5.0.1 Bruno Victal
2023-04-26 0:56 ` [bug#63081] [PATCH 3/8] gnu: docbook-xsl: Refactor package Bruno Victal
@ 2023-04-26 0:56 ` Bruno Victal
2023-04-26 0:56 ` [bug#63081] [PATCH 5/8] gnu: docbook-utils: " Bruno Victal
` (3 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Bruno Victal @ 2023-04-26 0:56 UTC (permalink / raw)
To: 63081; +Cc: andreas, Bruno Victal, maxim.cournoyer
* 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.
---
gnu/packages/docbook.scm | 94 ++++++++++++++++++++++++++--------------
1 file changed, 61 insertions(+), 33 deletions(-)
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 2fe0c2dbc5..b3e53557e8 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -430,44 +430,72 @@ (define-public docbook-xsl-1.79.1
name "-ns-" version ".tar.bz2"))
(sha256
(base32
- "170ggf5dgjar65kkn5n33kvjr3pdinpj66nnxfx8b2avw0k91jin"))))
+ "170ggf5dgjar65kkn5n33kvjr3pdinpj66nnxfx8b2avw0k91jin"))
+ (modules '((guix build utils)))
+ ;; Bundled binary files.
+ (snippet
+ #~(delete-file-recursively "tools"))))
(build-system copy-build-system)
(outputs '("out" "doc"))
(arguments
(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
- #~(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)))))))
+ #~(let ((dest-path (format #f "~a/xml/xsl/~a-~a"
+ #$output #$name #$version)))
+ (modify-phases %standard-phases
+ (add-before 'install 'patch-catalog-xml
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((xmlcatalog (search-input-file inputs
+ "/bin/xmlcatalog"))
+ (catalog-files (find-files "." "catalog\\.xml$"))
+ (store-uri (string-append "file://" dest-path "/")))
+ (for-each
+ (lambda (catalog)
+ (for-each
+ (lambda (type)
+ ;; Patch /current/ references to point to /gnu/store/….
+ (invoke xmlcatalog "--noout"
+ "--add" type
+ "http://docbook.sourceforge.net/release/xsl-ns/current/"
+ store-uri
+ catalog)
+ ;; Patch versioned references to point to /gnu/store/….
+ (invoke xmlcatalog "--noout"
+ "--add" type
+ (format
+ #f "http://docbook.sourceforge.net/release/xsl-ns/~a/"
+ #$version)
+ store-uri
+ catalog))
+ (list "rewriteSystem" "rewriteURI")))
+ catalog-files))))
+ ;; XXX: The copy-build-system doesn't seem to allow installing to a
+ ;; different output.
+ (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")
(synopsis "DocBook XSL namespaced style sheets for document authoring")
(description "This package provides the @emph{namespaced} XSL style sheets
--
2.39.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [bug#63081] [PATCH 5/8] gnu: docbook-utils: Refactor package.
2023-04-26 0:56 ` [bug#63081] [PATCH 1/8] gnu: docbook-xml: Fix installation paths Bruno Victal
` (2 preceding siblings ...)
2023-04-26 0:56 ` [bug#63081] [PATCH 4/8] gnu: docbook-xsl-1.79.1: " Bruno Victal
@ 2023-04-26 0:56 ` Bruno Victal
2023-04-26 0:56 ` [bug#63081] [PATCH 6/8] gnu: docbook: Refactor docbook-sgml packages Bruno Victal
` (2 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Bruno Victal @ 2023-04-26 0:56 UTC (permalink / raw)
To: 63081; +Cc: andreas, Bruno Victal, maxim.cournoyer
* gnu/packages/docbook.scm (docbook-utils)[description]: Fix description.
[source]: Patch source in snippet.
[arguments]: Remove.
---
gnu/packages/docbook.scm | 96 ++++++++++++++++++++--------------------
1 file changed, 49 insertions(+), 47 deletions(-)
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index b3e53557e8..d4441bacee 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -780,45 +780,40 @@ (define-public docbook-utils
version ".orig.tar.gz"))
(sha256
(base32
- "1scj5vgw1xz872pq54a89blcxqqm11p90yzv8a9mqq57x27apyj8"))))
+ "1scj5vgw1xz872pq54a89blcxqqm11p90yzv8a9mqq57x27apyj8"))
+ (modules '((guix build utils)))
+ (snippet
+ #~(begin
+ ;; Patch build system.
+ (substitute* (find-files "." "\\.in$")
+ ;; Do not hard-code SGML_CATALOG_FILES.
+ ((".*SGML_CATALOG_FILES=/etc/sgml/catalog.*") "")
+ ;; Use OpenSP and OpenJade.
+ (("\\bjade\\b")
+ "openjade")
+ (("\\bnsgmls\\b")
+ "onsgmls"))
+
+ ;; Do not override the SGML_CATALOG_FILES environment
+ ;; variable.
+ (substitute* "bin/jw.in"
+ ((".*SGML_CATALOG_FILES=`find.*")
+ "")
+ (("SGML_CATALOG_FILES=`echo.*")
+ ":\n")
+ (("SGML_CATALOG_FILES=\"\"")
+ ":")
+ (("\\bwhich\\b")
+ "command -v"))
+
+ ;; Locate lynx, links or w3m from the PATH, not from
+ ;; /usr/bin.
+ (substitute* "backends/txt"
+ (("CONVERT=/usr/bin/")
+ "CONVERT=")
+ (("\\[ -x /usr/bin/([^ ]+) \\]" _ command)
+ (format #f "command -v ~a > /dev/null" command)))))))
(build-system gnu-build-system)
- (arguments
- `(#:phases (modify-phases %standard-phases
- (add-after 'unpack 'patch-build-system
- (lambda _
- (substitute* (find-files "." "\\.in$")
- ;; Do not hard-code SGML_CATALOG_FILES.
- ((".*SGML_CATALOG_FILES=/etc/sgml/catalog.*") "")
- ;; Use OpenSP and OpenJade.
- (("\\bjade\\b")
- "openjade")
- (("\\bnsgmls\\b")
- "onsgmls"))
- #t))
- (add-after 'unpack 'patch-jw.in
- ;; Do not override the SGML_CATALOG_FILES environment
- ;; variable.
- (lambda _
- (substitute* "bin/jw.in"
- ((".*SGML_CATALOG_FILES=`find.*")
- "")
- (("SGML_CATALOG_FILES=`echo.*")
- ":\n")
- (("SGML_CATALOG_FILES=\"\"")
- ":")
- (("\\bwhich\\b")
- "command -v"))
- #t))
- (add-after 'unpack 'patch-txt-backend
- (lambda _
- ;; Locate lynx, links or w3m from the PATH, not from
- ;; /usr/bin.
- (substitute* "backends/txt"
- (("CONVERT=/usr/bin/")
- "CONVERT=")
- (("\\[ -x /usr/bin/([^ ]+) \\]" dummy command)
- (string-append "command -v " command " > /dev/null")))
- #t)))))
;; Propagated for convenience. All these tools are used at run time to
;; provide the complete functionality of the docbook-utils commands.
(propagated-inputs
@@ -839,15 +834,22 @@ (define-public docbook-utils
Language (HTML), Rich Text Format (RTF), PostScript (PS), man, Portable
Document Format (PDF), TeX, Texinfo or plain text (txt). It can be used
more conveniently via the following wrappers:
-@itemx docbook2dvi Convert a SGML DocBook file to the DVI format.
-@itemx docbook2html Convert a SGML DocBook file to an HTML document.
-@itemx docbook2man Convert a SGML DocBook file a man page.
-@itemx docbook2pdf Convert a SGML DocBook file to a PDF document.
-@itemx docbook2ps Convert a SGML DocBook file to a PS document.
-@itemx docbook2rtf Convert a SGML DocBook file to a RTF document.
-@itemx docbook2tex Convert a SGML DocBook file to a TeX document.
-@itemx docbook2texi Convert a SGML DocBook file to a Texinfo document.
-@itemx docbook2txt Convert a SGML DocBook file to a plain text document.
+@table @command
+@item docbook2dvi
+Convert a SGML DocBook file to the DVI format.
+@item docbook2html
+Convert a SGML DocBook file to an HTML document.
+@item docbook2man
+Convert a SGML DocBook file a man page.
+@item docbook2pdf
+@itemx docbook2ps
+@itemx docbook2rtf
+@itemx docbook2tex
+@itemx docbook2texi
+Convert a SGML DocBook file to a PDF/PS/RTF/TeX document.
+@item docbook2txt
+Convert a SGML DocBook file to a plain text document.
+@end table
@item sgmldiff
Detect the differences in markup between two SGML files.
@end table")
--
2.39.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [bug#63081] [PATCH 6/8] gnu: docbook: Refactor docbook-sgml packages.
2023-04-26 0:56 ` [bug#63081] [PATCH 1/8] gnu: docbook-xml: Fix installation paths Bruno Victal
` (3 preceding siblings ...)
2023-04-26 0:56 ` [bug#63081] [PATCH 5/8] gnu: docbook-utils: " Bruno Victal
@ 2023-04-26 0:56 ` Bruno Victal
2023-04-26 0:56 ` [bug#63081] [PATCH 7/8] gnu: docbook: Refactor dblatex packages Bruno Victal
2023-04-26 0:57 ` [bug#63081] [PATCH 8/8] gnu: docbook-dsssl: Switch to copy-build-system Bruno Victal
6 siblings, 0 replies; 11+ messages in thread
From: Bruno Victal @ 2023-04-26 0:56 UTC (permalink / raw)
To: 63081; +Cc: andreas, Bruno Victal, maxim.cournoyer
* gnu/packages/docbook.scm
(docbook-sgml)[build-system]: Switch to copy-build-system.
[arguments]: Replace #:builder with #:install-plan.
Add phases 'fix-permission and 'patch-iso-entities.
[sources]: Use url-fetch/zipbomb.
(docbook-sgml-4.1, docbook-sgml-3.1)[sources]: Ditto.
(iso-8879-entities)[source]: Ditto.
[build-system]: Switch to copy-build-system.
[native-inputs]: Restyle.
---
gnu/packages/docbook.scm | 70 ++++++++++++++++++----------------------
1 file changed, 32 insertions(+), 38 deletions(-)
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index d4441bacee..cc0a663f68 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -585,35 +585,39 @@ (define-public docbook-sgml-4.2
(name "docbook-sgml")
(version "4.2")
(source (origin
- (method url-fetch)
+ (method url-fetch/zipbomb)
(uri (string-append
"https://www.oasis-open.org/docbook/sgml/4.2/docbook-"
version ".zip"))
(sha256
(base32
"1hrm4qmmzi285bkxkc74lxvjvw2gbl7ycbaxhv31h9rl9g4x5sv7"))))
- (build-system trivial-build-system)
+ (build-system copy-build-system)
(arguments
- '(#:modules ((guix build utils))
- #:builder
- (begin
- (use-modules (guix build utils))
- (let ((source (assoc-ref %build-inputs "source"))
- (iso-entities-dir (string-append
- (assoc-ref %build-inputs "iso-8879-entities")))
- (unzip (string-append (assoc-ref %build-inputs "unzip")
- "/bin/unzip"))
- (dtd (string-append (assoc-ref %outputs "out")
- "/sgml/dtd/docbook")))
- ;; Extract the sources.
- (mkdir-p dtd)
- (chdir dtd)
- (invoke unzip source)
- ;; Reference the ISO 8879 character entities.
- ;; e.g. "iso-lat1.gml" --> "<iso-entities-dir>/ISOlat1"
- (substitute* "docbook.cat"
- (("\"iso-(.*)\\.gml\"" _ name)
- (string-append "\"" iso-entities-dir "/ISO" name "\"")))))))
+ (list
+ #:modules '((guix build copy-build-system)
+ (guix build utils)
+ (srfi srfi-26))
+ #:install-plan
+ #~`(("./" "sgml/dtd/docbook"
+ #:exclude-regexp ("catalog\\.xml$"
+ "ChangeLog$"
+ "README$"
+ "\\.txt$")))
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'fix-permissions
+ (lambda _
+ (for-each (cut chmod <> #o644) (find-files "."))))
+ (add-before 'install 'patch-iso-entities
+ (lambda* (#:key inputs #:allow-other-keys)
+ ;; Reference the ISO 8879 character entities.
+ ;; e.g. "iso-lat1.gml" --> "<iso-entities-dir>/ISOlat1"
+ (let ((iso-entities-dir
+ (assoc-ref %build-inputs "iso-8879-entities")))
+ (substitute* "docbook.cat"
+ (("\"iso-(.*)\\.gml\"" _ name)
+ (string-append "\"" iso-entities-dir "/ISO" name "\"")))))))))
(native-inputs
(list unzip))
(inputs
@@ -628,7 +632,7 @@ (define-public docbook-sgml-4.1
(inherit docbook-sgml-4.2)
(version "4.1")
(source (origin
- (method url-fetch)
+ (method url-fetch/zipbomb)
(uri (string-append "https://www.oasis-open.org/docbook/sgml/"
version "/docbk41.zip"))
(sha256
@@ -642,7 +646,7 @@ (define-public docbook-sgml-3.1
(inherit docbook-sgml)
(version "3.1")
(source (origin
- (method url-fetch)
+ (method url-fetch/zipbomb)
(uri (string-append "https://www.oasis-open.org/docbook/sgml/"
version "/docbk31.zip"))
(sha256
@@ -655,23 +659,13 @@ (define iso-8879-entities
(name "iso-8879-entities")
(version "0.0") ;no proper version
(source (origin
- (method url-fetch)
- (uri "http://www.oasis-open.org/cover/ISOEnts.zip")
+ (method url-fetch/zipbomb)
+ (uri "https://www.oasis-open.org/cover/ISOEnts.zip")
(sha256
(base32
"1clrkaqnvc1ja4lj8blr0rdlphngkcda3snm7b9jzvcn76d3br6w"))))
- (build-system trivial-build-system)
- (arguments
- '(#:modules ((guix build utils))
- #:builder
- (begin
- (use-modules (guix build utils))
- (let ((source (assoc-ref %build-inputs "source"))
- (unzip (string-append (assoc-ref %build-inputs "unzip")
- "/bin/unzip"))
- (out (string-append (assoc-ref %outputs "out"))))
- (invoke unzip source "-d" out)))))
- (native-inputs `(("unzip" ,unzip)))
+ (build-system copy-build-system)
+ (native-inputs (list unzip))
(home-page "https://www.oasis-open.org/")
(synopsis "ISO 8879 character entities")
(description "ISO 8879 character entities that are typically used in
--
2.39.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [bug#63081] [PATCH 7/8] gnu: docbook: Refactor dblatex packages.
2023-04-26 0:56 ` [bug#63081] [PATCH 1/8] gnu: docbook-xml: Fix installation paths Bruno Victal
` (4 preceding siblings ...)
2023-04-26 0:56 ` [bug#63081] [PATCH 6/8] gnu: docbook: Refactor docbook-sgml packages Bruno Victal
@ 2023-04-26 0:56 ` Bruno Victal
2023-04-26 0:57 ` [bug#63081] [PATCH 8/8] gnu: docbook-dsssl: Switch to copy-build-system Bruno Victal
6 siblings, 0 replies; 11+ messages in thread
From: Bruno Victal @ 2023-04-26 0:56 UTC (permalink / raw)
To: 63081; +Cc: andreas, Bruno Victal, maxim.cournoyer
* gnu/packages/docbook.scm (dblatex): Rewrite using G-Expressions.
(dblatex/stable): Use modify-inputs.
---
gnu/packages/docbook.scm | 114 ++++++++++++++++++++-------------------
1 file changed, 58 insertions(+), 56 deletions(-)
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index cc0a663f68..ced174b3b8 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -37,6 +37,7 @@ (define-module (gnu packages docbook)
#:use-module (gnu packages python)
#:use-module (gnu packages base)
#:use-module (gnu packages web-browsers)
+ #:use-module (gnu packages xfig)
#:use-module (gnu packages xml)
#:use-module (guix gexp)
#:use-module (guix utils)
@@ -44,7 +45,6 @@ (define-module (gnu packages docbook)
#: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)
@@ -685,62 +685,64 @@ (define-public dblatex
(base32
"0yd09nypswy3q4scri1dg7dr99d7gd6r2dwx0xm81l9f4y32gs0n"))))
(build-system python-build-system)
- ;; TODO: Add xfig/transfig for fig2dev utility
+ (arguments
+ (list
+ ;; Using setuptools causes an invalid "package_base" path in
+ ;; out/bin/.dblatex-real due to a missing leading '/'. This is caused
+ ;; by dblatex's setup.py stripping the root path when creating the
+ ;; script. (dblatex's setup.py still uses distutils and thus has to
+ ;; create the script by itself. The feature for creating scripts is one
+ ;; of setuptools' features.)
+ ;; See this thread for details:
+ ;; https://lists.gnu.org/archive/html/guix-devel/2016-12/msg00030.html
+ #:use-setuptools? #f
+ #:tests? #f ;no 'test' command
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'wrap 'set-path
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((path (map (lambda (x)
+ (string-append (assoc-ref inputs x)
+ "/bin"))
+ (list "libxslt"
+ "imagemagick" "inkscape"
+ "texlive-updmap.cfg"))))
+ ;; dblatex executes helper programs at runtime.
+ (wrap-program (string-append #$output "/bin/dblatex")
+ `("PATH" ":" prefix ,path))))))))
(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-fancyhdr
- texlive-fancyvrb
- texlive-latex-float
- texlive-latex-footmisc
- texlive-hyperref
- texlive-latex-jknapltx
- texlive-listings
- texlive-latex-multirow
- texlive-latex-overpic
- texlive-pdfpages
- texlive-refcount
- texlive-subfigure
- texlive-titlesec
- texlive-wasysym
+ (list (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-fancyhdr
+ texlive-fancyvrb
+ texlive-latex-float
+ texlive-latex-footmisc
+ texlive-hyperref
+ texlive-latex-jknapltx
+ texlive-listings
+ texlive-latex-multirow
+ texlive-latex-overpic
+ texlive-pdfpages
+ texlive-refcount
+ texlive-subfigure
+ texlive-titlesec
+ texlive-wasysym
- texlive-fonts-rsfs
- texlive-stmaryrd
+ texlive-fonts-rsfs
+ texlive-stmaryrd
- texlive-iftex)))
- ("imagemagick" ,imagemagick) ;for convert
- ("inkscape" ,inkscape/stable) ;for svg conversion
- ("docbook" ,docbook-xml)
- ("libxslt" ,libxslt))) ;for xsltproc
- (arguments
- `(;; Using setuptools causes an invalid "package_base" path in
- ;; out/bin/.dblatex-real due to a missing leading '/'. This is caused
- ;; by dblatex's setup.py stripping the root path when creating the
- ;; script. (dblatex's setup.py still uses distutils and thus has to
- ;; create the script by itself. The feature for creating scripts is one
- ;; of setuptools' features.)
- ;; See this thread for details:
- ;; https://lists.gnu.org/archive/html/guix-devel/2016-12/msg00030.html
- #:use-setuptools? #f
- #:tests? #f ;no 'test' command
- #:phases
- (modify-phases %standard-phases
- (add-after 'wrap 'set-path
- (lambda* (#:key inputs outputs #:allow-other-keys)
- (let ((out (assoc-ref outputs "out")))
- ;; dblatex executes helper programs at runtime.
- (wrap-program (string-append out "/bin/dblatex")
- `("PATH" ":" prefix
- ,(map (lambda (input)
- (string-append (assoc-ref inputs input)
- "/bin"))
- '("libxslt" "texlive"
- "imagemagick" "inkscape"))))))))))
+ texlive-iftex))
+ ;; FIXME: transfig is failing to build.
+ ;;transfig ;for fig2dev
+ imagemagick ;for convert
+ inkscape/stable ;for svg conversion
+ docbook-xml
+ libxslt)) ;for xsltproc
(home-page "https://dblatex.sourceforge.net")
(synopsis "DocBook to LaTeX Publishing")
(description
@@ -759,8 +761,8 @@ (define-public dblatex
(define-public dblatex/stable
(hidden-package
(package/inherit dblatex
- (inputs (alist-replace "imagemagick" `(,imagemagick/stable)
- (package-inputs dblatex))))))
+ (inputs (modify-inputs (package-inputs dblatex)
+ (replace "imagemagick" imagemagick/stable))))))
(define-public docbook-utils
(package
--
2.39.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [bug#63081] [PATCH 8/8] gnu: docbook-dsssl: Switch to copy-build-system.
2023-04-26 0:56 ` [bug#63081] [PATCH 1/8] gnu: docbook-xml: Fix installation paths Bruno Victal
` (5 preceding siblings ...)
2023-04-26 0:56 ` [bug#63081] [PATCH 7/8] gnu: docbook: Refactor dblatex packages Bruno Victal
@ 2023-04-26 0:57 ` Bruno Victal
6 siblings, 0 replies; 11+ messages in thread
From: Bruno Victal @ 2023-04-26 0:57 UTC (permalink / raw)
To: 63081; +Cc: andreas, Bruno Victal, maxim.cournoyer
* gnu/packages/docbook.scm
(docbook-dsssl)[build-system]: Switch to copy-build-system.
[arguments]: Add phase to install documentation as separate output.
(docbook-dsssl-doc)[build-system]: Switch to copy-build-system.
[arguments]: Adapt to new build-system.
---
gnu/packages/docbook.scm | 54 ++++++++++++++--------------------------
1 file changed, 18 insertions(+), 36 deletions(-)
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index ced174b3b8..4a911bcec7 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -514,25 +514,22 @@ (define-public docbook-dsssl
(sha256
(base32
"1g72y2yyc2k89kzs0lvrb9n7hjayw1hdskfpplpz97pf1c99wcig"))))
- (build-system trivial-build-system)
+ (build-system copy-build-system)
(outputs '("out" "doc"))
(arguments
- `(#:modules ((guix build utils))
- #:builder
- (begin
- (use-modules (guix build utils))
- (let ((source (assoc-ref %build-inputs "source"))
- (dtd (string-append (assoc-ref %outputs "out")
- "/sgml/dtd/docbook"))
- (docbook-dsssl-doc (assoc-ref %build-inputs "docbook-dsssl-doc"))
- (doc (assoc-ref %outputs "doc"))
- (tar (assoc-ref %build-inputs "tar"))
- (bzip2 (assoc-ref %build-inputs "bzip2")))
- (setenv "PATH" (string-append tar "/bin" ":" bzip2 "/bin"))
- (mkdir-p dtd)
- (invoke "tar" "-xf" source "-C" dtd)
- ;; The doc output contains 1.4 MiB of HTML documentation.
- (symlink docbook-dsssl-doc doc)))))
+ (list
+ #:install-plan
+ #~`(("./" "sgml/dtd/docbook/"
+ #:exclude ("doc" "docsrc")))
+ #:phases
+ #~(modify-phases %standard-phases
+ ;; The doc output contains 1.4 MiB of HTML documentation.
+ (add-after 'install 'install-doc
+ (lambda* (#:key inputs #:allow-other-keys)
+ (mkdir-p (string-append #$output:doc "/share/doc"))
+ (symlink (assoc-ref inputs "docbook-dsssl-doc")
+ (format #f "~a/share/doc/~a-~a"
+ #$output:doc #$name #$version)))))))
(inputs
(list docbook-dsssl-doc))
(native-inputs
@@ -555,26 +552,11 @@ (define docbook-dsssl-doc
(sha256
(base32
"1plp5ngc96pbna4rwglp9glcadnirbm3hlcjb4gjvq1f8biic9lz"))))
- (build-system trivial-build-system)
+ (build-system copy-build-system)
(arguments
- `(#:modules ((guix build utils))
- #:builder
- (begin
- (use-modules (guix build utils))
- (let ((source (assoc-ref %build-inputs "source"))
- (docdir (string-append (assoc-ref %outputs "out")
- "/share/doc/" "docbook-dsssl-" ,version))
- (tar (assoc-ref %build-inputs "tar"))
- (bzip2 (assoc-ref %build-inputs "bzip2")))
- (setenv "PATH" (string-append tar "/bin" ":" bzip2 "/bin"))
- (mkdir-p docdir)
- ;; Extract the "doc" subdirectory.
- (invoke "tar" "-xf" source "--strip-components=2"
- "--no-same-owner" "-C" docdir
- (string-append "docbook-dsssl-" ,version "/doc"))))))
- (native-inputs
- `(("bzip2" ,bzip2)
- ("tar" ,tar)))
+ (list
+ #:install-plan
+ #~`(("doc/" #$(string-append "/share/doc/docbook-dsssl-" version)))))
(home-page "https://docbook.org/")
(synopsis "DocBook DSSSL style sheets documentation")
(description "Documentation for the DocBook DSSSL style sheets.")
--
2.39.2
^ permalink raw reply related [flat|nested] 11+ messages in thread