Subject: [PATCH gnome-team v3 5/5] gnu: shared-mime-info: Add doc output.

From: Bruno Victal <[email-masked]>
Date: Mon, 19 Jun 2023 23:07:08 +0100

* gnu/packages/freedesktop.scm (shared-mime-info)
[arguments]<#:phases>: Add 'install-doc phase.
[outputs]: Add 'doc' output.
[native-inputs]: Add docbook-xml-4.1.2, docbook-xsl and xmlto.
---
 gnu/packages/freedesktop.scm | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index 50321fd9a7..9f0447d89b 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -544,11 +544,24 @@ (define-public shared-mime-info
                                  (not (string-prefix? "./tests/mime-detection"
                                                       file))))))
                 (for-each patch-shebang
-                          (find-files "." pred #:stat lstat))))))))
+                          (find-files "." pred #:stat lstat)))))
+          ;; The docs have no install rule.
+          (add-after 'install 'install-doc
+            (lambda* (#:key source #:allow-other-keys)
+              (let ((dest (string-append #$output:doc "/share/doc")))
+                (with-directory-excursion "data/shared-mime-info-spec-html"
+                  (install-file "shared-mime-info-spec.html"
+                                (string-append dest "/html")))
+                (install-file (string-append source
+                                             "/data/shared-mime-info-spec.xml")
+                              dest)))))))
     (inputs
      (list glib libxml2))
     (native-inputs
-     (list gettext-minimal pkg-config python xdgmime))
+     (list gettext-minimal pkg-config python xdgmime
+           ;; For 'doc' output.
+           docbook-xml-4.1.2 docbook-xsl xmlto))
+    (outputs (list "out" "doc"))
     (home-page "https://www.freedesktop.org/wiki/Software/shared-mime-info")
     (synopsis "Database of common MIME types")
     (description
-- 
2.39.2