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