Subject: Re: bug#37850: Glib documentation is missing

From: Pierre Neidhardt <[email-masked]>
Date: Sun, 03 Nov 2019 17:39:56 +0100

Find a patch attached.  What do you think?

-- 
Pierre Neidhardt
https://ambrevar.xyz/
>From 893613a3b99c20688cc331d2926dbee28cc143d7 Mon Sep 17 00:00:00 2001
From: Pierre Neidhardt <[email-masked]>
Date: Sun, 3 Nov 2019 17:36:17 +0100
Subject: [PATCH] gnu: Add glib-minimal and build glib doc.

glib documentation must be built with gtk-doc which in turn depends on glib,
so we need to define glib-minimal which does not depend on gtk-doc.

* gnu/packages/glib.scm (glib-minimal): New variable.
(glib)[source]: Don't use `name'.
* gnu/packages/avahi.scm: Use glib-minimal when necessary.
* gnu/packages/cups.scm: Use glib-minimal when necessary.
* gnu/packages/gnome.scm: Use glib-minimal when necessary.
* gnu/packages/graphviz.scm: Use glib-minimal when necessary.
* gnu/packages/gtk.scm: Use glib-minimal when necessary.
* gnu/packages/inkscape.scm: Use glib-minimal when necessary.
* gnu/packages/pdf.scm: Use glib-minimal when necessary.
---
 gnu/packages/avahi.scm    |  4 ++--
 gnu/packages/cups.scm     |  4 ++--
 gnu/packages/glib.scm     | 35 ++++++++++++++++++++++++++---------
 gnu/packages/gnome.scm    | 16 ++++++++--------
 gnu/packages/graphviz.scm |  2 +-
 gnu/packages/gtk.scm      | 22 +++++++++++-----------
 gnu/packages/inkscape.scm |  2 +-
 gnu/packages/pdf.scm      |  4 ++--
 8 files changed, 53 insertions(+), 36 deletions(-)

