gnu: tarlz: Update to 0.21.
[jackhill/guix/guix.git] / gnu / packages / graphviz.scm
CommitLineData
b1b07d72 1;;; GNU Guix --- Functional package management for GNU
3246cc91 2;;; Copyright © 2013, 2015 Ludovic Courtès <ludo@gnu.org>
afb87784 3;;; Copyright © 2015, 2020 Efraim Flashner <efraim@flashner.co.il>
d109b1e8 4;;; Copyright © 2016 Theodoros Foradis <theodoros@foradis.org>
c8d89256 5;;; Copyright © 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
c0ad84ff 6;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
2b295f5a 7;;; Copyright © 2017 Gábor Boskovits <boskovits@gmail.com>
d56ecf62 8;;; Copyright © 2018 Mathieu Lirzin <mthl@gnu.org>
34aa9144 9;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
39e75fa6 10;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
79f3e261 11;;; Copyright © 2020 Pjotr Prins <pjotr.guix@thebird.nl>
c578d7a2 12;;; Copyright © 2021 Bonface Munyoki Kilyungi <me@bonfacemunyoki.com>
b1b07d72
LC
13;;;
14;;; This file is part of GNU Guix.
15;;;
16;;; GNU Guix is free software; you can redistribute it and/or modify it
17;;; under the terms of the GNU General Public License as published by
18;;; the Free Software Foundation; either version 3 of the License, or (at
19;;; your option) any later version.
20;;;
21;;; GNU Guix is distributed in the hope that it will be useful, but
22;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24;;; GNU General Public License for more details.
25;;;
26;;; You should have received a copy of the GNU General Public License
27;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28
29(define-module (gnu packages graphviz)
30 #:use-module (guix packages)
31 #:use-module (guix build-system gnu)
abdd28e8 32 #:use-module (guix build-system python)
b1b07d72 33 #:use-module (guix download)
c016e390
RW
34 #:use-module (guix git-download)
35 #:use-module (guix utils)
b1aac582 36 #:use-module (gnu packages)
c8d89256
RW
37 #:use-module (gnu packages autotools)
38 #:use-module (gnu packages bison)
8b1c0dab 39 #:use-module (gnu packages check)
c8d89256 40 #:use-module (gnu packages compression)
c016e390 41 #:use-module (gnu packages flex)
c8d89256
RW
42 #:use-module (gnu packages fontutils)
43 #:use-module (gnu packages gd)
b1b07d72 44 #:use-module (gnu packages glib)
c8d89256
RW
45 #:use-module (gnu packages gnome)
46 #:use-module (gnu packages gtk)
93d2456c 47 #:use-module (gnu packages guile)
e55354b8 48 #:use-module (gnu packages image)
c016e390 49 #:use-module (gnu packages perl)
b1b07d72 50 #:use-module (gnu packages pkg-config)
c8d89256 51 #:use-module (gnu packages python)
c578d7a2 52 #:use-module (gnu packages python-check)
44d10b1f 53 #:use-module (gnu packages python-xyz)
c578d7a2 54 #:use-module (gnu packages sphinx)
93d2456c 55 #:use-module (gnu packages swig)
c016e390 56 #:use-module (gnu packages tcl)
d56ecf62 57 #:use-module (gnu packages tex)
c8d89256
RW
58 #:use-module (gnu packages xml)
59 #:use-module (gnu packages xorg)
6414410d 60 #:use-module ((guix licenses) #:prefix license:))
b1b07d72
LC
61
62(define-public graphviz
63 (package
64 (name "graphviz")
7c4c781a 65 (replacement graphviz/fixed)
8c42cee1 66 (version "2.42.3")
b1b07d72 67 (source (origin
2170cc76
AI
68 (method url-fetch)
69 (uri (string-append
8c42cee1
MB
70 "https://www2.graphviz.org/Packages/stable/portable_source/"
71 "graphviz-" version ".tar.gz"))
2170cc76
AI
72 (sha256
73 (base32
8c42cee1 74 "1pbswjbx3fjdlsxcm7cmlsl5bvaa3d6gcnr0cr8x3c8pag13zbwg"))))
b1b07d72
LC
75 (build-system gnu-build-system)
76 (arguments
77 ;; FIXME: rtest/rtest.sh is a ksh script (!). Add ksh as an input.
78 '(#:tests? #f
2170cc76
AI
79 #:phases
80 (modify-phases %standard-phases
2170cc76
AI
81 (add-after 'install 'move-docs
82 (lambda* (#:key outputs #:allow-other-keys)
83 (let ((out (assoc-ref outputs "out"))
84 (doc (assoc-ref outputs "doc")))
85 (mkdir-p (string-append doc "/share/graphviz"))
86 (rename-file (string-append out "/share/graphviz/doc")
87 (string-append doc "/share/graphviz/doc"))
88 #t)))
89 (add-after 'move-docs 'move-guile-bindings
90 (lambda* (#:key outputs #:allow-other-keys)
91 (let* ((out (assoc-ref outputs "out"))
92 (lib (string-append out "/lib"))
93 (extdir (string-append lib
94 "/guile/2.0/extensions")))
95 (mkdir-p extdir)
96 (rename-file (string-append
97 lib "/graphviz/guile/libgv_guile.so")
98 (string-append extdir
99 "/libgv_guile.so"))
100 #t))))))
b1b07d72
LC
101 (inputs
102 `(("libXrender" ,libxrender)
103 ("libX11" ,libx11)
104 ("gts" ,gts)
105 ("gd" ,gd) ; FIXME: Our GD is too old
93d2456c 106 ("guile" ,guile-2.0) ;Guile bindings
b1b07d72
LC
107 ("pango" ,pango)
108 ("fontconfig" ,fontconfig)
109 ("freetype" ,freetype)
3246cc91 110 ("libltdl" ,libltdl)
b1b07d72
LC
111 ("libXaw" ,libxaw)
112 ("expat" ,expat)
4bd428a7 113 ("libjpeg" ,libjpeg-turbo)
c4c4cc05
JD
114 ("libpng" ,libpng)))
115 (native-inputs
116 `(("bison" ,bison)
39e75fa6 117 ("swig" ,swig)
b1b07d72 118 ("pkg-config" ,pkg-config)))
88377435 119 (outputs '("out" "doc")) ; 5 MiB of html + pdfs
b1b07d72
LC
120 (home-page "http://www.graphviz.org/")
121 (synopsis "Graph visualization software")
122 (description
30ac136d 123 "Graphviz is a graph visualization tool suite. Graph visualization is a
b1b07d72
LC
124way of representing structural information as diagrams of abstract graphs and
125networks. It has important applications in networking, bioinformatics,
126software engineering, database and web design, machine learning, and in visual
127interfaces for other technical domains.")
6414410d
RW
128 (license license:epl1.0)))
129
7c4c781a
LF
130(define-public graphviz/fixed
131 (hidden-package
132 (package
133 (inherit graphviz)
134 (source (origin
135 (inherit (package-source graphviz))
136 (patches (append (search-patches "graphviz-CVE-2020-18032.patch")
137 (origin-patches (package-source graphviz)))))))))
138
c016e390
RW
139;; Older Graphviz needed for pygraphviz. See
140;; https://github.com/pygraphviz/pygraphviz/issues/175
141(define-public graphviz-2.38
142 ;; This commit corresponds to the changelog change for version 2.38.0.
143 ;; There are no tags.
144 (let ((commit "f54ac2c9313ae80ccf76ef4ac6aa9be820a23126")
145 (revision "1"))
146 (package (inherit graphviz)
147 (name "graphviz")
148 (version (git-version "2.38.0" revision commit))
149 (source (origin
150 (method git-fetch)
151 (uri (git-reference
152 (url "https://gitlab.com/graphviz/graphviz.git")
153 (commit commit)))
154 (file-name (git-file-name name version))
155 (sha256
156 (base32
157 "1vjg308gflmi1khgjmcj431cnkrlv12bg4cqah39mwhny92jy92x"))))
158 (arguments
159 (substitute-keyword-arguments (package-arguments graphviz)
160 ((#:phases phases)
161 `(modify-phases ,phases
162 (add-after 'unpack 'prepare-bootstrap
163 (lambda _
164 (substitute* "autogen.sh"
165 (("/bin/sh") (which "sh"))
166 (("\\$GRAPHVIZ_VERSION_DATE") "0"))
167 (setenv "CONFIG_SHELL" (which "sh"))
168 (setenv "SHELL" (which "sh"))
169
170 (map make-file-writable (find-files "." ".*"))
171 #t))
172 (replace 'bootstrap
173 (lambda _ (invoke (which "sh") "autogen.sh" "NOCONFIG") #t))))))
174 (native-inputs
175 `(("autoconf" ,autoconf)
176 ("automake" ,automake)
177 ("libtool" ,libtool)
178 ("flex" ,flex)
179 ("perl" ,perl)
180 ("tcl" ,tcl)
181 ,@(package-native-inputs graphviz))))))
182
6414410d
RW
183(define-public python-graphviz
184 (package
185 (name "python-graphviz")
34aa9144 186 (version "0.13.2")
6414410d
RW
187 (source (origin
188 (method url-fetch)
189 (uri (pypi-uri "graphviz" version ".zip"))
190 (sha256
191 (base32
34aa9144 192 "009alrilzx0v7kl41khbq7k6k8b8pxyvbsi1b1ai933f6kpbxb30"))))
6414410d 193 (build-system python-build-system)
34aa9144
MB
194 (arguments
195 '(#:phases (modify-phases %standard-phases
196 (replace 'check
197 (lambda* (#:key tests #:allow-other-keys)
198 (if tests
199 (invoke "pytest" "-vv")
200 (format #t "test suite not run~%"))
201 #t)))))
6414410d 202 (native-inputs
34aa9144
MB
203 `(("unzip" ,unzip)
204
205 ;; For tests.
206 ("graphviz" ,graphviz)
207 ("python-mock" ,python-mock)
208 ("python-pytest" ,python-pytest)
209 ("python-pytest-cov" ,python-pytest-cov)
210 ("python-pytest-mock" ,python-pytest-mock)))
6414410d
RW
211 (home-page "https://github.com/xflr6/graphviz")
212 (synopsis "Simple Python interface for Graphviz")
213 (description
214 "This package provides a simple Python interface for the Graphviz graph
215visualization tool suite.")
216 (license license:expat)))
217
218(define-public python2-graphviz
219 (package-with-python2 python-graphviz))
b1b07d72 220
8b1c0dab
RW
221(define-public python-pygraphviz
222 (package
223 (name "python-pygraphviz")
224 (version "1.5")
225 (source
226 (origin
227 (method git-fetch)
228 (uri (git-reference
b0e7b699 229 (url "https://github.com/pygraphviz/pygraphviz")
8b1c0dab
RW
230 (commit (string-append "pygraphviz-" version))))
231 (file-name (string-append "pygraphviz-" version "-checkout"))
232 (sha256
233 (base32
234 "1yldym38m8ckgflln83i88143pd9fjj1vfp23sq39fs6np5g0nzp"))))
235 (build-system python-build-system)
236 (arguments
237 `(#:configure-flags
238 (let ((graphviz (assoc-ref %build-inputs "graphviz")))
239 (list (string-append "--include-path=" graphviz "/include")
240 (string-append "--library-path=" graphviz "/lib")))))
241 (inputs
242 `(("graphviz" ,graphviz-2.38)))
243 (native-inputs
244 `(("python-nose" ,python-nose)
245 ("python-mock" ,python-mock)
246 ("python-doctest-ignore-unicode" ,python-doctest-ignore-unicode)))
b1ebda07 247 (home-page "https://pygraphviz.github.io")
8b1c0dab
RW
248 (synopsis "Python interface to Graphviz")
249 (description "PyGraphviz is a Python interface to the Graphviz graph
250layout and visualization package. With PyGraphviz you can create, edit, read,
251write, and draw graphs using Python to access the Graphviz graph data
252structure and layout algorithms.")
253 (license license:bsd-3)))
254
afb87784
EF
255(define-public python2-pygraphviz
256 (package-with-python2 python-pygraphviz))
257
c578d7a2
B
258(define-public python-uqbar
259 (package
260 (name "python-uqbar")
261 (version "0.5.1")
262 (source
263 (origin
264 (method git-fetch)
265 (uri (git-reference
266 (url "https://github.com/josiah-wolf-oberholtzer/uqbar")
267 (commit (string-append "v" version))))
268 (file-name (git-file-name name version))
269 (sha256
270 (base32
271 "0413nyhd8z8v3lvsgaghhafnyxg90fi1q80j1kbl21gpmpnc9a7n"))))
272 (build-system python-build-system)
273 (arguments
274 `(#:phases
275 (modify-phases %standard-phases
276 (add-after 'unpack 'patch
277 (lambda _
278 (substitute* "setup.py"
279 ;; Latest versions of sphink-rtd-theme require npm to build.
280 (("sphinx-rtd-theme >= 0.4.0") "sphinx-rtd-theme >= 0.2.4")
281 (("black == 19.10b0") "black >= 19.10b0"))
282 #t))
283 (replace 'check
284 (lambda* (#:key tests? #:allow-other-keys)
285 (when tests?
286 (invoke "python" "-m" "pytest" "tests"))
287 #t)))))
288 (native-inputs
289 `(("graphviz" ,graphviz)
290 ("python-flake8" ,python-flake8)
291 ("python-isort" ,python-isort)
292 ("python-mypy" ,python-mypy)
293 ("python-pytest" ,python-pytest)
294 ("python-pytest-cov" ,python-pytest-cov)))
295 (propagated-inputs
296 `(("python-black" ,python-black)
297 ("python-sphinx" ,python-sphinx)
298 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
299 ("python-unidecode" ,python-unidecode)))
300 (home-page "https://github.com/josiah-wolf-oberholtzer/uqbar")
301 (synopsis "Tools for building documentation with Sphinx, Graphviz and LaTeX")
302 (description
303 "This package contains tools for building documentation with Sphinx,
304Graphviz and LaTeX.")
305 (license license:expat)))
306
b1b07d72
LC
307(define-public gts
308 (package
309 (name "gts")
310 (version "0.7.6")
311 (source (origin
312 (method url-fetch)
de67e922
LF
313 (uri (string-append "mirror://sourceforge/gts/gts/" version
314 "/gts-" version ".tar.gz"))
b1b07d72
LC
315 (sha256
316 (base32
317 "07mqx09jxh8cv9753y2d2jsv7wp8vjmrd7zcfpbrddz3wc9kx705"))))
318 (build-system gnu-build-system)
319 (arguments
c0ad84ff
TGR
320 '(#:phases
321 (modify-phases %standard-phases
322 (add-before 'check 'pre-check
323 (lambda _
324 (chmod "test/boolean/test.sh" #o777)
325 #t)))
b1b07d72
LC
326
327 ;; Some data files used by the test suite are missing.
328 ;; See <http://sourceforge.net/p/gts/bugs/41/>.
329 #:tests? #f))
c4c4cc05 330 (native-inputs
b1b07d72
LC
331 `(("pkg-config" ,pkg-config)))
332 (propagated-inputs
333 ;; The gts.pc file has glib-2.0 as required.
334 `(("glib" ,glib)))
335 (home-page "http://gts.sourceforge.net/")
336
337 ;; Note: Despite the name, this is not official GNU software.
338 (synopsis "Triangulated Surface Library")
339 (description
340 "Library intended to provide a set of useful functions to deal with
3413D surfaces meshed with interconnected triangles.")
6414410d 342 (license license:lgpl2.0+)))
abdd28e8
TF
343
344(define-public xdot
345 (package
346 (name "xdot")
5395cec2 347 (version "1.1")
abdd28e8
TF
348 (source
349 (origin
350 (method url-fetch)
351 (uri (pypi-uri "xdot" version))
352 (sha256
353 (base32
5395cec2 354 "0cr4rh7dz4dfzyxrk5pzhm0d15gkrgkfp3i5lw178xy81pc56p71"))))
abdd28e8
TF
355 (build-system python-build-system)
356 (arguments
357 `(#:phases
358 (modify-phases %standard-phases
359 ;; We wrap xdot, so that we don't propagate gtk+ and graphviz
360 (add-after 'install 'wrap
361 (lambda* (#:key inputs outputs #:allow-other-keys)
362 (wrap-program (string-append (assoc-ref outputs "out") "/bin/xdot")
363 `("GI_TYPELIB_PATH" ":" prefix
364 (,(string-append
365 (assoc-ref inputs "gtk+") "/lib/girepository-1.0"
366 ":" (assoc-ref inputs "pango") "/lib/girepository-1.0"
367 ":" (assoc-ref inputs "gdk-pixbuf") "/lib/girepository-1.0"
368 ":" (assoc-ref inputs "atk") "/lib/girepository-1.0")))
369 `("PATH" ":" prefix
370 (,(string-append (assoc-ref inputs "graphviz") "/bin"))))
371 #t)))))
372 (inputs
373 `(("atk" ,atk)
374 ("gdk-pixbuf" ,gdk-pixbuf+svg)
375 ("graphviz" ,graphviz)
376 ("gtk+" ,gtk+)
377 ("python-pycairo" ,python-pycairo)
378 ("python-pygobject" ,python-pygobject)))
e85af137 379 (home-page "https://pypi.org/project/xdot/")
abdd28e8
TF
380 (synopsis "Interactive viewer for graphviz dot files")
381 (description "Xdot is an interactive viewer for graphs written in
382@code{graphviz}’s dot language. Internally, it uses the xdot output format as
1f595f3c
MB
383an intermediate format, and @code{gtk} and @code{cairo} for rendering. Xdot
384can be used either as a standalone application, or as a Python library.")
6414410d 385 (license license:lgpl3+)))
2b295f5a
GB
386
387(define-public python-pydot
388 (package
389 (name "python-pydot")
79f3e261 390 (version "1.4.1")
2b295f5a
GB
391 (source
392 (origin
393 (method url-fetch)
394 (uri (pypi-uri "pydot" version))
395 (sha256
396 (base32
b1aac582
EF
397 "00az4cbf8bv447lkk9xi6pjm7gcc7ia33y4pm71fwfwis56rv76l"))
398 (patches (search-patches "python-pydot-regression-test.patch"))))
2b295f5a 399 (build-system python-build-system)
b1aac582
EF
400 (arguments
401 '(#:phases
402 (modify-phases %standard-phases
403 (replace 'check
404 ;; Taken from .travis.yaml
405 (lambda* (#:key tests? inputs outputs #:allow-other-keys)
406 (when tests?
407 (add-installed-pythonpath inputs outputs)
408 (with-directory-excursion "test"
409 (invoke "python" "pydot_unittest.py")))
410 #t)))))
29ddbc56
TGR
411 (native-inputs
412 ;; For tests.
b1aac582
EF
413 `(("graphviz" ,graphviz)
414 ("python-chardet" ,python-chardet)))
2b295f5a
GB
415 (propagated-inputs
416 `(("python-pyparsing" ,python-pyparsing)))
f8be1474 417 (home-page "https://github.com/pydot/pydot")
2b295f5a
GB
418 (synopsis "Python interface to Graphviz's DOT language")
419 (description
420 "Pydot provides an interface to create, handle, modify and process
421graphs in Graphviz's DOT language, written in pure Python.")
422 (license license:expat)))
423
424(define-public python2-pydot
425 (package-with-python2 python-pydot))
d56ecf62
ML
426
427(define-public dot2tex
428 (package
429 (name "dot2tex")
1cb055f0 430 (version "2.11.3")
d56ecf62
ML
431 (source (origin
432 (method url-fetch)
433 (uri (pypi-uri "dot2tex" version))
434 (sha256
435 (base32
1cb055f0 436 "1kp77wiv7b5qib82i3y3sn9r49rym43aaqm5aw1bwnzfbbq2m6i9"))))
d56ecf62
ML
437 (build-system python-build-system)
438 (arguments
439 `(#:python ,python-2))
440 (inputs
441 `(("texlive-latex-preview" ,texlive-latex-preview)
442 ("graphviz" ,graphviz)))
443 (propagated-inputs
444 `(("python-pyparsing" ,python2-pyparsing)))
445 (home-page "https://github.com/kjellmf/dot2tex")
446 (synopsis "Graphviz to LaTeX converter")
447 (description
448 "The purpose of @code{dot2tex} is to give graphs generated by Graphviz a
449more LaTeX friendly look and feel. This is accomplished by converting
450@code{xdot} output from Graphviz to a series of PSTricks or PGF/TikZ commands.
451This approach allows:
452
453@itemize @bullet
454@item Typesetting labels with LaTeX, allowing mathematical notation
455@item Using native PSTricks and PGF/TikZ commands for drawing arrows
456@item Using backend specific styles to customize the output
457@end itemize")
458 (license license:expat)))