diff mbox series

[bug#71787,12/12] gnu: Add ghostscript-documentation.

Message ID 20240626192717.12818-12-david.elsing@posteo.net
State New
Headers show
Series Update and unbundle ghostscript and mupdf | expand

Commit Message

David Elsing June 26, 2024, 7:27 p.m. UTC
* gnu/packages/ghostscript.scm (ghostscript-documentation): New variable.
---
 gnu/packages/ghostscript.scm | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
diff mbox series

Patch

diff --git a/gnu/packages/ghostscript.scm b/gnu/packages/ghostscript.scm
index 8c4cccb06e..6d2653e26e 100644
--- a/gnu/packages/ghostscript.scm
+++ b/gnu/packages/ghostscript.scm
@@ -40,6 +40,8 @@  (define-module (gnu packages ghostscript)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages sphinx)
   #:use-module (gnu packages tcl)
   #:use-module (gnu packages xorg)
   #:use-module ((guix licenses) #:prefix license:)
@@ -49,6 +51,7 @@  (define-module (gnu packages ghostscript)
   #:use-module (guix git-download)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system trivial)
   #:use-module (srfi srfi-1))
 
 (define-public lcms
@@ -417,6 +420,39 @@  (define-public ghostscript
       ;; inclusion in Postscript and PDF files.
       (license:non-copyleft "file://LICENSE")))))
 
+;; Put the documentation in a separate package due to a circular dependency of
+;; ghostscript with python-sphinx.
+(define-public ghostscript-documentation
+  (package
+    (inherit ghostscript)
+    (name (string-append (package-name ghostscript) "-documentation"))
+    (native-inputs
+     (list
+      python
+      python-pymupdf
+      python-rst2pdf
+      python-sphinx
+      python-sphinx-copybutton
+      python-sphinx-rtd-theme))
+    (inputs '())
+    (arguments
+     (list
+      #:tests? #f
+      #:phases
+      #~(modify-phases %standard-phases
+          (delete 'bootstrap)
+          (delete 'configure)
+          (replace 'build
+            (lambda _
+              (chdir "doc")
+              (invoke "sphinx-build" "-b" "html" "src" "build")))
+          (replace 'install
+            (lambda _
+              (copy-recursively
+               "build" (string-append #$output "/share/doc/ghostscript/"
+                                      #$(package-version this-package))))))))
+    (license license:agpl3+)))
+
 (define-public ghostscript/x
   (package/inherit ghostscript
     (name (string-append (package-name ghostscript) "-with-x"))