gnu: deutex: Update to 5.2.1.
[jackhill/guix/guix.git] / gnu / packages / graphviz.scm
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, 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 ;;;
10 ;;; This file is part of GNU Guix.
11 ;;;
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.
16 ;;;
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.
21 ;;;
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/>.
24
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 autotools)
33 #:use-module (gnu packages bison)
34 #:use-module (gnu packages check)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages flex)
37 #:use-module (gnu packages fontutils)
38 #:use-module (gnu packages gd)
39 #:use-module (gnu packages glib)
40 #:use-module (gnu packages gnome)
41 #:use-module (gnu packages gtk)
42 #:use-module (gnu packages guile)
43 #:use-module (gnu packages image)
44 #:use-module (gnu packages perl)
45 #:use-module (gnu packages pkg-config)
46 #:use-module (gnu packages python)
47 #:use-module (gnu packages python-xyz)
48 #:use-module (gnu packages swig)
49 #:use-module (gnu packages tcl)
50 #:use-module (gnu packages tex)
51 #:use-module (gnu packages xml)
52 #:use-module (gnu packages xorg)
53 #:use-module ((guix licenses) #:prefix license:))
54
55 (define-public graphviz
56 (package
57 (name "graphviz")
58 (version "2.40.1")
59 (source (origin
60 (method url-fetch)
61 (uri (string-append
62 "http://www.graphviz.org/pub/graphviz/ARCHIVE/graphviz-"
63 version ".tar.gz"))
64 (sha256
65 (base32
66 "08d4ygkxz2f553bxj6087da56a23kx1khv0j8ycxa102vvx1hlna"))))
67 (build-system gnu-build-system)
68 (arguments
69 ;; FIXME: rtest/rtest.sh is a ksh script (!). Add ksh as an input.
70 '(#:tests? #f
71 #:phases
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"))
80 #t)))
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")))
87 (mkdir-p extdir)
88 (rename-file (string-append
89 lib "/graphviz/guile/libgv_guile.so")
90 (string-append extdir
91 "/libgv_guile.so"))
92 #t))))))
93 (inputs
94 `(("libXrender" ,libxrender)
95 ("libX11" ,libx11)
96 ("gts" ,gts)
97 ("gd" ,gd) ; FIXME: Our GD is too old
98 ("guile" ,guile-2.0) ;Guile bindings
99 ("swig" ,swig)
100 ("pango" ,pango)
101 ("fontconfig" ,fontconfig)
102 ("freetype" ,freetype)
103 ("libltdl" ,libltdl)
104 ("libXaw" ,libxaw)
105 ("expat" ,expat)
106 ("libjpeg" ,libjpeg)
107 ("libpng" ,libpng)))
108 (native-inputs
109 `(("bison" ,bison)
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")
114 (description
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)))
121
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")
128 (revision "1"))
129 (package (inherit graphviz)
130 (name "graphviz")
131 (version (git-version "2.38.0" revision commit))
132 (source (origin
133 (method git-fetch)
134 (uri (git-reference
135 (url "https://gitlab.com/graphviz/graphviz.git")
136 (commit commit)))
137 (file-name (git-file-name name version))
138 (sha256
139 (base32
140 "1vjg308gflmi1khgjmcj431cnkrlv12bg4cqah39mwhny92jy92x"))))
141 (arguments
142 (substitute-keyword-arguments (package-arguments graphviz)
143 ((#:phases phases)
144 `(modify-phases ,phases
145 (add-after 'unpack 'prepare-bootstrap
146 (lambda _
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"))
152
153 (map make-file-writable (find-files "." ".*"))
154 #t))
155 (replace 'bootstrap
156 (lambda _ (invoke (which "sh") "autogen.sh" "NOCONFIG") #t))))))
157 (native-inputs
158 `(("autoconf" ,autoconf)
159 ("automake" ,automake)
160 ("libtool" ,libtool)
161 ("flex" ,flex)
162 ("perl" ,perl)
163 ("tcl" ,tcl)
164 ,@(package-native-inputs graphviz))))))
165
166 (define-public python-graphviz
167 (package
168 (name "python-graphviz")
169 (version "0.8.4")
170 (source (origin
171 (method url-fetch)
172 (uri (pypi-uri "graphviz" version ".zip"))
173 (sha256
174 (base32
175 "17v8h7j2yz8hy1jf7q8p0ik8dmf32m58lc6v11x7aqc4pnfa2n29"))))
176 (build-system python-build-system)
177 (native-inputs
178 `(("unzip" ,unzip)))
179 (home-page "https://github.com/xflr6/graphviz")
180 (synopsis "Simple Python interface for Graphviz")
181 (description
182 "This package provides a simple Python interface for the Graphviz graph
183 visualization tool suite.")
184 (license license:expat)))
185
186 (define-public python2-graphviz
187 (package-with-python2 python-graphviz))
188
189 (define-public python-pygraphviz
190 (package
191 (name "python-pygraphviz")
192 (version "1.5")
193 (source
194 (origin
195 (method git-fetch)
196 (uri (git-reference
197 (url "https://github.com/pygraphviz/pygraphviz.git")
198 (commit (string-append "pygraphviz-" version))))
199 (file-name (string-append "pygraphviz-" version "-checkout"))
200 (sha256
201 (base32
202 "1yldym38m8ckgflln83i88143pd9fjj1vfp23sq39fs6np5g0nzp"))))
203 (build-system python-build-system)
204 (arguments
205 `(#:configure-flags
206 (let ((graphviz (assoc-ref %build-inputs "graphviz")))
207 (list (string-append "--include-path=" graphviz "/include")
208 (string-append "--library-path=" graphviz "/lib")))))
209 (inputs
210 `(("graphviz" ,graphviz-2.38)))
211 (native-inputs
212 `(("python-nose" ,python-nose)
213 ("python-mock" ,python-mock)
214 ("python-doctest-ignore-unicode" ,python-doctest-ignore-unicode)))
215 (home-page "http://pygraphviz.github.io")
216 (synopsis "Python interface to Graphviz")
217 (description "PyGraphviz is a Python interface to the Graphviz graph
218 layout and visualization package. With PyGraphviz you can create, edit, read,
219 write, and draw graphs using Python to access the Graphviz graph data
220 structure and layout algorithms.")
221 (license license:bsd-3)))
222
223 (define-public gts
224 (package
225 (name "gts")
226 (version "0.7.6")
227 (source (origin
228 (method url-fetch)
229 (uri (string-append "mirror://sourceforge/gts/gts/" version
230 "/gts-" version ".tar.gz"))
231 (sha256
232 (base32
233 "07mqx09jxh8cv9753y2d2jsv7wp8vjmrd7zcfpbrddz3wc9kx705"))))
234 (build-system gnu-build-system)
235 (arguments
236 '(#:phases
237 (modify-phases %standard-phases
238 (add-before 'check 'pre-check
239 (lambda _
240 (chmod "test/boolean/test.sh" #o777)
241 #t)))
242
243 ;; Some data files used by the test suite are missing.
244 ;; See <http://sourceforge.net/p/gts/bugs/41/>.
245 #:tests? #f))
246 (native-inputs
247 `(("pkg-config" ,pkg-config)))
248 (propagated-inputs
249 ;; The gts.pc file has glib-2.0 as required.
250 `(("glib" ,glib)))
251 (home-page "http://gts.sourceforge.net/")
252
253 ;; Note: Despite the name, this is not official GNU software.
254 (synopsis "Triangulated Surface Library")
255 (description
256 "Library intended to provide a set of useful functions to deal with
257 3D surfaces meshed with interconnected triangles.")
258 (license license:lgpl2.0+)))
259
260 (define-public xdot
261 (package
262 (name "xdot")
263 (version "1.1")
264 (source
265 (origin
266 (method url-fetch)
267 (uri (pypi-uri "xdot" version))
268 (sha256
269 (base32
270 "0cr4rh7dz4dfzyxrk5pzhm0d15gkrgkfp3i5lw178xy81pc56p71"))))
271 (build-system python-build-system)
272 (arguments
273 `(#:phases
274 (modify-phases %standard-phases
275 ;; We wrap xdot, so that we don't propagate gtk+ and graphviz
276 (add-after 'install 'wrap
277 (lambda* (#:key inputs outputs #:allow-other-keys)
278 (wrap-program (string-append (assoc-ref outputs "out") "/bin/xdot")
279 `("GI_TYPELIB_PATH" ":" prefix
280 (,(string-append
281 (assoc-ref inputs "gtk+") "/lib/girepository-1.0"
282 ":" (assoc-ref inputs "pango") "/lib/girepository-1.0"
283 ":" (assoc-ref inputs "gdk-pixbuf") "/lib/girepository-1.0"
284 ":" (assoc-ref inputs "atk") "/lib/girepository-1.0")))
285 `("PATH" ":" prefix
286 (,(string-append (assoc-ref inputs "graphviz") "/bin"))))
287 #t)))))
288 (inputs
289 `(("atk" ,atk)
290 ("gdk-pixbuf" ,gdk-pixbuf+svg)
291 ("graphviz" ,graphviz)
292 ("gtk+" ,gtk+)
293 ("python-pycairo" ,python-pycairo)
294 ("python-pygobject" ,python-pygobject)))
295 (home-page "https://pypi.python.org/pypi/xdot")
296 (synopsis "Interactive viewer for graphviz dot files")
297 (description "Xdot is an interactive viewer for graphs written in
298 @code{graphviz}’s dot language. Internally, it uses the xdot output format as
299 an intermediate format,and @code{gtk} and @code{cairo} for rendering. Xdot can
300 be used either as a standalone application, or as a python library.")
301 (license license:lgpl3+)))
302
303 (define-public python-pydot
304 (package
305 (name "python-pydot")
306 (version "1.2.4")
307 (source
308 (origin
309 (method url-fetch)
310 (uri (pypi-uri "pydot" version))
311 (sha256
312 (base32
313 "1dhy4jpp646jslh2yks6klwwbaxcs905byyny880gl1iap8y5llj"))))
314 (build-system python-build-system)
315 (native-inputs
316 ;; For tests.
317 `(("python-chardet" ,python-chardet)))
318 (propagated-inputs
319 `(("python-pyparsing" ,python-pyparsing)))
320 (home-page "https://github.com/erocarrera/pydot")
321 (synopsis "Python interface to Graphviz's DOT language")
322 (description
323 "Pydot provides an interface to create, handle, modify and process
324 graphs in Graphviz's DOT language, written in pure Python.")
325 (license license:expat)))
326
327 (define-public python2-pydot
328 (package-with-python2 python-pydot))
329
330 (define-public dot2tex
331 (package
332 (name "dot2tex")
333 (version "2.9.0")
334 (source (origin
335 (method url-fetch)
336 (uri (pypi-uri "dot2tex" version))
337 (sha256
338 (base32
339 "0jhdwp0wv2h0xb7j2s5xiv7i8yaqgfpwwqcyrjvaxkfwsynm8gkx"))))
340 (build-system python-build-system)
341 (arguments
342 `(#:python ,python-2))
343 (inputs
344 `(("texlive-latex-preview" ,texlive-latex-preview)
345 ("graphviz" ,graphviz)))
346 (propagated-inputs
347 `(("python-pyparsing" ,python2-pyparsing)))
348 (home-page "https://github.com/kjellmf/dot2tex")
349 (synopsis "Graphviz to LaTeX converter")
350 (description
351 "The purpose of @code{dot2tex} is to give graphs generated by Graphviz a
352 more LaTeX friendly look and feel. This is accomplished by converting
353 @code{xdot} output from Graphviz to a series of PSTricks or PGF/TikZ commands.
354 This approach allows:
355
356 @itemize @bullet
357 @item Typesetting labels with LaTeX, allowing mathematical notation
358 @item Using native PSTricks and PGF/TikZ commands for drawing arrows
359 @item Using backend specific styles to customize the output
360 @end itemize")
361 (license license:expat)))