Merge branch 'master' into core-updates
[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 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 (gnu packages xorg)
31 #:use-module (gnu packages gtk)
32 #:use-module (gnu packages xml)
33 #:use-module (gnu packages glib)
34 #:use-module (gnu packages guile)
35 #:use-module (gnu packages bison)
36 #:use-module (gnu packages image)
37 #:use-module (gnu packages autotools)
38 #:use-module (gnu packages pkg-config)
39 #:use-module (gnu packages glib)
40 #:use-module (gnu packages gtk)
41 #:use-module (gnu packages gnome)
42 #:use-module (gnu packages fontutils)
43 #:use-module (gnu packages compression)
44 #:use-module (gnu packages gd)
45 #:use-module (gnu packages swig)
46 #:use-module (gnu packages python)
47 #:use-module (gnu packages tex)
48 #:use-module ((guix licenses) #:prefix license:))
49
50 (define-public graphviz
51 (package
52 (name "graphviz")
53 (version "2.40.1")
54 (source (origin
55 (method url-fetch)
56 (uri (string-append
57 "http://www.graphviz.org/pub/graphviz/ARCHIVE/graphviz-"
58 version ".tar.gz"))
59 (sha256
60 (base32
61 "08d4ygkxz2f553bxj6087da56a23kx1khv0j8ycxa102vvx1hlna"))))
62 (build-system gnu-build-system)
63 (arguments
64 ;; FIXME: rtest/rtest.sh is a ksh script (!). Add ksh as an input.
65 '(#:tests? #f
66 #:phases
67 (modify-phases %standard-phases
68 (add-after 'install 'move-docs
69 (lambda* (#:key outputs #:allow-other-keys)
70 (let ((out (assoc-ref outputs "out"))
71 (doc (assoc-ref outputs "doc")))
72 (mkdir-p (string-append doc "/share/graphviz"))
73 (rename-file (string-append out "/share/graphviz/doc")
74 (string-append doc "/share/graphviz/doc"))
75 #t)))
76 (add-after 'move-docs 'move-guile-bindings
77 (lambda* (#:key outputs #:allow-other-keys)
78 (let* ((out (assoc-ref outputs "out"))
79 (lib (string-append out "/lib"))
80 (extdir (string-append lib
81 "/guile/2.0/extensions")))
82 (mkdir-p extdir)
83 (rename-file (string-append
84 lib "/graphviz/guile/libgv_guile.so")
85 (string-append extdir
86 "/libgv_guile.so"))
87 #t))))))
88 (inputs
89 `(("libXrender" ,libxrender)
90 ("libX11" ,libx11)
91 ("gts" ,gts)
92 ("gd" ,gd) ; FIXME: Our GD is too old
93 ("guile" ,guile-2.0) ;Guile bindings
94 ("swig" ,swig)
95 ("pango" ,pango)
96 ("fontconfig" ,fontconfig)
97 ("freetype" ,freetype)
98 ("libltdl" ,libltdl)
99 ("libXaw" ,libxaw)
100 ("expat" ,expat)
101 ("libjpeg" ,libjpeg)
102 ("libpng" ,libpng)))
103 (native-inputs
104 `(("bison" ,bison)
105 ("pkg-config" ,pkg-config)))
106 (outputs '("out" "doc")) ; 5 MiB of html + pdfs
107 (home-page "http://www.graphviz.org/")
108 (synopsis "Graph visualization software")
109 (description
110 "Graphviz is a graph visualization tool suite. Graph visualization is a
111 way of representing structural information as diagrams of abstract graphs and
112 networks. It has important applications in networking, bioinformatics,
113 software engineering, database and web design, machine learning, and in visual
114 interfaces for other technical domains.")
115 (license license:epl1.0)))
116
117 (define-public python-graphviz
118 (package
119 (name "python-graphviz")
120 (version "0.8.3")
121 (source (origin
122 (method url-fetch)
123 (uri (pypi-uri "graphviz" version ".zip"))
124 (sha256
125 (base32
126 "0gnl11w98iib7vif92f3vircavy2v1yl9sl54y6hhk1mwm0f07f6"))))
127 (build-system python-build-system)
128 (native-inputs
129 `(("unzip" ,unzip)))
130 (home-page "https://github.com/xflr6/graphviz")
131 (synopsis "Simple Python interface for Graphviz")
132 (description
133 "This package provides a simple Python interface for the Graphviz graph
134 visualization tool suite.")
135 (license license:expat)))
136
137 (define-public python2-graphviz
138 (package-with-python2 python-graphviz))
139
140 (define-public gts
141 (package
142 (name "gts")
143 (version "0.7.6")
144 (source (origin
145 (method url-fetch)
146 (uri (string-append "mirror://sourceforge/gts/gts/" version
147 "/gts-" version ".tar.gz"))
148 (sha256
149 (base32
150 "07mqx09jxh8cv9753y2d2jsv7wp8vjmrd7zcfpbrddz3wc9kx705"))))
151 (build-system gnu-build-system)
152 (arguments
153 '(#:phases
154 (modify-phases %standard-phases
155 (add-before 'check 'pre-check
156 (lambda _
157 (chmod "test/boolean/test.sh" #o777)
158 #t)))
159
160 ;; Some data files used by the test suite are missing.
161 ;; See <http://sourceforge.net/p/gts/bugs/41/>.
162 #:tests? #f))
163 (native-inputs
164 `(("pkg-config" ,pkg-config)))
165 (propagated-inputs
166 ;; The gts.pc file has glib-2.0 as required.
167 `(("glib" ,glib)))
168 (home-page "http://gts.sourceforge.net/")
169
170 ;; Note: Despite the name, this is not official GNU software.
171 (synopsis "Triangulated Surface Library")
172 (description
173 "Library intended to provide a set of useful functions to deal with
174 3D surfaces meshed with interconnected triangles.")
175 (license license:lgpl2.0+)))
176
177 (define-public xdot
178 (package
179 (name "xdot")
180 (version "0.7")
181 (source
182 (origin
183 (method url-fetch)
184 (uri (pypi-uri "xdot" version))
185 (sha256
186 (base32
187 "1q0f3pskb09saw1qkd2s6vmk80rq5zjhq8l93dfr2x6r04r0q46j"))))
188 (build-system python-build-system)
189 (arguments
190 `(#:phases
191 (modify-phases %standard-phases
192 ;; We wrap xdot, so that we don't propagate gtk+ and graphviz
193 (add-after 'install 'wrap
194 (lambda* (#:key inputs outputs #:allow-other-keys)
195 (wrap-program (string-append (assoc-ref outputs "out") "/bin/xdot")
196 `("GI_TYPELIB_PATH" ":" prefix
197 (,(string-append
198 (assoc-ref inputs "gtk+") "/lib/girepository-1.0"
199 ":" (assoc-ref inputs "pango") "/lib/girepository-1.0"
200 ":" (assoc-ref inputs "gdk-pixbuf") "/lib/girepository-1.0"
201 ":" (assoc-ref inputs "atk") "/lib/girepository-1.0")))
202 `("PATH" ":" prefix
203 (,(string-append (assoc-ref inputs "graphviz") "/bin"))))
204 #t)))))
205 (inputs
206 `(("atk" ,atk)
207 ("gdk-pixbuf" ,gdk-pixbuf+svg)
208 ("graphviz" ,graphviz)
209 ("gtk+" ,gtk+)
210 ("python-pycairo" ,python-pycairo)
211 ("python-pygobject" ,python-pygobject)))
212 (home-page "https://pypi.python.org/pypi/xdot")
213 (synopsis "Interactive viewer for graphviz dot files")
214 (description "Xdot is an interactive viewer for graphs written in
215 @code{graphviz}’s dot language. Internally, it uses the xdot output format as
216 an intermediate format,and @code{gtk} and @code{cairo} for rendering. Xdot can
217 be used either as a standalone application, or as a python library.")
218 (license license:lgpl3+)))
219
220 (define-public python-pydot
221 (package
222 (name "python-pydot")
223 (version "1.2.3")
224 (source
225 (origin
226 (method url-fetch)
227 (uri (pypi-uri "pydot" version))
228 (sha256
229 (base32
230 "00imlz0033dygb9gdag1xr0cybn33gk5jsdi9ffbszzr97rd7dgd"))))
231 (build-system python-build-system)
232 ;; FIXME: No tests in PyPi release tarball.
233 (arguments '(#:tests? #f))
234 (propagated-inputs
235 `(("python-pyparsing" ,python-pyparsing)))
236 (home-page "https://github.com/erocarrera/pydot")
237 (synopsis "Python interface to Graphviz's DOT language")
238 (description
239 "Pydot provides an interface to create, handle, modify and process
240 graphs in Graphviz's DOT language, written in pure Python.")
241 (license license:expat)))
242
243 (define-public python2-pydot
244 (package-with-python2 python-pydot))
245
246 (define-public dot2tex
247 (package
248 (name "dot2tex")
249 (version "2.9.0")
250 (source (origin
251 (method url-fetch)
252 (uri (pypi-uri "dot2tex" version))
253 (sha256
254 (base32
255 "0jhdwp0wv2h0xb7j2s5xiv7i8yaqgfpwwqcyrjvaxkfwsynm8gkx"))))
256 (build-system python-build-system)
257 (arguments
258 `(#:python ,python-2))
259 (inputs
260 `(("texlive-latex-preview" ,texlive-latex-preview)
261 ("graphviz" ,graphviz)))
262 (propagated-inputs
263 `(("python-pyparsing" ,python2-pyparsing)))
264 (home-page "https://github.com/kjellmf/dot2tex")
265 (synopsis "Graphviz to LaTeX converter")
266 (description
267 "The purpose of @code{dot2tex} is to give graphs generated by Graphviz a
268 more LaTeX friendly look and feel. This is accomplished by converting
269 @code{xdot} output from Graphviz to a series of PSTricks or PGF/TikZ commands.
270 This approach allows:
271
272 @itemize @bullet
273 @item Typesetting labels with LaTeX, allowing mathematical notation
274 @item Using native PSTricks and PGF/TikZ commands for drawing arrows
275 @item Using backend specific styles to customize the output
276 @end itemize")
277 (license license:expat)))