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