diff mbox series

[bug#65479,core-updates,v2,18/62] gnu: dblatex: Fix missing texlive binaries.

Message ID cc0fcd178acf30ea5665d5faf6f6b4d5b5a2cf19.1695478390.git.mirai@makinata.eu
State New
Headers show
Series Docbook & XML/SGML improvements. | expand

Commit Message

Bruno Victal Sept. 23, 2023, 2:19 p.m. UTC
The binaries for dblatex aren't provided by texlive-updmap.cfg but by
texlive-bin.

* gnu/packages/patches/dblatex-inkscape-1.0.patch: New file.
* gnu/local.mk: Register it.
* gnu/packages/docbook.scm (dblatex)[source]: Use dblatex-inkscape-1.0.patch.
[arguments]<#:tests?>: Enable tests.
<#:phases>: Rename 'set-path to 'wrap-dblatex. Wrap with texlive-bin rather
than texlive-updmap.cfg in PATH and wrap GUIX_TEXMF in 'wrap-dblatex. Add
'check-wrap phase.
[native-inputs]: Add docbook-mathml-1.0.
[inputs]: Restyle. Add texlive-bin. Replace inkscape/stable with inkscape.
Within texlive-updmap.cfg add previously missing: texlive-amsmath,
texlive-auxhook, texlive-bigintcalc, texlive-bin, texlive-bitset,
texlive-bookmark, texlive-colortbl, texlive-courier, texlive-eepic,
texlive-epstopdf-pkg, texlive-eso-pic, texlive-etexcmds, texlive-fancyhdr,
texlive-gettitlestring, texlive-graphics, texlive-graphics-cfg,
texlive-helvetic, texlive-hycolor, texlive-hyperref, texlive-infwarerr,
texlive-intcalc, texlive-kpathsea, texlive-kvdefinekeys, texlive-kvoptions,
texlive-kvsetkeys, texlive-l3backend, texlive-latex, texlive-latex-bin,
texlive-letltxmacro, texlive-ltxcmds, texlive-pdfescape, texlive-pdflscape,
texlive-pdftexcmds, texlive-psnfss, texlive-rerunfilecheck, texlive-symbol,
texlive-times, texlive-tools, texlive-uniquecounter, texlive-url and
texlive-zapfding.
(dblatex/stable)[inputs]: Replace inkscape with inkscape/stable.

Co-authored-by: Nicolas Goaziou <mail@nicolasgoaziou.fr>
---
 gnu/local.mk                                  |   3 +-
 gnu/packages/docbook.scm                      | 115 +++++++++++++-----
 .../patches/dblatex-inkscape-1.0.patch        |  39 ++++++
 3 files changed, 125 insertions(+), 32 deletions(-)
 create mode 100644 gnu/packages/patches/dblatex-inkscape-1.0.patch
diff mbox series

Patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 8d4d64a591..e6dbde6f8f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1056,7 +1056,8 @@  dist_patch_DATA =						\
   %D%/packages/patches/date-output-pkg-config-files.patch	\
   %D%/packages/patches/datefudge-gettimeofday.patch		\
   %D%/packages/patches/dbacl-include-locale.h.patch		\
-  %D%/packages/patches/dbacl-icheck-multiple-definitions.patch		\
+  %D%/packages/patches/dbacl-icheck-multiple-definitions.patch	\
+  %D%/packages/patches/dblatex-inkscape-1.0.patch		\
   %D%/packages/patches/dbus-helper-search-path.patch		\
   %D%/packages/patches/dbus-c++-gcc-compat.patch		\
   %D%/packages/patches/dbus-c++-threading-mutex.patch		\
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 8cabaa780d..1b24c3522e 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -50,7 +50,8 @@  (define-module (gnu packages docbook)
   #:use-module (guix git-download)
   #:use-module (guix build-system copy)
   #:use-module (guix build-system gnu)
-  #:use-module (guix build-system python))
+  #:use-module (guix build-system python)
+  #:use-module (srfi srfi-26))
 
 ;; The fetch-plan, install-plan and phases for docbook-xml tend to vary
 ;; between releases therefore we use a “template” package for the
@@ -749,7 +750,9 @@  (define-public dblatex
                                   version ".tar.bz2"))
               (sha256
                (base32
-                "0yd09nypswy3q4scri1dg7dr99d7gd6r2dwx0xm81l9f4y32gs0n"))))
+                "0yd09nypswy3q4scri1dg7dr99d7gd6r2dwx0xm81l9f4y32gs0n"))
+              (patches
+               (search-patches "dblatex-inkscape-1.0.patch"))))
     (build-system python-build-system)
     (arguments
      (list
@@ -762,7 +765,6 @@  (define-public dblatex
       ;; See this thread for details:
       ;; https://lists.gnu.org/archive/html/guix-devel/2016-12/msg00030.html
       #:use-setuptools? #f
-      #:tests? #f                       ;no test suite
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'install 'split-outputs
@@ -771,40 +773,90 @@  (define-public dblatex
                     (new (string-append #$output:doc "/share/doc")))
                 (mkdir-p (dirname new))
                 (rename-file old new))))
-          (add-after 'wrap 'set-path
+          (add-after 'wrap 'wrap-dblatex
             (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"))))
+              (let ((path
+                     (search-path-as-list
+                      '("bin")
+                      '#$(map (cut this-package-input <>)
+                              (list "libxslt" "imagemagick" "inkscape"
+                                    "texlive-bin")))))
                 ;; dblatex executes helper programs at runtime.
                 (wrap-program (string-append #$output "/bin/dblatex")
-                  `("PATH" ":" prefix ,path))))))))
+                  `("PATH" ":" prefix ,path)
+                  `("GUIX_TEXMF" prefix (,(getenv "GUIX_TEXMF")))))))
+          (add-after 'check 'check-wrap
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (unsetenv "GUIX_TEXMF")
+                (invoke/quiet (string-append #$output "/bin/dblatex")
+                              "--quiet" "tests/mathml/mmltest2.xml")))))))
+    (native-inputs (list docbook-mathml-1.0))
     (inputs
-     (list (texlive-updmap.cfg (list texlive-anysize
-                                             texlive-appendix
-                                             texlive-changebar
-                                             texlive-fancybox
-                                             texlive-fancyvrb
-                                             texlive-float
-                                             texlive-footmisc
-                                             texlive-jknapltx
-                                             texlive-listings
-                                             texlive-multirow
-                                             texlive-overpic
-                                             texlive-pdfpages
-                                             texlive-refcount
-                                             texlive-rsfs
-                                             texlive-stmaryrd
-                                             texlive-subfigure
-                                             texlive-titlesec
-                                             texlive-wasysym))
+     (list texlive-bin
+           (texlive-updmap.cfg (list texlive-amsmath
+                                     texlive-anysize
+                                     texlive-appendix
+                                     texlive-auxhook
+                                     texlive-bigintcalc
+                                     texlive-bin
+                                     texlive-bitset
+                                     texlive-bookmark
+                                     texlive-changebar
+                                     texlive-colortbl
+                                     texlive-courier
+                                     texlive-eepic
+                                     texlive-epstopdf-pkg
+                                     texlive-eso-pic
+                                     texlive-etexcmds
+                                     texlive-fancybox
+                                     texlive-fancyhdr
+                                     texlive-fancyvrb
+                                     texlive-float
+                                     texlive-footmisc
+                                     texlive-gettitlestring
+                                     texlive-graphics
+                                     texlive-graphics-cfg
+                                     texlive-helvetic
+                                     texlive-hycolor
+                                     texlive-hyperref
+                                     texlive-infwarerr
+                                     texlive-intcalc
+                                     texlive-jknapltx
+                                     texlive-kpathsea
+                                     texlive-kvdefinekeys
+                                     texlive-kvoptions
+                                     texlive-kvsetkeys
+                                     texlive-l3backend
+                                     texlive-latex
+                                     texlive-latex-bin
+                                     texlive-letltxmacro
+                                     texlive-listings
+                                     texlive-ltxcmds
+                                     texlive-multirow
+                                     texlive-overpic
+                                     texlive-pdfescape
+                                     texlive-pdflscape
+                                     texlive-pdfpages
+                                     texlive-pdftexcmds
+                                     texlive-psnfss
+                                     texlive-refcount
+                                     texlive-rerunfilecheck
+                                     texlive-rsfs
+                                     texlive-stmaryrd
+                                     texlive-subfigure
+                                     texlive-symbol
+                                     texlive-times
+                                     texlive-titlesec
+                                     texlive-tools
+                                     texlive-uniquecounter
+                                     texlive-url
+                                     texlive-wasysym
+                                     texlive-zapfding))
            ;; FIXME: transfig causes the build to fail.
            ;;transfig                   ;for fig2dev
            imagemagick                  ;for convert
-           inkscape/stable              ;for svg conversion
+           inkscape                     ;for svg conversion
            docbook-xml
            libxslt))                    ;for xsltproc
     (outputs '("out" "doc"))
@@ -833,7 +885,8 @@  (define-public dblatex/stable
   (hidden-package
    (package/inherit dblatex
      (inputs (modify-inputs (package-inputs dblatex)
-               (replace "imagemagick" imagemagick/stable))))))
+               (replace "imagemagick" imagemagick/stable)
+               (replace "inkscape" inkscape/stable))))))
 
 (define-public docbook-utils
   (package
diff --git a/gnu/packages/patches/dblatex-inkscape-1.0.patch b/gnu/packages/patches/dblatex-inkscape-1.0.patch
new file mode 100644
index 0000000000..634c99481a
--- /dev/null
+++ b/gnu/packages/patches/dblatex-inkscape-1.0.patch
@@ -0,0 +1,39 @@ 
+# Imported from <https://sourceforge.net/p/dblatex/dblatex/merge-requests/4/>
+
+# HG changeset patch
+# User Jan Tojnar <jtojnar@gmail.com>
+# Date 1588714251 -7200
+#      Tue May 05 23:30:51 2020 +0200
+# Branch inkscape1
+# Node ID 611cc4a4a878d57f5877f2d418864560f68d25cf
+# Parent  3ddf5d6cedcbc9c8b98c4da77fd545b2478d90a3
+Port to Inkscape 1.0
+
+Inkscape revamped the CLI flags:
+
+https://gitlab.com/inkscape/inbox/issues/2416
+
+diff -r 3ddf5d6cedcb -r 611cc4a4a878 docs/custom/dblatex.xconf
+--- a/docs/custom/dblatex.xconf	Tue Sep 10 00:40:26 2019 +0200
++++ b/docs/custom/dblatex.xconf	Tue May 05 23:30:51 2020 +0200
+@@ -18,7 +18,7 @@
+   <imagedata>
+     <converter src="svg" dst="*" docformat="pdf">
+       <command>
+-        inkscape -z -D --export-dpi=600 --export-%(dst)s=%(output)s %(input)s
++        inkscape -D --export-dpi=600 --export-type=%(dst)s --export-filename=%(output)s %(input)s
+       </command>
+     </converter>
+   </imagedata>
+diff -r 3ddf5d6cedcb -r 611cc4a4a878 lib/dbtexmf/core/imagedata.py
+--- a/lib/dbtexmf/core/imagedata.py	Tue Sep 10 00:40:26 2019 +0200
++++ b/lib/dbtexmf/core/imagedata.py	Tue May 05 23:30:51 2020 +0200
+@@ -178,7 +178,7 @@
+ class SvgConverter(ImageConverter):
+     def __init__(self, imgsrc, imgdst="", docformat="", backend=""):
+         ImageConverter.__init__(self, imgsrc="svg", imgdst=imgdst)
+-        self.add_command(["inkscape", "-z", "-D", "--export-%(dst)s=%(output)s",
++        self.add_command(["inkscape", "-D", "--export-type=%(dst)s", "--export-filename=%(output)s",
+                           "%(input)s"])
+ 
+