1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2015 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015, 2020 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2016 Theodoros Foradis <theodoros@foradis.org>
5 ;;; Copyright © 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
6 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2017 Gábor Boskovits <boskovits@gmail.com>
8 ;;; Copyright © 2018 Mathieu Lirzin <mthl@gnu.org>
9 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
10 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
12 ;;; This file is part of GNU Guix.
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27 (define-module (gnu packages graphviz)
28 #:use-module (guix packages)
29 #:use-module (guix build-system gnu)
30 #:use-module (guix build-system python)
31 #:use-module (guix download)
32 #:use-module (guix git-download)
33 #:use-module (guix utils)
34 #:use-module (gnu packages autotools)
35 #:use-module (gnu packages bison)
36 #:use-module (gnu packages check)
37 #:use-module (gnu packages compression)
38 #:use-module (gnu packages flex)
39 #:use-module (gnu packages fontutils)
40 #:use-module (gnu packages gd)
41 #:use-module (gnu packages glib)
42 #:use-module (gnu packages gnome)
43 #:use-module (gnu packages gtk)
44 #:use-module (gnu packages guile)
45 #:use-module (gnu packages image)
46 #:use-module (gnu packages perl)
47 #:use-module (gnu packages pkg-config)
48 #:use-module (gnu packages python)
49 #:use-module (gnu packages python-xyz)
50 #:use-module (gnu packages swig)
51 #:use-module (gnu packages tcl)
52 #:use-module (gnu packages tex)
53 #:use-module (gnu packages xml)
54 #:use-module (gnu packages xorg)
55 #:use-module ((guix licenses) #:prefix license:))
57 (define-public graphviz
64 "https://www2.graphviz.org/Packages/stable/portable_source/"
65 "graphviz-" version ".tar.gz"))
68 "1pbswjbx3fjdlsxcm7cmlsl5bvaa3d6gcnr0cr8x3c8pag13zbwg"))))
69 (build-system gnu-build-system)
71 ;; FIXME: rtest/rtest.sh is a ksh script (!). Add ksh as an input.
74 (modify-phases %standard-phases
75 (add-after 'install 'move-docs
76 (lambda* (#:key outputs #:allow-other-keys)
77 (let ((out (assoc-ref outputs "out"))
78 (doc (assoc-ref outputs "doc")))
79 (mkdir-p (string-append doc "/share/graphviz"))
80 (rename-file (string-append out "/share/graphviz/doc")
81 (string-append doc "/share/graphviz/doc"))
83 (add-after 'move-docs 'move-guile-bindings
84 (lambda* (#:key outputs #:allow-other-keys)
85 (let* ((out (assoc-ref outputs "out"))
86 (lib (string-append out "/lib"))
87 (extdir (string-append lib
88 "/guile/2.0/extensions")))
90 (rename-file (string-append
91 lib "/graphviz/guile/libgv_guile.so")
96 `(("libXrender" ,libxrender)
99 ("gd" ,gd) ; FIXME: Our GD is too old
100 ("guile" ,guile-2.0) ;Guile bindings
102 ("fontconfig" ,fontconfig)
103 ("freetype" ,freetype)
107 ("libjpeg" ,libjpeg-turbo)
112 ("pkg-config" ,pkg-config)))
113 (outputs '("out" "doc")) ; 5 MiB of html + pdfs
114 (home-page "http://www.graphviz.org/")
115 (synopsis "Graph visualization software")
117 "Graphviz is a graph visualization tool suite. Graph visualization is a
118 way of representing structural information as diagrams of abstract graphs and
119 networks. It has important applications in networking, bioinformatics,
120 software engineering, database and web design, machine learning, and in visual
121 interfaces for other technical domains.")
122 (license license:epl1.0)))
124 ;; Older Graphviz needed for pygraphviz. See
125 ;; https://github.com/pygraphviz/pygraphviz/issues/175
126 (define-public graphviz-2.38
127 ;; This commit corresponds to the changelog change for version 2.38.0.
128 ;; There are no tags.
129 (let ((commit "f54ac2c9313ae80ccf76ef4ac6aa9be820a23126")
131 (package (inherit graphviz)
133 (version (git-version "2.38.0" revision commit))
137 (url "https://gitlab.com/graphviz/graphviz.git")
139 (file-name (git-file-name name version))
142 "1vjg308gflmi1khgjmcj431cnkrlv12bg4cqah39mwhny92jy92x"))))
144 (substitute-keyword-arguments (package-arguments graphviz)
146 `(modify-phases ,phases
147 (add-after 'unpack 'prepare-bootstrap
149 (substitute* "autogen.sh"
150 (("/bin/sh") (which "sh"))
151 (("\\$GRAPHVIZ_VERSION_DATE") "0"))
152 (setenv "CONFIG_SHELL" (which "sh"))
153 (setenv "SHELL" (which "sh"))
155 (map make-file-writable (find-files "." ".*"))
158 (lambda _ (invoke (which "sh") "autogen.sh" "NOCONFIG") #t))))))
160 `(("autoconf" ,autoconf)
161 ("automake" ,automake)
166 ,@(package-native-inputs graphviz))))))
168 (define-public python-graphviz
170 (name "python-graphviz")
174 (uri (pypi-uri "graphviz" version ".zip"))
177 "009alrilzx0v7kl41khbq7k6k8b8pxyvbsi1b1ai933f6kpbxb30"))))
178 (build-system python-build-system)
180 '(#:phases (modify-phases %standard-phases
182 (lambda* (#:key tests #:allow-other-keys)
184 (invoke "pytest" "-vv")
185 (format #t "test suite not run~%"))
191 ("graphviz" ,graphviz)
192 ("python-mock" ,python-mock)
193 ("python-pytest" ,python-pytest)
194 ("python-pytest-cov" ,python-pytest-cov)
195 ("python-pytest-mock" ,python-pytest-mock)))
196 (home-page "https://github.com/xflr6/graphviz")
197 (synopsis "Simple Python interface for Graphviz")
199 "This package provides a simple Python interface for the Graphviz graph
200 visualization tool suite.")
201 (license license:expat)))
203 (define-public python2-graphviz
204 (package-with-python2 python-graphviz))
206 (define-public python-pygraphviz
208 (name "python-pygraphviz")
214 (url "https://github.com/pygraphviz/pygraphviz")
215 (commit (string-append "pygraphviz-" version))))
216 (file-name (string-append "pygraphviz-" version "-checkout"))
219 "1yldym38m8ckgflln83i88143pd9fjj1vfp23sq39fs6np5g0nzp"))))
220 (build-system python-build-system)
223 (let ((graphviz (assoc-ref %build-inputs "graphviz")))
224 (list (string-append "--include-path=" graphviz "/include")
225 (string-append "--library-path=" graphviz "/lib")))))
227 `(("graphviz" ,graphviz-2.38)))
229 `(("python-nose" ,python-nose)
230 ("python-mock" ,python-mock)
231 ("python-doctest-ignore-unicode" ,python-doctest-ignore-unicode)))
232 (home-page "https://pygraphviz.github.io")
233 (synopsis "Python interface to Graphviz")
234 (description "PyGraphviz is a Python interface to the Graphviz graph
235 layout and visualization package. With PyGraphviz you can create, edit, read,
236 write, and draw graphs using Python to access the Graphviz graph data
237 structure and layout algorithms.")
238 (license license:bsd-3)))
240 (define-public python2-pygraphviz
241 (package-with-python2 python-pygraphviz))
249 (uri (string-append "mirror://sourceforge/gts/gts/" version
250 "/gts-" version ".tar.gz"))
253 "07mqx09jxh8cv9753y2d2jsv7wp8vjmrd7zcfpbrddz3wc9kx705"))))
254 (build-system gnu-build-system)
257 (modify-phases %standard-phases
258 (add-before 'check 'pre-check
260 (chmod "test/boolean/test.sh" #o777)
263 ;; Some data files used by the test suite are missing.
264 ;; See <http://sourceforge.net/p/gts/bugs/41/>.
267 `(("pkg-config" ,pkg-config)))
269 ;; The gts.pc file has glib-2.0 as required.
271 (home-page "http://gts.sourceforge.net/")
273 ;; Note: Despite the name, this is not official GNU software.
274 (synopsis "Triangulated Surface Library")
276 "Library intended to provide a set of useful functions to deal with
277 3D surfaces meshed with interconnected triangles.")
278 (license license:lgpl2.0+)))
287 (uri (pypi-uri "xdot" version))
290 "0cr4rh7dz4dfzyxrk5pzhm0d15gkrgkfp3i5lw178xy81pc56p71"))))
291 (build-system python-build-system)
294 (modify-phases %standard-phases
295 ;; We wrap xdot, so that we don't propagate gtk+ and graphviz
296 (add-after 'install 'wrap
297 (lambda* (#:key inputs outputs #:allow-other-keys)
298 (wrap-program (string-append (assoc-ref outputs "out") "/bin/xdot")
299 `("GI_TYPELIB_PATH" ":" prefix
301 (assoc-ref inputs "gtk+") "/lib/girepository-1.0"
302 ":" (assoc-ref inputs "pango") "/lib/girepository-1.0"
303 ":" (assoc-ref inputs "gdk-pixbuf") "/lib/girepository-1.0"
304 ":" (assoc-ref inputs "atk") "/lib/girepository-1.0")))
306 (,(string-append (assoc-ref inputs "graphviz") "/bin"))))
310 ("gdk-pixbuf" ,gdk-pixbuf+svg)
311 ("graphviz" ,graphviz)
313 ("python-pycairo" ,python-pycairo)
314 ("python-pygobject" ,python-pygobject)))
315 (home-page "https://pypi.org/project/xdot/")
316 (synopsis "Interactive viewer for graphviz dot files")
317 (description "Xdot is an interactive viewer for graphs written in
318 @code{graphviz}’s dot language. Internally, it uses the xdot output format as
319 an intermediate format, and @code{gtk} and @code{cairo} for rendering. Xdot
320 can be used either as a standalone application, or as a Python library.")
321 (license license:lgpl3+)))
323 (define-public python-pydot
325 (name "python-pydot")
330 (uri (pypi-uri "pydot" version))
333 "1dhy4jpp646jslh2yks6klwwbaxcs905byyny880gl1iap8y5llj"))))
334 (build-system python-build-system)
337 `(("python-chardet" ,python-chardet)))
339 `(("python-pyparsing" ,python-pyparsing)))
340 (home-page "https://github.com/erocarrera/pydot")
341 (synopsis "Python interface to Graphviz's DOT language")
343 "Pydot provides an interface to create, handle, modify and process
344 graphs in Graphviz's DOT language, written in pure Python.")
345 (license license:expat)))
347 (define-public python2-pydot
348 (package-with-python2 python-pydot))
350 (define-public dot2tex
356 (uri (pypi-uri "dot2tex" version))
359 "1kp77wiv7b5qib82i3y3sn9r49rym43aaqm5aw1bwnzfbbq2m6i9"))))
360 (build-system python-build-system)
362 `(#:python ,python-2))
364 `(("texlive-latex-preview" ,texlive-latex-preview)
365 ("graphviz" ,graphviz)))
367 `(("python-pyparsing" ,python2-pyparsing)))
368 (home-page "https://github.com/kjellmf/dot2tex")
369 (synopsis "Graphviz to LaTeX converter")
371 "The purpose of @code{dot2tex} is to give graphs generated by Graphviz a
372 more LaTeX friendly look and feel. This is accomplished by converting
373 @code{xdot} output from Graphviz to a series of PSTricks or PGF/TikZ commands.
374 This approach allows:
377 @item Typesetting labels with LaTeX, allowing mathematical notation
378 @item Using native PSTricks and PGF/TikZ commands for drawing arrows
379 @item Using backend specific styles to customize the output
381 (license license:expat)))