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 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 xorg)
33 #:use-module (gnu packages flex)
34 #:use-module (gnu packages gtk)
35 #:use-module (gnu packages xml)
36 #:use-module (gnu packages glib)
37 #:use-module (gnu packages guile)
38 #:use-module (gnu packages bison)
39 #:use-module (gnu packages image)
40 #:use-module (gnu packages autotools)
41 #:use-module (gnu packages perl)
42 #:use-module (gnu packages pkg-config)
43 #:use-module (gnu packages glib)
44 #:use-module (gnu packages gtk)
45 #:use-module (gnu packages gnome)
46 #:use-module (gnu packages fontutils)
47 #:use-module (gnu packages compression)
48 #:use-module (gnu packages gd)
49 #:use-module (gnu packages swig)
50 #:use-module (gnu packages tcl)
51 #:use-module (gnu packages python)
52 #:use-module (gnu packages tex)
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))
195 (uri (string-append "mirror://sourceforge/gts/gts/" version
196 "/gts-" version ".tar.gz"))
199 "07mqx09jxh8cv9753y2d2jsv7wp8vjmrd7zcfpbrddz3wc9kx705"))))
200 (build-system gnu-build-system)
203 (modify-phases %standard-phases
204 (add-before 'check 'pre-check
206 (chmod "test/boolean/test.sh" #o777)
209 ;; Some data files used by the test suite are missing.
210 ;; See <http://sourceforge.net/p/gts/bugs/41/>.
213 `(("pkg-config" ,pkg-config)))
215 ;; The gts.pc file has glib-2.0 as required.
217 (home-page "http://gts.sourceforge.net/")
219 ;; Note: Despite the name, this is not official GNU software.
220 (synopsis "Triangulated Surface Library")
222 "Library intended to provide a set of useful functions to deal with
223 3D surfaces meshed with interconnected triangles.")
224 (license license:lgpl2.0+)))
233 (uri (pypi-uri "xdot" version))
236 "1q0f3pskb09saw1qkd2s6vmk80rq5zjhq8l93dfr2x6r04r0q46j"))))
237 (build-system python-build-system)
240 (modify-phases %standard-phases
241 ;; We wrap xdot, so that we don't propagate gtk+ and graphviz
242 (add-after 'install 'wrap
243 (lambda* (#:key inputs outputs #:allow-other-keys)
244 (wrap-program (string-append (assoc-ref outputs "out") "/bin/xdot")
245 `("GI_TYPELIB_PATH" ":" prefix
247 (assoc-ref inputs "gtk+") "/lib/girepository-1.0"
248 ":" (assoc-ref inputs "pango") "/lib/girepository-1.0"
249 ":" (assoc-ref inputs "gdk-pixbuf") "/lib/girepository-1.0"
250 ":" (assoc-ref inputs "atk") "/lib/girepository-1.0")))
252 (,(string-append (assoc-ref inputs "graphviz") "/bin"))))
256 ("gdk-pixbuf" ,gdk-pixbuf+svg)
257 ("graphviz" ,graphviz)
259 ("python-pycairo" ,python-pycairo)
260 ("python-pygobject" ,python-pygobject)))
261 (home-page "https://pypi.python.org/pypi/xdot")
262 (synopsis "Interactive viewer for graphviz dot files")
263 (description "Xdot is an interactive viewer for graphs written in
264 @code{graphviz}’s dot language. Internally, it uses the xdot output format as
265 an intermediate format,and @code{gtk} and @code{cairo} for rendering. Xdot can
266 be used either as a standalone application, or as a python library.")
267 (license license:lgpl3+)))
269 (define-public python-pydot
271 (name "python-pydot")
276 (uri (pypi-uri "pydot" version))
279 "1dhy4jpp646jslh2yks6klwwbaxcs905byyny880gl1iap8y5llj"))))
280 (build-system python-build-system)
283 `(("python-chardet" ,python-chardet)))
285 `(("python-pyparsing" ,python-pyparsing)))
286 (home-page "https://github.com/erocarrera/pydot")
287 (synopsis "Python interface to Graphviz's DOT language")
289 "Pydot provides an interface to create, handle, modify and process
290 graphs in Graphviz's DOT language, written in pure Python.")
291 (license license:expat)))
293 (define-public python2-pydot
294 (package-with-python2 python-pydot))
296 (define-public dot2tex
302 (uri (pypi-uri "dot2tex" version))
305 "0jhdwp0wv2h0xb7j2s5xiv7i8yaqgfpwwqcyrjvaxkfwsynm8gkx"))))
306 (build-system python-build-system)
308 `(#:python ,python-2))
310 `(("texlive-latex-preview" ,texlive-latex-preview)
311 ("graphviz" ,graphviz)))
313 `(("python-pyparsing" ,python2-pyparsing)))
314 (home-page "https://github.com/kjellmf/dot2tex")
315 (synopsis "Graphviz to LaTeX converter")
317 "The purpose of @code{dot2tex} is to give graphs generated by Graphviz a
318 more LaTeX friendly look and feel. This is accomplished by converting
319 @code{xdot} output from Graphviz to a series of PSTricks or PGF/TikZ commands.
320 This approach allows:
323 @item Typesetting labels with LaTeX, allowing mathematical notation
324 @item Using native PSTricks and PGF/TikZ commands for drawing arrows
325 @item Using backend specific styles to customize the output
327 (license license:expat)))