Subject: bug#37850: Glib documentation is missing

From: Marius Bakke <[email-masked]>
Date: Thu, 21 Nov 2019 20:50:16 +0100

Pierre Neidhardt <[email-masked]> writes:

> Oh, that makes total sense, thanks for the explanation Marius!
>
> Alright, final patch attached.
> Let me know if I should merge on master.

Looks good!

> From 29d27b64fb7bbf96a2ed59a3e1c4179717770f5c Mon Sep 17 00:00:00 2001
> From: Pierre Neidhardt <[email-masked]>
> Date: Mon, 11 Nov 2019 15:38:11 +0100
> Subject: [PATCH] gnu: Add glib-with-documentation.
>
> * gnu/packages/glib.scm (glib-with-documentation): New variable.
> (glib): Hide package.

This should say (glib)[properties]: ...

[...]
  
> +(define-public glib-with-documentation
> +  ;; glib's doc must be built in a separate package since it requires gtk-doc,
> +  ;; which in turn depends on glib.
> +  (package
> +    (inherit glib)
> +    (properties '((hidden? . #f)))

Using (alist-delete 'hidden? (package-properties glib)) is more future
proof.  :-)

> +    (outputs (cons "doc" (package-outputs glib))) ; 20 MiB of GTK-Doc reference
> +    (native-inputs
> +     `(("gtk-doc" ,gtk-doc)             ; for the doc
> +       ("docbook-xml" ,docbook-xml)
> +       ,@(package-native-inputs glib)))
> +    (arguments
> +     (substitute-keyword-arguments (package-arguments glib)
> +       ((#:configure-flags flags ''())
> +        `(cons "-Dgtk_doc=true" ,flags))
> +       ((#:phases phases)
> +        `(modify-phases ,phases
> +           (add-after 'unpack 'make-local-docbook-xml
> +             (lambda* (#:key inputs #:allow-other-keys)
> +               (let ((replace-http
> +                      (lambda (file)
> +                        (substitute* file
> +                          ;; Warning: gio.xml uses docbook 4.2, hence the "4.." pattern.
> +                          (("http://www.oasis-open.org/docbook/xml/4../docbookx.dtd")
> +                           (string-append (assoc-ref inputs "docbook-xml")
> +                                          "/xml/dtd/docbook/docbookx.dtd"))))))
> +                 (replace-http "gio/gdbus-2.0/codegen/codegen_docbook.py")
> +                 (for-each replace-http (find-files "." "\\.xml$"))
> +                 #t)))

Can this phase be removed if you add 'libxml2' to inputs (for the
$XML_CATALOG_FILES search path)?

Otherwise LGTM!