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>
11 ;;; Copyright © 2020 Pjotr Prins <pjotr.guix@thebird.nl>
13 ;;; This file is part of GNU Guix.
15 ;;; GNU Guix is free software; you can redistribute it and/or modify it
16 ;;; under the terms of the GNU General Public License as published by
17 ;;; the Free Software Foundation; either version 3 of the License, or (at
18 ;;; your option) any later version.
20 ;;; GNU Guix is distributed in the hope that it will be useful, but
21 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;;; GNU General Public License for more details.
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28 (define-module (gnu packages graphviz)
29 #:use-module (guix packages)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system python)
32 #:use-module (guix download)
33 #:use-module (guix git-download)
34 #:use-module (guix utils)
35 #:use-module (gnu packages autotools)
36 #:use-module (gnu packages bison)
37 #:use-module (gnu packages check)
38 #:use-module (gnu packages compression)
39 #:use-module (gnu packages flex)
40 #:use-module (gnu packages fontutils)
41 #:use-module (gnu packages gd)
42 #:use-module (gnu packages glib)
43 #:use-module (gnu packages gnome)
44 #:use-module (gnu packages gtk)
45 #:use-module (gnu packages guile)
46 #:use-module (gnu packages image)
47 #:use-module (gnu packages perl)
48 #:use-module (gnu packages pkg-config)
49 #:use-module (gnu packages python)
50 #:use-module (gnu packages python-xyz)
51 #:use-module (gnu packages swig)
52 #:use-module (gnu packages tcl)
53 #:use-module (gnu packages tex)
54 #:use-module (gnu packages xml)
55 #:use-module (gnu packages xorg)
56 #:use-module ((guix licenses) #:prefix license:))
58 (define-public graphviz
65 "https://www2.graphviz.org/Packages/stable/portable_source/"
66 "graphviz-" version ".tar.gz"))
69 "1pbswjbx3fjdlsxcm7cmlsl5bvaa3d6gcnr0cr8x3c8pag13zbwg"))))
70 (build-system gnu-build-system)
72 ;; FIXME: rtest/rtest.sh is a ksh script (!). Add ksh as an input.
75 (modify-phases %standard-phases
76 (add-after 'install 'move-docs
77 (lambda* (#:key outputs #:allow-other-keys)
78 (let ((out (assoc-ref outputs "out"))
79 (doc (assoc-ref outputs "doc")))
80 (mkdir-p (string-append doc "/share/graphviz"))
81 (rename-file (string-append out "/share/graphviz/doc")
82 (string-append doc "/share/graphviz/doc"))
84 (add-after 'move-docs 'move-guile-bindings
85 (lambda* (#:key outputs #:allow-other-keys)
86 (let* ((out (assoc-ref outputs "out"))
87 (lib (string-append out "/lib"))
88 (extdir (string-append lib
89 "/guile/2.0/extensions")))
91 (rename-file (string-append
92 lib "/graphviz/guile/libgv_guile.so")
97 `(("libXrender" ,libxrender)
100 ("gd" ,gd) ; FIXME: Our GD is too old
101 ("guile" ,guile-2.0) ;Guile bindings
103 ("fontconfig" ,fontconfig)
104 ("freetype" ,freetype)
108 ("libjpeg" ,libjpeg-turbo)
113 ("pkg-config" ,pkg-config)))
114 (outputs '("out" "doc")) ; 5 MiB of html + pdfs
115 (home-page "http://www.graphviz.org/")
116 (synopsis "Graph visualization software")
118 "Graphviz is a graph visualization tool suite. Graph visualization is a
119 way of representing structural information as diagrams of abstract graphs and
120 networks. It has important applications in networking, bioinformatics,
121 software engineering, database and web design, machine learning, and in visual
122 interfaces for other technical domains.")
123 (license license:epl1.0)))
125 ;; Older Graphviz needed for pygraphviz. See
126 ;; https://github.com/pygraphviz/pygraphviz/issues/175
127 (define-public graphviz-2.38
128 ;; This commit corresponds to the changelog change for version 2.38.0.
129 ;; There are no tags.
130 (let ((commit "f54ac2c9313ae80ccf76ef4ac6aa9be820a23126")
132 (package (inherit graphviz)
134 (version (git-version "2.38.0" revision commit))
138 (url "https://gitlab.com/graphviz/graphviz.git")
140 (file-name (git-file-name name version))
143 "1vjg308gflmi1khgjmcj431cnkrlv12bg4cqah39mwhny92jy92x"))))
145 (substitute-keyword-arguments (package-arguments graphviz)
147 `(modify-phases ,phases
148 (add-after 'unpack 'prepare-bootstrap
150 (substitute* "autogen.sh"
151 (("/bin/sh") (which "sh"))
152 (("\\$GRAPHVIZ_VERSION_DATE") "0"))
153 (setenv "CONFIG_SHELL" (which "sh"))
154 (setenv "SHELL" (which "sh"))
156 (map make-file-writable (find-files "." ".*"))
159 (lambda _ (invoke (which "sh") "autogen.sh" "NOCONFIG") #t))))))
161 `(("autoconf" ,autoconf)
162 ("automake" ,automake)
167 ,@(package-native-inputs graphviz))))))
169 (define-public python-graphviz
171 (name "python-graphviz")
175 (uri (pypi-uri "graphviz" version ".zip"))
178 "009alrilzx0v7kl41khbq7k6k8b8pxyvbsi1b1ai933f6kpbxb30"))))
179 (build-system python-build-system)
181 '(#:phases (modify-phases %standard-phases
183 (lambda* (#:key tests #:allow-other-keys)
185 (invoke "pytest" "-vv")
186 (format #t "test suite not run~%"))
192 ("graphviz" ,graphviz)
193 ("python-mock" ,python-mock)
194 ("python-pytest" ,python-pytest)
195 ("python-pytest-cov" ,python-pytest-cov)
196 ("python-pytest-mock" ,python-pytest-mock)))
197 (home-page "https://github.com/xflr6/graphviz")
198 (synopsis "Simple Python interface for Graphviz")
200 "This package provides a simple Python interface for the Graphviz graph
201 visualization tool suite.")
202 (license license:expat)))
204 (define-public python2-graphviz
205 (package-with-python2 python-graphviz))
207 (define-public python-pygraphviz
209 (name "python-pygraphviz")
215 (url "https://github.com/pygraphviz/pygraphviz")
216 (commit (string-append "pygraphviz-" version))))
217 (file-name (string-append "pygraphviz-" version "-checkout"))
220 "1yldym38m8ckgflln83i88143pd9fjj1vfp23sq39fs6np5g0nzp"))))
221 (build-system python-build-system)
224 (let ((graphviz (assoc-ref %build-inputs "graphviz")))
225 (list (string-append "--include-path=" graphviz "/include")
226 (string-append "--library-path=" graphviz "/lib")))))
228 `(("graphviz" ,graphviz-2.38)))
230 `(("python-nose" ,python-nose)
231 ("python-mock" ,python-mock)
232 ("python-doctest-ignore-unicode" ,python-doctest-ignore-unicode)))
233 (home-page "https://pygraphviz.github.io")
234 (synopsis "Python interface to Graphviz")
235 (description "PyGraphviz is a Python interface to the Graphviz graph
236 layout and visualization package. With PyGraphviz you can create, edit, read,
237 write, and draw graphs using Python to access the Graphviz graph data
238 structure and layout algorithms.")
239 (license license:bsd-3)))
241 (define-public python2-pygraphviz
242 (package-with-python2 python-pygraphviz))
250 (uri (string-append "mirror://sourceforge/gts/gts/" version
251 "/gts-" version ".tar.gz"))
254 "07mqx09jxh8cv9753y2d2jsv7wp8vjmrd7zcfpbrddz3wc9kx705"))))
255 (build-system gnu-build-system)
258 (modify-phases %standard-phases
259 (add-before 'check 'pre-check
261 (chmod "test/boolean/test.sh" #o777)
264 ;; Some data files used by the test suite are missing.
265 ;; See <http://sourceforge.net/p/gts/bugs/41/>.
268 `(("pkg-config" ,pkg-config)))
270 ;; The gts.pc file has glib-2.0 as required.
272 (home-page "http://gts.sourceforge.net/")
274 ;; Note: Despite the name, this is not official GNU software.
275 (synopsis "Triangulated Surface Library")
277 "Library intended to provide a set of useful functions to deal with
278 3D surfaces meshed with interconnected triangles.")
279 (license license:lgpl2.0+)))
288 (uri (pypi-uri "xdot" version))
291 "0cr4rh7dz4dfzyxrk5pzhm0d15gkrgkfp3i5lw178xy81pc56p71"))))
292 (build-system python-build-system)
295 (modify-phases %standard-phases
296 ;; We wrap xdot, so that we don't propagate gtk+ and graphviz
297 (add-after 'install 'wrap
298 (lambda* (#:key inputs outputs #:allow-other-keys)
299 (wrap-program (string-append (assoc-ref outputs "out") "/bin/xdot")
300 `("GI_TYPELIB_PATH" ":" prefix
302 (assoc-ref inputs "gtk+") "/lib/girepository-1.0"
303 ":" (assoc-ref inputs "pango") "/lib/girepository-1.0"
304 ":" (assoc-ref inputs "gdk-pixbuf") "/lib/girepository-1.0"
305 ":" (assoc-ref inputs "atk") "/lib/girepository-1.0")))
307 (,(string-append (assoc-ref inputs "graphviz") "/bin"))))
311 ("gdk-pixbuf" ,gdk-pixbuf+svg)
312 ("graphviz" ,graphviz)
314 ("python-pycairo" ,python-pycairo)
315 ("python-pygobject" ,python-pygobject)))
316 (home-page "https://pypi.org/project/xdot/")
317 (synopsis "Interactive viewer for graphviz dot files")
318 (description "Xdot is an interactive viewer for graphs written in
319 @code{graphviz}’s dot language. Internally, it uses the xdot output format as
320 an intermediate format, and @code{gtk} and @code{cairo} for rendering. Xdot
321 can be used either as a standalone application, or as a Python library.")
322 (license license:lgpl3+)))
324 (define-public python-pydot
326 (name "python-pydot")
331 (uri (pypi-uri "pydot" version))
334 "00az4cbf8bv447lkk9xi6pjm7gcc7ia33y4pm71fwfwis56rv76l"))))
335 (build-system python-build-system)
338 `(("python-chardet" ,python-chardet)))
340 `(("python-pyparsing" ,python-pyparsing)))
341 (home-page "https://github.com/erocarrera/pydot")
342 (synopsis "Python interface to Graphviz's DOT language")
344 "Pydot provides an interface to create, handle, modify and process
345 graphs in Graphviz's DOT language, written in pure Python.")
346 (license license:expat)))
348 (define-public python2-pydot
349 (package-with-python2 python-pydot))
351 (define-public dot2tex
357 (uri (pypi-uri "dot2tex" version))
360 "1kp77wiv7b5qib82i3y3sn9r49rym43aaqm5aw1bwnzfbbq2m6i9"))))
361 (build-system python-build-system)
363 `(#:python ,python-2))
365 `(("texlive-latex-preview" ,texlive-latex-preview)
366 ("graphviz" ,graphviz)))
368 `(("python-pyparsing" ,python2-pyparsing)))
369 (home-page "https://github.com/kjellmf/dot2tex")
370 (synopsis "Graphviz to LaTeX converter")
372 "The purpose of @code{dot2tex} is to give graphs generated by Graphviz a
373 more LaTeX friendly look and feel. This is accomplished by converting
374 @code{xdot} output from Graphviz to a series of PSTricks or PGF/TikZ commands.
375 This approach allows:
378 @item Typesetting labels with LaTeX, allowing mathematical notation
379 @item Using native PSTricks and PGF/TikZ commands for drawing arrows
380 @item Using backend specific styles to customize the output
382 (license license:expat)))