diff --git a/gnu/packages/avahi.scm b/gnu/packages/avahi.scm
index e84fed6a71..0b577ca990 100644
--- a/gnu/packages/avahi.scm
+++ b/gnu/packages/avahi.scm
@@ -59,14 +59,14 @@
                            "--enable-compat-libdns_sd")))
     (inputs
      `(("expat" ,expat)
-       ("glib" ,glib)
+       ("glib" ,glib-minimal)
        ("dbus" ,dbus)
        ("gdbm" ,gdbm)
        ("libcap" ,libcap)            ;to enable chroot support in avahi-daemon
        ("libdaemon" ,libdaemon)))
     (native-inputs
      `(("intltool" ,intltool)
-       ("glib" ,glib "bin")
+       ("glib" ,glib-minimal "bin")
        ("pkg-config" ,pkg-config)))
     (synopsis "Implementation of mDNS/DNS-SD protocols")
     (description
diff --git a/gnu/packages/cups.scm b/gnu/packages/cups.scm
index 694ed6b039..8a1fe66073 100644
--- a/gnu/packages/cups.scm
+++ b/gnu/packages/cups.scm
@@ -147,7 +147,7 @@
                                                out "/lib/cups/filter")))
                         #t))))))
     (native-inputs
-     `(("glib" ,glib "bin") ; for gdbus-codegen
+     `(("glib" ,glib-minimal "bin") ; for gdbus-codegen
        ("pkg-config" ,pkg-config)))
     (inputs
      `(("avahi"        ,avahi)
@@ -161,7 +161,7 @@
        ("libjpeg"      ,libjpeg)
        ("libpng"       ,libpng)
        ("libtiff"      ,libtiff)
-       ("glib"         ,glib)
+       ("glib"         ,glib-minimal)
        ("qpdf"         ,qpdf)
        ("poppler"      ,poppler)
        ("cups-minimal" ,cups-minimal)))
diff --git a/gnu/packages/glib.scm b/gnu/packages/glib.scm
index b3e85f8df9..2ac270f9c9 100644
--- a/gnu/packages/glib.scm
+++ b/gnu/packages/glib.scm
@@ -71,6 +71,7 @@
   ;; Export variables up-front to allow circular dependency with the 'xorg'
   ;; module.
   #:export (dbus
+            glib-minimal
             glib
             gobject-introspection
             dbus-glib
@@ -159,15 +160,15 @@ or through unencrypted TCP/IP suitable for use behind a firewall with
 shared NFS home directories.")
     (license license:gpl2+)))                     ; or Academic Free License 2.1
 
-(define glib
+(define glib-minimal
   (package
-   (name "glib")
+   (name "glib-minimal")
    (version "2.60.6")
    (source (origin
             (method url-fetch)
-            (uri (string-append "mirror://gnome/sources/"
-                                name "/" (string-take version 4) "/"
-                                name "-" version ".tar.xz"))
+            (uri (string-append "mirror://gnome/sources/glib/"
+                                (string-take version 4) "/"
+                                "glib-" version ".tar.xz"))
             (sha256
              (base32
               "0v7vpx2md1gn0wwiirn7g4bhf2csfvcr03y96q2zv97ain6sp3zz"))
@@ -348,6 +349,22 @@ dynamic loading, and an object system.")
    (home-page "https://developer.gnome.org/glib/")
    (license license:lgpl2.1+)))
 
+(define glib
+  (package
+    (inherit glib-minimal)
+    (name "glib")
+    (outputs (cons "doc" (package-outputs glib-minimal))) ; 20 MiB of GTK-Doc reference
+    (native-inputs
+     `(("gtk-doc" ,gtk-doc)             ; for the doc
+       ,@(package-native-inputs glib-minimal)))
+    (arguments
+     (substitute-keyword-arguments (package-arguments glib-minimal)
+       ((#:configure-flags flags)
+        `(cons (string-append "--with-html-dir="
+                              (assoc-ref %outputs "doc")
+                              "/share/gtk-doc/html")
+               ,flags))))))
+
 (define gobject-introspection
   (package
     (name "gobject-introspection")
@@ -376,11 +393,11 @@ dynamic loading, and an object system.")
     (inputs
      `(("bison" ,bison)
        ("flex" ,flex)
-       ("glib" ,glib)
+       ("glib" ,glib-minimal)
        ("python" ,python-wrapper)
        ("zlib" ,zlib)))
     (native-inputs
-     `(("glib" ,glib "bin")
+     `(("glib" ,glib-minimal "bin")
        ("pkg-config" ,pkg-config)))
     (propagated-inputs
      `(;; In practice, GIR users will need libffi when using
@@ -597,10 +614,10 @@ has an ease of use unmatched by other C++ callback libraries.")
                 "return 77;\n"))
              #t)))))
     (native-inputs `(("pkg-config" ,pkg-config)
-                     ("glib" ,glib "bin")))
+                     ("glib" ,glib-minimal "bin")))
     (propagated-inputs
      `(("libsigc++" ,libsigc++)
-       ("glib" ,glib)))
+       ("glib" ,glib-minimal)))
     (home-page "https://gtkmm.org/")
     (synopsis "C++ interface to the GLib library")
     (description
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index cd881b5b87..636c665f21 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -991,7 +991,7 @@ guidelines.")
      ;; The build system appears not to be parallel-safe.
      '(#:parallel-build? #f))
     (inputs
-     `(("glib" ,glib)
+     `(("glib" ,glib-minimal)
        ("libxml2" ,libxml2)))
     (native-inputs
      `(("intltool" ,intltool)
@@ -1282,7 +1282,7 @@ the GNOME desktop environment.")
     (native-inputs
      `(("pkg-config" ,pkg-config)))
     (inputs
-     `(("glib" ,glib)
+     `(("glib" ,glib-minimal)
        ("libxml2" ,libxml2)
        ("zlib" ,zlib)))
     (home-page "https://github.com/GNOME/libcroco")
@@ -1318,7 +1318,7 @@ XML/CSS rendering engine.")
        ("bzip2" ,bzip2)))
     (propagated-inputs
      `(("gdk-pixbuf" ,gdk-pixbuf)
-       ("glib" ,glib)
+       ("glib" ,glib-minimal)
        ("libxml2" ,libxml2)))
     (home-page "https://www.gnome.org/projects/libgsf")
     (synopsis "GNOME's Structured File Library")
@@ -1375,7 +1375,7 @@ dealing with different structured file formats.")
     (native-inputs
      `(("pkg-config" ,pkg-config)
        ("vala" ,vala)
-       ("glib" ,glib "bin")                               ; glib-mkenums, etc.
+       ("glib" ,glib-minimal "bin")                               ; glib-mkenums, etc.
        ("gobject-introspection" ,gobject-introspection))) ; g-ir-compiler, etc.
     (inputs
      `(("pango" ,pango)
@@ -1387,7 +1387,7 @@ dealing with different structured file formats.")
      ;; librsvg-2.0.pc refers to all of that.
      `(("cairo" ,cairo)
        ("gdk-pixbuf" ,gdk-pixbuf)
-       ("glib" ,glib)))
+       ("glib" ,glib-minimal)))
     (home-page "https://wiki.gnome.org/LibRsvg")
     (synopsis "Render SVG files using Cairo")
     (description
@@ -1466,7 +1466,7 @@ library.")
        ("rust" ,rust-1.34)
        ("cargo" ,rust-1.34 "cargo")
        ("vala" ,vala)
-       ("glib" ,glib "bin")                               ; glib-mkenums, etc.
+       ("glib" ,glib-minimal "bin")                               ; glib-mkenums, etc.
        ("gobject-introspection" ,gobject-introspection))) ; g-ir-compiler, etc.
     (inputs
      `(("pango" ,pango)
@@ -1478,7 +1478,7 @@ library.")
      ;; librsvg-2.0.pc refers to all of that.
      `(("cairo" ,cairo)
        ("gdk-pixbuf" ,gdk-pixbuf)
-       ("glib" ,glib)))
+       ("glib" ,glib-minimal)))
     (home-page "https://wiki.gnome.org/LibRsvg")
     (synopsis "Render SVG files using Cairo")
     (description
@@ -2304,7 +2304,7 @@ passwords in the GNOME keyring.")
     (inputs
      `(("graphviz" ,graphviz)))
     (propagated-inputs
-     `(("glib" ,glib))) ; required by libvala-0.40.pc
+     `(("glib" ,glib-minimal))) ; required by libvala-0.40.pc
     (home-page "https://live.gnome.org/Vala/")
     (synopsis "Compiler for the GObject type system")
     (description
diff --git a/gnu/packages/graphviz.scm b/gnu/packages/graphviz.scm
index f9667e873b..e49579cd0e 100644
--- a/gnu/packages/graphviz.scm
+++ b/gnu/packages/graphviz.scm
@@ -247,7 +247,7 @@ structure and layout algorithms.")
      `(("pkg-config" ,pkg-config)))
     (propagated-inputs
      ;; The gts.pc file has glib-2.0 as required.
-     `(("glib" ,glib)))
+     `(("glib" ,glib-minimal)))
     (home-page "http://gts.sourceforge.net/")
 
     ;; Note: Despite the name, this is not official GNU software.
diff --git a/gnu/packages/gtk.scm b/gnu/packages/gtk.scm
index 436018efdb..cc637e7438 100644
--- a/gnu/packages/gtk.scm
+++ b/gnu/packages/gtk.scm
@@ -99,11 +99,11 @@
              (base32
               "1k4i817bd2w5b9z394f2yyx95591l2746wa40am0vvz4gzdgwhfb"))))
    (build-system meson-build-system)
-   (propagated-inputs `(("glib" ,glib))) ; required by atk.pc
+   (propagated-inputs `(("glib" ,glib-minimal))) ; required by atk.pc
    (native-inputs
     `(("pkg-config" ,pkg-config)
       ("gettext" ,gettext-minimal)
-      ("glib" ,glib "bin")                               ; glib-mkenums, etc.
+      ("glib" ,glib-minimal "bin")                               ; glib-mkenums, etc.
       ("gobject-introspection" ,gobject-introspection))) ; g-ir-compiler, etc.
    (synopsis "GNOME accessibility toolkit")
    (description
@@ -128,7 +128,7 @@ tools have full access to view and control running applications.")
    (propagated-inputs
     `(("fontconfig" ,fontconfig)
       ("freetype" ,freetype)
-      ("glib" ,glib)
+      ("glib" ,glib-minimal)
       ("libpng" ,libpng)
       ("libx11" ,libx11)
       ("libxext" ,libxext)
@@ -197,11 +197,11 @@ affine transformation (scale, rotation, shear, etc.).")
     `(("cairo" ,cairo)))
    (propagated-inputs
     ;; There are all in the Requires or Requires.private field of '.pc'.
-    `(("glib" ,glib)
+    `(("glib" ,glib-minimal)
       ("graphite2" ,graphite2)
       ("icu4c" ,icu4c)))
    (native-inputs
-    `(("glib:bin" ,glib "bin")          ;for glib-mkenums
+    `(("glib:bin" ,glib-minimal "bin")          ;for glib-mkenums
       ("gobject-introspection" ,gobject-introspection)
       ("pkg-config" ,pkg-config)
       ("python" ,python-wrapper)
@@ -237,7 +237,7 @@ affine transformation (scale, rotation, shear, etc.).")
       ("fribidi" ,fribidi)
       ("fontconfig" ,fontconfig)
       ("freetype" ,freetype)
-      ("glib" ,glib)
+      ("glib" ,glib-minimal)
       ("harfbuzz" ,harfbuzz)))
    (inputs
     `(("zlib" ,zlib)
@@ -247,7 +247,7 @@ affine transformation (scale, rotation, shear, etc.).")
       ("libxft" ,libxft)))
    (native-inputs
     `(("pkg-config" ,pkg-config)
-      ("glib" ,glib "bin")                               ; glib-mkenums, etc.
+      ("glib" ,glib-minimal "bin")                               ; glib-mkenums, etc.
       ("gobject-introspection" ,gobject-introspection))) ; g-ir-compiler, etc.
    (synopsis "GNOME text and font handling library")
    (description
@@ -507,7 +507,7 @@ highlighting and other features typical of a source code editor.")
             #t)))))
    (propagated-inputs
     `(;; Required by gdk-pixbuf-2.0.pc
-      ("glib" ,glib)
+      ("glib" ,glib-minimal)
       ("libpng" ,libpng)
       ;; Used for testing and required at runtime.
       ("shared-mime-info" ,shared-mime-info)))
@@ -518,7 +518,7 @@ highlighting and other features typical of a source code editor.")
    (native-inputs
      `(("pkg-config" ,pkg-config)
        ("gettext" ,gettext-minimal)
-       ("glib" ,glib "bin")                               ; glib-mkenums, etc.
+       ("glib" ,glib-minimal "bin")                               ; glib-mkenums, etc.
        ("gobject-introspection" ,gobject-introspection))) ; g-ir-compiler, etc.
    (synopsis "GNOME image loading and manipulation library")
    (description
@@ -696,7 +696,7 @@ is part of the GNOME accessibility project.")
    (native-inputs
     `(("perl" ,perl)
       ("gettext" ,gettext-minimal)
-      ("glib" ,glib "bin")
+      ("glib" ,glib-minimal "bin")
       ("gobject-introspection" ,gobject-introspection)
       ("pkg-config" ,pkg-config)
       ("python-wrapper" ,python-wrapper)))
@@ -1516,7 +1516,7 @@ information.")
        ("docbook-xml" ,docbook-xml-4.3)
        ("docbook-xsl" ,docbook-xsl)
        ("source-highlight" ,source-highlight)
-       ("glib" ,glib)
+       ("glib" ,glib-minimal)
        ("python-six" ,python-six)))
     (home-page "https://www.gtk.org/gtk-doc/")
     (synopsis "Documentation generator from C source code")
diff --git a/gnu/packages/inkscape.scm b/gnu/packages/inkscape.scm
index 1ad23a92d4..e5d951ae1a 100644
--- a/gnu/packages/inkscape.scm
+++ b/gnu/packages/inkscape.scm
@@ -75,7 +75,7 @@
        ("boost" ,boost)))
     (native-inputs
      `(("intltool" ,intltool)
-       ("glib" ,glib "bin")
+       ("glib" ,glib-minimal "bin")
        ("perl" ,perl)
        ("pkg-config" ,pkg-config)))
     ;; FIXME: tests require gmock
diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm
index f54200a54d..3e4a5100e6 100644
--- a/gnu/packages/pdf.scm
+++ b/gnu/packages/pdf.scm
@@ -119,10 +119,10 @@
     ;; As per poppler-cairo and poppler-glib.pc.
     ;; XXX: Ideally we'd propagate Cairo too, but that would require a
     ;; different solution to the circular dependency mentioned above.
-    `(("glib" ,glib)))
+    `(("glib" ,glib-minimal)))
    (native-inputs
       `(("pkg-config" ,pkg-config)
-        ("glib" ,glib "bin")                      ; glib-mkenums, etc.
+        ("glib" ,glib-minimal "bin")                      ; glib-mkenums, etc.
         ("gobject-introspection" ,gobject-introspection)))
    (arguments
     `(#:tests? #f ; no test data provided with the tarball
-- 
2.23.0