gnu: deutex: Update to 5.2.1.
[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>
88377435 3;;; Copyright © 2015 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>
b1b07d72
LC
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)
abdd28e8 28 #:use-module (guix build-system python)
b1b07d72 29 #:use-module (guix download)
c016e390
RW
30 #:use-module (guix git-download)
31 #:use-module (guix utils)
c8d89256
RW
32 #:use-module (gnu packages autotools)
33 #:use-module (gnu packages bison)
8b1c0dab 34 #:use-module (gnu packages check)
c8d89256 35 #:use-module (gnu packages compression)
c016e390 36 #:use-module (gnu packages flex)
c8d89256
RW
37 #:use-module (gnu packages fontutils)
38 #:use-module (gnu packages gd)
b1b07d72 39 #:use-module (gnu packages glib)
c8d89256
RW
40 #:use-module (gnu packages gnome)
41 #:use-module (gnu packages gtk)
93d2456c 42 #:use-module (gnu packages guile)
e55354b8 43 #:use-module (gnu packages image)
c016e390 44 #:use-module (gnu packages perl)
b1b07d72 45 #:use-module (gnu packages pkg-config)
c8d89256 46 #:use-module (gnu packages python)
44d10b1f 47 #:use-module (gnu packages python-xyz)
93d2456c 48 #:use-module (gnu packages swig)
c016e390 49 #:use-module (gnu packages tcl)
d56ecf62 50 #:use-module (gnu packages tex)
c8d89256
RW
51 #:use-module (gnu packages xml)
52 #:use-module (gnu packages xorg)
6414410d 53 #:use-module ((guix licenses) #:prefix license:))
b1b07d72
LC
54
55(define-public graphviz
56 (package
57 (name "graphviz")
cca9c756 58 (version "2.40.1")
b1b07d72 59 (source (origin
2170cc76
AI
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
cca9c756 66 "08d4ygkxz2f553bxj6087da56a23kx1khv0j8ycxa102vvx1hlna"))))
b1b07d72
LC
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
2170cc76
AI
71 #:phases
72 (modify-phases %standard-phases
2170cc76
AI
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))))))
b1b07d72
LC
93 (inputs
94 `(("libXrender" ,libxrender)
95 ("libX11" ,libx11)
96 ("gts" ,gts)
97 ("gd" ,gd) ; FIXME: Our GD is too old
93d2456c
RJ
98 ("guile" ,guile-2.0) ;Guile bindings
99 ("swig" ,swig)
b1b07d72
LC
100 ("pango" ,pango)
101 ("fontconfig" ,fontconfig)
102 ("freetype" ,freetype)
3246cc91 103 ("libltdl" ,libltdl)
b1b07d72
LC
104 ("libXaw" ,libxaw)
105 ("expat" ,expat)
106 ("libjpeg" ,libjpeg)
c4c4cc05
JD
107 ("libpng" ,libpng)))
108 (native-inputs
109 `(("bison" ,bison)
b1b07d72 110 ("pkg-config" ,pkg-config)))
88377435 111 (outputs '("out" "doc")) ; 5 MiB of html + pdfs
b1b07d72
LC
112 (home-page "http://www.graphviz.org/")
113 (synopsis "Graph visualization software")
114 (description
30ac136d 115 "Graphviz is a graph visualization tool suite. Graph visualization is a
b1b07d72
LC
116way of representing structural information as diagrams of abstract graphs and
117networks. It has important applications in networking, bioinformatics,
118software engineering, database and web design, machine learning, and in visual
119interfaces for other technical domains.")
6414410d
RW
120 (license license:epl1.0)))
121
c016e390
RW
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
6414410d
RW
166(define-public python-graphviz
167 (package
168 (name "python-graphviz")
3ccad0f3 169 (version "0.8.4")
6414410d
RW
170 (source (origin
171 (method url-fetch)
172 (uri (pypi-uri "graphviz" version ".zip"))
173 (sha256
174 (base32
3ccad0f3 175 "17v8h7j2yz8hy1jf7q8p0ik8dmf32m58lc6v11x7aqc4pnfa2n29"))))
6414410d
RW
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
183visualization tool suite.")
184 (license license:expat)))
185
186(define-public python2-graphviz
187 (package-with-python2 python-graphviz))
b1b07d72 188
8b1c0dab
RW
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
218layout and visualization package. With PyGraphviz you can create, edit, read,
219write, and draw graphs using Python to access the Graphviz graph data
220structure and layout algorithms.")
221 (license license:bsd-3)))
222
b1b07d72
LC
223(define-public gts
224 (package
225 (name "gts")
226 (version "0.7.6")
227 (source (origin
228 (method url-fetch)
de67e922
LF
229 (uri (string-append "mirror://sourceforge/gts/gts/" version
230 "/gts-" version ".tar.gz"))
b1b07d72
LC
231 (sha256
232 (base32
233 "07mqx09jxh8cv9753y2d2jsv7wp8vjmrd7zcfpbrddz3wc9kx705"))))
234 (build-system gnu-build-system)
235 (arguments
c0ad84ff
TGR
236 '(#:phases
237 (modify-phases %standard-phases
238 (add-before 'check 'pre-check
239 (lambda _
240 (chmod "test/boolean/test.sh" #o777)
241 #t)))
b1b07d72
LC
242
243 ;; Some data files used by the test suite are missing.
244 ;; See <http://sourceforge.net/p/gts/bugs/41/>.
245 #:tests? #f))
c4c4cc05 246 (native-inputs
b1b07d72
LC
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
2573D surfaces meshed with interconnected triangles.")
6414410d 258 (license license:lgpl2.0+)))
abdd28e8
TF
259
260(define-public xdot
261 (package
262 (name "xdot")
5395cec2 263 (version "1.1")
abdd28e8
TF
264 (source
265 (origin
266 (method url-fetch)
267 (uri (pypi-uri "xdot" version))
268 (sha256
269 (base32
5395cec2 270 "0cr4rh7dz4dfzyxrk5pzhm0d15gkrgkfp3i5lw178xy81pc56p71"))))
abdd28e8
TF
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
299an intermediate format,and @code{gtk} and @code{cairo} for rendering. Xdot can
300be used either as a standalone application, or as a python library.")
6414410d 301 (license license:lgpl3+)))
2b295f5a
GB
302
303(define-public python-pydot
304 (package
305 (name "python-pydot")
29ddbc56 306 (version "1.2.4")
2b295f5a
GB
307 (source
308 (origin
309 (method url-fetch)
310 (uri (pypi-uri "pydot" version))
311 (sha256
312 (base32
29ddbc56 313 "1dhy4jpp646jslh2yks6klwwbaxcs905byyny880gl1iap8y5llj"))))
2b295f5a 314 (build-system python-build-system)
29ddbc56
TGR
315 (native-inputs
316 ;; For tests.
317 `(("python-chardet" ,python-chardet)))
2b295f5a
GB
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
324graphs 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))
d56ecf62
ML
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
352more 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.
354This 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)))