1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2015 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015 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>
11 ;;; This file is part of GNU Guix.
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26 (define-module (gnu packages graphviz)
27 #:use-module (guix packages)
28 #:use-module (guix build-system gnu)
29 #:use-module (guix build-system python)
30 #:use-module (guix download)
31 #:use-module (guix git-download)
32 #:use-module (guix utils)
33 #:use-module (gnu packages autotools)
34 #:use-module (gnu packages bison)
35 #:use-module (gnu packages check)
36 #:use-module (gnu packages compression)
37 #:use-module (gnu packages flex)
38 #:use-module (gnu packages fontutils)
39 #:use-module (gnu packages gd)
40 #:use-module (gnu packages glib)
41 #:use-module (gnu packages gnome)
42 #:use-module (gnu packages gtk)
43 #:use-module (gnu packages guile)
44 #:use-module (gnu packages image)
45 #:use-module (gnu packages perl)
46 #:use-module (gnu packages pkg-config)
47 #:use-module (gnu packages python)
48 #:use-module (gnu packages python-xyz)
49 #:use-module (gnu packages swig)
50 #:use-module (gnu packages tcl)
51 #:use-module (gnu packages tex)
52 #:use-module (gnu packages xml)
53 #:use-module (gnu packages xorg)
54 #:use-module ((guix licenses) #:prefix license:))
56 (define-public graphviz
63 "http://www.graphviz.org/pub/graphviz/ARCHIVE/graphviz-"
67 "08d4ygkxz2f553bxj6087da56a23kx1khv0j8ycxa102vvx1hlna"))))
68 (build-system gnu-build-system)
70 ;; FIXME: rtest/rtest.sh is a ksh script (!). Add ksh as an input.
73 (modify-phases %standard-phases
74 (add-after 'install 'move-docs
75 (lambda* (#:key outputs #:allow-other-keys)
76 (let ((out (assoc-ref outputs "out"))
77 (doc (assoc-ref outputs "doc")))
78 (mkdir-p (string-append doc "/share/graphviz"))
79 (rename-file (string-append out "/share/graphviz/doc")
80 (string-append doc "/share/graphviz/doc"))
82 (add-after 'move-docs 'move-guile-bindings
83 (lambda* (#:key outputs #:allow-other-keys)
84 (let* ((out (assoc-ref outputs "out"))
85 (lib (string-append out "/lib"))
86 (extdir (string-append lib
87 "/guile/2.0/extensions")))
89 (rename-file (string-append
90 lib "/graphviz/guile/libgv_guile.so")
95 `(("libXrender" ,libxrender)
98 ("gd" ,gd) ; FIXME: Our GD is too old
99 ("guile" ,guile-2.0) ;Guile bindings
102 ("fontconfig" ,fontconfig)
103 ("freetype" ,freetype)
111 ("pkg-config" ,pkg-config)))
112 (outputs '("out" "doc")) ; 5 MiB of html + pdfs
113 (home-page "http://www.graphviz.org/")
114 (synopsis "Graph visualization software")
116 "Graphviz is a graph visualization tool suite. Graph visualization is a
117 way of representing structural information as diagrams of abstract graphs and
118 networks. It has important applications in networking, bioinformatics,
119 software engineering, database and web design, machine learning, and in visual
120 interfaces for other technical domains.")
121 (license license:epl1.0)))
123 ;; Older Graphviz needed for pygraphviz. See
124 ;; https://github.com/pygraphviz/pygraphviz/issues/175
125 (define-public graphviz-2.38
126 ;; This commit corresponds to the changelog change for version 2.38.0.
127 ;; There are no tags.
128 (let ((commit "f54ac2c9313ae80ccf76ef4ac6aa9be820a23126")
130 (package (inherit graphviz)
132 (version (git-version "2.38.0" revision commit))
136 (url "https://gitlab.com/graphviz/graphviz.git")
138 (file-name (git-file-name name version))
141 "1vjg308gflmi1khgjmcj431cnkrlv12bg4cqah39mwhny92jy92x"))))
143 (substitute-keyword-arguments (package-arguments graphviz)
145 `(modify-phases ,phases
146 (add-after 'unpack 'prepare-bootstrap
148 (substitute* "autogen.sh"
149 (("/bin/sh") (which "sh"))
150 (("\\$GRAPHVIZ_VERSION_DATE") "0"))
151 (setenv "CONFIG_SHELL" (which "sh"))
152 (setenv "SHELL" (which "sh"))
154 (map make-file-writable (find-files "." ".*"))
157 (lambda _ (invoke (which "sh") "autogen.sh" "NOCONFIG") #t))))))
159 `(("autoconf" ,autoconf)
160 ("automake" ,automake)
165 ,@(package-native-inputs graphviz))))))
167 (define-public python-graphviz
169 (name "python-graphviz")
173 (uri (pypi-uri "graphviz" version ".zip"))
176 "009alrilzx0v7kl41khbq7k6k8b8pxyvbsi1b1ai933f6kpbxb30"))))
177 (build-system python-build-system)
179 '(#:phases (modify-phases %standard-phases
181 (lambda* (#:key tests #:allow-other-keys)
183 (invoke "pytest" "-vv")
184 (format #t "test suite not run~%"))
190 ("graphviz" ,graphviz)
191 ("python-mock" ,python-mock)
192 ("python-pytest" ,python-pytest)
193 ("python-pytest-cov" ,python-pytest-cov)
194 ("python-pytest-mock" ,python-pytest-mock)))
195 (home-page "https://github.com/xflr6/graphviz")
196 (synopsis "Simple Python interface for Graphviz")
198 "This package provides a simple Python interface for the Graphviz graph
199 visualization tool suite.")
200 (license license:expat)))
202 (define-public python2-graphviz
203 (package-with-python2 python-graphviz))
205 (define-public python-pygraphviz
207 (name "python-pygraphviz")
213 (url "https://github.com/pygraphviz/pygraphviz.git")
214 (commit (string-append "pygraphviz-" version))))
215 (file-name (string-append "pygraphviz-" version "-checkout"))
218 "1yldym38m8ckgflln83i88143pd9fjj1vfp23sq39fs6np5g0nzp"))))
219 (build-system python-build-system)
222 (let ((graphviz (assoc-ref %build-inputs "graphviz")))
223 (list (string-append "--include-path=" graphviz "/include")
224 (string-append "--library-path=" graphviz "/lib")))))
226 `(("graphviz" ,graphviz-2.38)))
228 `(("python-nose" ,python-nose)
229 ("python-mock" ,python-mock)
230 ("python-doctest-ignore-unicode" ,python-doctest-ignore-unicode)))
231 (home-page "http://pygraphviz.github.io")
232 (synopsis "Python interface to Graphviz")
233 (description "PyGraphviz is a Python interface to the Graphviz graph
234 layout and visualization package. With PyGraphviz you can create, edit, read,
235 write, and draw graphs using Python to access the Graphviz graph data
236 structure and layout algorithms.")
237 (license license:bsd-3)))
245 (uri (string-append "mirror://sourceforge/gts/gts/" version
246 "/gts-" version ".tar.gz"))
249 "07mqx09jxh8cv9753y2d2jsv7wp8vjmrd7zcfpbrddz3wc9kx705"))))
250 (build-system gnu-build-system)
253 (modify-phases %standard-phases
254 (add-before 'check 'pre-check
256 (chmod "test/boolean/test.sh" #o777)
259 ;; Some data files used by the test suite are missing.
260 ;; See <http://sourceforge.net/p/gts/bugs/41/>.
263 `(("pkg-config" ,pkg-config)))
265 ;; The gts.pc file has glib-2.0 as required.
267 (home-page "http://gts.sourceforge.net/")
269 ;; Note: Despite the name, this is not official GNU software.
270 (synopsis "Triangulated Surface Library")
272 "Library intended to provide a set of useful functions to deal with
273 3D surfaces meshed with interconnected triangles.")
274 (license license:lgpl2.0+)))
283 (uri (pypi-uri "xdot" version))
286 "0cr4rh7dz4dfzyxrk5pzhm0d15gkrgkfp3i5lw178xy81pc56p71"))))
287 (build-system python-build-system)
290 (modify-phases %standard-phases
291 ;; We wrap xdot, so that we don't propagate gtk+ and graphviz
292 (add-after 'install 'wrap
293 (lambda* (#:key inputs outputs #:allow-other-keys)
294 (wrap-program (string-append (assoc-ref outputs "out") "/bin/xdot")
295 `("GI_TYPELIB_PATH" ":" prefix
297 (assoc-ref inputs "gtk+") "/lib/girepository-1.0"
298 ":" (assoc-ref inputs "pango") "/lib/girepository-1.0"
299 ":" (assoc-ref inputs "gdk-pixbuf") "/lib/girepository-1.0"
300 ":" (assoc-ref inputs "atk") "/lib/girepository-1.0")))
302 (,(string-append (assoc-ref inputs "graphviz") "/bin"))))
306 ("gdk-pixbuf" ,gdk-pixbuf+svg)
307 ("graphviz" ,graphviz)
309 ("python-pycairo" ,python-pycairo)
310 ("python-pygobject" ,python-pygobject)))
311 (home-page "https://pypi.python.org/pypi/xdot")
312 (synopsis "Interactive viewer for graphviz dot files")
313 (description "Xdot is an interactive viewer for graphs written in
314 @code{graphviz}’s dot language. Internally, it uses the xdot output format as
315 an intermediate format,and @code{gtk} and @code{cairo} for rendering. Xdot can
316 be used either as a standalone application, or as a python library.")
317 (license license:lgpl3+)))
319 (define-public python-pydot
321 (name "python-pydot")
326 (uri (pypi-uri "pydot" version))
329 "1dhy4jpp646jslh2yks6klwwbaxcs905byyny880gl1iap8y5llj"))))
330 (build-system python-build-system)
333 `(("python-chardet" ,python-chardet)))
335 `(("python-pyparsing" ,python-pyparsing)))
336 (home-page "https://github.com/erocarrera/pydot")
337 (synopsis "Python interface to Graphviz's DOT language")
339 "Pydot provides an interface to create, handle, modify and process
340 graphs in Graphviz's DOT language, written in pure Python.")
341 (license license:expat)))
343 (define-public python2-pydot
344 (package-with-python2 python-pydot))
346 (define-public dot2tex
352 (uri (pypi-uri "dot2tex" version))
355 "1kp77wiv7b5qib82i3y3sn9r49rym43aaqm5aw1bwnzfbbq2m6i9"))))
356 (build-system python-build-system)
358 `(#:python ,python-2))
360 `(("texlive-latex-preview" ,texlive-latex-preview)
361 ("graphviz" ,graphviz)))
363 `(("python-pyparsing" ,python2-pyparsing)))
364 (home-page "https://github.com/kjellmf/dot2tex")
365 (synopsis "Graphviz to LaTeX converter")
367 "The purpose of @code{dot2tex} is to give graphs generated by Graphviz a
368 more LaTeX friendly look and feel. This is accomplished by converting
369 @code{xdot} output from Graphviz to a series of PSTricks or PGF/TikZ commands.
370 This approach allows:
373 @item Typesetting labels with LaTeX, allowing mathematical notation
374 @item Using native PSTricks and PGF/TikZ commands for drawing arrows
375 @item Using backend specific styles to customize the output
377 (license license:expat)))