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>
10 ;;; This file is part of GNU Guix.
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25 (define-module (gnu packages graphviz)
26 #:use-module (guix packages)
27 #:use-module (guix build-system gnu)
28 #:use-module (guix build-system python)
29 #:use-module (guix download)
30 #:use-module (guix git-download)
31 #:use-module (guix utils)
32 #:use-module (gnu packages autotools)
33 #:use-module (gnu packages bison)
34 #:use-module (gnu packages check)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages flex)
37 #:use-module (gnu packages fontutils)
38 #:use-module (gnu packages gd)
39 #:use-module (gnu packages glib)
40 #:use-module (gnu packages gnome)
41 #:use-module (gnu packages gtk)
42 #:use-module (gnu packages guile)
43 #:use-module (gnu packages image)
44 #:use-module (gnu packages perl)
45 #:use-module (gnu packages pkg-config)
46 #:use-module (gnu packages python)
47 #:use-module (gnu packages python-xyz)
48 #:use-module (gnu packages swig)
49 #:use-module (gnu packages tcl)
50 #:use-module (gnu packages tex)
51 #:use-module (gnu packages xml)
52 #:use-module (gnu packages xorg)
53 #:use-module ((guix licenses) #:prefix license:))
55 (define-public graphviz
62 "http://www.graphviz.org/pub/graphviz/ARCHIVE/graphviz-"
66 "08d4ygkxz2f553bxj6087da56a23kx1khv0j8ycxa102vvx1hlna"))))
67 (build-system gnu-build-system)
69 ;; FIXME: rtest/rtest.sh is a ksh script (!). Add ksh as an input.
72 (modify-phases %standard-phases
73 (add-after 'install 'move-docs
74 (lambda* (#:key outputs #:allow-other-keys)
75 (let ((out (assoc-ref outputs "out"))
76 (doc (assoc-ref outputs "doc")))
77 (mkdir-p (string-append doc "/share/graphviz"))
78 (rename-file (string-append out "/share/graphviz/doc")
79 (string-append doc "/share/graphviz/doc"))
81 (add-after 'move-docs 'move-guile-bindings
82 (lambda* (#:key outputs #:allow-other-keys)
83 (let* ((out (assoc-ref outputs "out"))
84 (lib (string-append out "/lib"))
85 (extdir (string-append lib
86 "/guile/2.0/extensions")))
88 (rename-file (string-append
89 lib "/graphviz/guile/libgv_guile.so")
94 `(("libXrender" ,libxrender)
97 ("gd" ,gd) ; FIXME: Our GD is too old
98 ("guile" ,guile-2.0) ;Guile bindings
101 ("fontconfig" ,fontconfig)
102 ("freetype" ,freetype)
110 ("pkg-config" ,pkg-config)))
111 (outputs '("out" "doc")) ; 5 MiB of html + pdfs
112 (home-page "http://www.graphviz.org/")
113 (synopsis "Graph visualization software")
115 "Graphviz is a graph visualization tool suite. Graph visualization is a
116 way of representing structural information as diagrams of abstract graphs and
117 networks. It has important applications in networking, bioinformatics,
118 software engineering, database and web design, machine learning, and in visual
119 interfaces for other technical domains.")
120 (license license:epl1.0)))
122 ;; Older Graphviz needed for pygraphviz. See
123 ;; https://github.com/pygraphviz/pygraphviz/issues/175
124 (define-public graphviz-2.38
125 ;; This commit corresponds to the changelog change for version 2.38.0.
126 ;; There are no tags.
127 (let ((commit "f54ac2c9313ae80ccf76ef4ac6aa9be820a23126")
129 (package (inherit graphviz)
131 (version (git-version "2.38.0" revision commit))
135 (url "https://gitlab.com/graphviz/graphviz.git")
137 (file-name (git-file-name name version))
140 "1vjg308gflmi1khgjmcj431cnkrlv12bg4cqah39mwhny92jy92x"))))
142 (substitute-keyword-arguments (package-arguments graphviz)
144 `(modify-phases ,phases
145 (add-after 'unpack 'prepare-bootstrap
147 (substitute* "autogen.sh"
148 (("/bin/sh") (which "sh"))
149 (("\\$GRAPHVIZ_VERSION_DATE") "0"))
150 (setenv "CONFIG_SHELL" (which "sh"))
151 (setenv "SHELL" (which "sh"))
153 (map make-file-writable (find-files "." ".*"))
156 (lambda _ (invoke (which "sh") "autogen.sh" "NOCONFIG") #t))))))
158 `(("autoconf" ,autoconf)
159 ("automake" ,automake)
164 ,@(package-native-inputs graphviz))))))
166 (define-public python-graphviz
168 (name "python-graphviz")
172 (uri (pypi-uri "graphviz" version ".zip"))
175 "17v8h7j2yz8hy1jf7q8p0ik8dmf32m58lc6v11x7aqc4pnfa2n29"))))
176 (build-system python-build-system)
179 (home-page "https://github.com/xflr6/graphviz")
180 (synopsis "Simple Python interface for Graphviz")
182 "This package provides a simple Python interface for the Graphviz graph
183 visualization tool suite.")
184 (license license:expat)))
186 (define-public python2-graphviz
187 (package-with-python2 python-graphviz))
189 (define-public python-pygraphviz
191 (name "python-pygraphviz")
197 (url "https://github.com/pygraphviz/pygraphviz.git")
198 (commit (string-append "pygraphviz-" version))))
199 (file-name (string-append "pygraphviz-" version "-checkout"))
202 "1yldym38m8ckgflln83i88143pd9fjj1vfp23sq39fs6np5g0nzp"))))
203 (build-system python-build-system)
206 (let ((graphviz (assoc-ref %build-inputs "graphviz")))
207 (list (string-append "--include-path=" graphviz "/include")
208 (string-append "--library-path=" graphviz "/lib")))))
210 `(("graphviz" ,graphviz-2.38)))
212 `(("python-nose" ,python-nose)
213 ("python-mock" ,python-mock)
214 ("python-doctest-ignore-unicode" ,python-doctest-ignore-unicode)))
215 (home-page "http://pygraphviz.github.io")
216 (synopsis "Python interface to Graphviz")
217 (description "PyGraphviz is a Python interface to the Graphviz graph
218 layout and visualization package. With PyGraphviz you can create, edit, read,
219 write, and draw graphs using Python to access the Graphviz graph data
220 structure and layout algorithms.")
221 (license license:bsd-3)))
229 (uri (string-append "mirror://sourceforge/gts/gts/" version
230 "/gts-" version ".tar.gz"))
233 "07mqx09jxh8cv9753y2d2jsv7wp8vjmrd7zcfpbrddz3wc9kx705"))))
234 (build-system gnu-build-system)
237 (modify-phases %standard-phases
238 (add-before 'check 'pre-check
240 (chmod "test/boolean/test.sh" #o777)
243 ;; Some data files used by the test suite are missing.
244 ;; See <http://sourceforge.net/p/gts/bugs/41/>.
247 `(("pkg-config" ,pkg-config)))
249 ;; The gts.pc file has glib-2.0 as required.
251 (home-page "http://gts.sourceforge.net/")
253 ;; Note: Despite the name, this is not official GNU software.
254 (synopsis "Triangulated Surface Library")
256 "Library intended to provide a set of useful functions to deal with
257 3D surfaces meshed with interconnected triangles.")
258 (license license:lgpl2.0+)))
267 (uri (pypi-uri "xdot" version))
270 "0cr4rh7dz4dfzyxrk5pzhm0d15gkrgkfp3i5lw178xy81pc56p71"))))
271 (build-system python-build-system)
274 (modify-phases %standard-phases
275 ;; We wrap xdot, so that we don't propagate gtk+ and graphviz
276 (add-after 'install 'wrap
277 (lambda* (#:key inputs outputs #:allow-other-keys)
278 (wrap-program (string-append (assoc-ref outputs "out") "/bin/xdot")
279 `("GI_TYPELIB_PATH" ":" prefix
281 (assoc-ref inputs "gtk+") "/lib/girepository-1.0"
282 ":" (assoc-ref inputs "pango") "/lib/girepository-1.0"
283 ":" (assoc-ref inputs "gdk-pixbuf") "/lib/girepository-1.0"
284 ":" (assoc-ref inputs "atk") "/lib/girepository-1.0")))
286 (,(string-append (assoc-ref inputs "graphviz") "/bin"))))
290 ("gdk-pixbuf" ,gdk-pixbuf+svg)
291 ("graphviz" ,graphviz)
293 ("python-pycairo" ,python-pycairo)
294 ("python-pygobject" ,python-pygobject)))
295 (home-page "https://pypi.python.org/pypi/xdot")
296 (synopsis "Interactive viewer for graphviz dot files")
297 (description "Xdot is an interactive viewer for graphs written in
298 @code{graphviz}’s dot language. Internally, it uses the xdot output format as
299 an intermediate format,and @code{gtk} and @code{cairo} for rendering. Xdot can
300 be used either as a standalone application, or as a python library.")
301 (license license:lgpl3+)))
303 (define-public python-pydot
305 (name "python-pydot")
310 (uri (pypi-uri "pydot" version))
313 "1dhy4jpp646jslh2yks6klwwbaxcs905byyny880gl1iap8y5llj"))))
314 (build-system python-build-system)
317 `(("python-chardet" ,python-chardet)))
319 `(("python-pyparsing" ,python-pyparsing)))
320 (home-page "https://github.com/erocarrera/pydot")
321 (synopsis "Python interface to Graphviz's DOT language")
323 "Pydot provides an interface to create, handle, modify and process
324 graphs in Graphviz's DOT language, written in pure Python.")
325 (license license:expat)))
327 (define-public python2-pydot
328 (package-with-python2 python-pydot))
330 (define-public dot2tex
336 (uri (pypi-uri "dot2tex" version))
339 "0jhdwp0wv2h0xb7j2s5xiv7i8yaqgfpwwqcyrjvaxkfwsynm8gkx"))))
340 (build-system python-build-system)
342 `(#:python ,python-2))
344 `(("texlive-latex-preview" ,texlive-latex-preview)
345 ("graphviz" ,graphviz)))
347 `(("python-pyparsing" ,python2-pyparsing)))
348 (home-page "https://github.com/kjellmf/dot2tex")
349 (synopsis "Graphviz to LaTeX converter")
351 "The purpose of @code{dot2tex} is to give graphs generated by Graphviz a
352 more LaTeX friendly look and feel. This is accomplished by converting
353 @code{xdot} output from Graphviz to a series of PSTricks or PGF/TikZ commands.
354 This approach allows:
357 @item Typesetting labels with LaTeX, allowing mathematical notation
358 @item Using native PSTricks and PGF/TikZ commands for drawing arrows
359 @item Using backend specific styles to customize the output
361 (license license:expat)))