summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorSimon South <simon@simonsouth.net>2022-01-22 18:19:24 -0500
committerLudovic Courtès <ludo@gnu.org>2022-03-28 09:33:14 +0200
commit08bb73749e55a8b8078062a0ab6f4f0eed53a475 (patch)
treef04b05bdd7a0f44bd3d3f18ac30daeed5ffa7a8d /gnu
parente7f1e1a78d6e4fea0f06a57c93957a6577ed23ab (diff)
downloadguix-08bb73749e55a8b8078062a0ab6f4f0eed53a475.tar.gz
gnu: texlive-psnfss: Fix build; add "doc" output.
* gnu/packages/tex.scm (texlive-psnfss)[outputs]: Add "doc".
[arguments]<#:phases>: Add "chdir-back", "clean-installed-files" and
"move-doc-files" phases to ensure files are correctly arranged in package's
outputs, matching installation instructions in README.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/tex.scm32
1 files changed, 31 insertions, 1 deletions
diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index 165a2b7181..818f4d9fff 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -20,6 +20,7 @@
 ;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
 ;;; Copyright © 2021 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2021 Thiago Jung Bauermann <bauermann@kolabnow.com>
+;;; Copyright © 2022 Simon South <simon@simonsouth.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -4155,6 +4156,7 @@ definitions.")
                     "0gmdzhgr0h57xhsl61c5jsp4fj4pbmdr8p6k96am5jbyrbbx121q"))))
     (package
       (inherit template)
+      (outputs '("out" "doc"))
       (arguments
        (substitute-keyword-arguments (package-arguments template)
          ((#:tex-directory _ #t)
@@ -4533,7 +4535,35 @@ language that is written in a Cyrillic alphabet.")
           `(modify-phases ,phases
              (add-after 'unpack 'chdir
                (lambda _
-                 (chdir "source/latex/psnfss")))))))
+                 (chdir "source/latex/psnfss")))
+             (add-after 'install 'chdir-back
+               (lambda _
+                 (chdir "../../..")))
+             (add-after 'chdir-back 'clean-installed-files
+               (lambda _
+                 ;; Remove the generated .sty files from the build area as
+                 ;; these were already copied to the default output in the
+                 ;; "install" phase.
+                 (delete-file-recursively "source/latex/psnfss/build")))
+             (add-after 'clean-installed-files 'move-doc-files
+               (lambda* (#:key outputs #:allow-other-keys)
+                 (let* ((doc (assoc-ref outputs "doc"))
+                        (doc-root (string-append doc "/share/texmf-dist"))
+                        (doc-path "doc/latex/psnfss")
+                        (source-path "source/latex/psnfss"))
+                   ;; Move the PDF documentation to the "doc" output.
+                   (let* ((file-name "psnfss2e.pdf")
+                          (source (string-append doc-path "/" file-name))
+                          (target-dir (string-append doc-root "/" doc-path)))
+                     (mkdir-p target-dir)
+                     (copy-file source
+                                (string-append target-dir "/" file-name))
+                     (delete-file source))
+
+                   ;; Keep the remaining files together with the package's
+                   ;; source, as per the installation instructions.
+                   (copy-recursively doc-path source-path)
+                   (delete-file-recursively "doc"))))))))
       (native-inputs
        (list texlive-cm))
       (home-page "https://www.ctan.org/pkg/psnfss")