Subject: bug#63050: Reducing the closure size of Graphviz

From: Ludovic Courtès <[email-masked]>
Date: Wed, 03 May 2023 21:50:30 +0200

Hey!

Ludovic Courtès <[email-masked]> skribis:

> This is apparently coming from Graphviz:
>
> $ guix graph --path guix libx11
> [email-masked]
> [email-masked]
> [email-masked]
> $ guix graph --path guix libxt
> [email-masked]
> [email-masked]
> [email-masked]
> [email-masked]
>
> Surprising to me, but apparently it’s been this way from the start,
> commit b1b07d72c755ea314fb0c8333cd88293ee504ce4 (2013!).
>
> Maybe these are optional dependencies?

All the X libraries can be seen in the output of:

  ldd $(guix build graphviz |grep -v 'doc$')/lib/graphviz/libgvplugin_xlib.so

I haven’t checked but I suppose that’s used by ‘xdot’.

We can get an X11-free Graphviz like so:

diff --git a/gnu/packages/graphviz.scm b/gnu/packages/graphviz.scm
index 26ee96afd4..3a5d33e662 100644
--- a/gnu/packages/graphviz.scm
+++ b/gnu/packages/graphviz.scm
@@ -94,16 +94,12 @@ (define-public graphviz
                                   (string-append extdir
                                                  "/libgv_guile.so"))))))))
     (inputs
-     (list libxrender
-           libx11
-           gts
+     (list gts
            gd
            guile-3.0                    ;Guile bindings
-           pango
            fontconfig
            freetype
            libltdl
-           libxaw
            expat
            libjpeg-turbo
            libpng))

The closure size reduction is substantial:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix size graphviz | tail -1
total: 183.6 MiB
$ guix size graphviz | tail -1
total: 242.3 MiB
--8<---------------cut here---------------end--------------->8---

But I suspect we’d still need the full-blown variant for things like
xdot.

Ludo’.