gnu: Add graphviz-2.38.
[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 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 xorg)
33 #:use-module (gnu packages flex)
34 #:use-module (gnu packages gtk)
35 #:use-module (gnu packages xml)
36 #:use-module (gnu packages glib)
37 #:use-module (gnu packages guile)
38 #:use-module (gnu packages bison)
39 #:use-module (gnu packages image)
40 #:use-module (gnu packages autotools)
41 #:use-module (gnu packages perl)
42 #:use-module (gnu packages pkg-config)
43 #:use-module (gnu packages glib)
44 #:use-module (gnu packages gtk)
45 #:use-module (gnu packages gnome)
46 #:use-module (gnu packages fontutils)
47 #:use-module (gnu packages compression)
48 #:use-module (gnu packages gd)
49 #:use-module (gnu packages swig)
50 #:use-module (gnu packages tcl)
51 #:use-module (gnu packages python)
52 #:use-module (gnu packages tex)
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 gts
190 (package
191 (name "gts")
192 (version "0.7.6")
193 (source (origin
194 (method url-fetch)
195 (uri (string-append "mirror://sourceforge/gts/gts/" version
196 "/gts-" version ".tar.gz"))
197 (sha256
198 (base32
199 "07mqx09jxh8cv9753y2d2jsv7wp8vjmrd7zcfpbrddz3wc9kx705"))))
200 (build-system gnu-build-system)
201 (arguments
202 '(#:phases
203 (modify-phases %standard-phases
204 (add-before 'check 'pre-check
205 (lambda _
206 (chmod "test/boolean/test.sh" #o777)
207 #t)))
208
209 ;; Some data files used by the test suite are missing.
210 ;; See <http://sourceforge.net/p/gts/bugs/41/>.
211 #:tests? #f))
212 (native-inputs
213 `(("pkg-config" ,pkg-config)))
214 (propagated-inputs
215 ;; The gts.pc file has glib-2.0 as required.
216 `(("glib" ,glib)))
217 (home-page "http://gts.sourceforge.net/")
218
219 ;; Note: Despite the name, this is not official GNU software.
220 (synopsis "Triangulated Surface Library")
221 (description
222 "Library intended to provide a set of useful functions to deal with
223 3D surfaces meshed with interconnected triangles.")
224 (license license:lgpl2.0+)))
225
226 (define-public xdot
227 (package
228 (name "xdot")
229 (version "0.7")
230 (source
231 (origin
232 (method url-fetch)
233 (uri (pypi-uri "xdot" version))
234 (sha256
235 (base32
236 "1q0f3pskb09saw1qkd2s6vmk80rq5zjhq8l93dfr2x6r04r0q46j"))))
237 (build-system python-build-system)
238 (arguments
239 `(#:phases
240 (modify-phases %standard-phases
241 ;; We wrap xdot, so that we don't propagate gtk+ and graphviz
242 (add-after 'install 'wrap
243 (lambda* (#:key inputs outputs #:allow-other-keys)
244 (wrap-program (string-append (assoc-ref outputs "out") "/bin/xdot")
245 `("GI_TYPELIB_PATH" ":" prefix
246 (,(string-append
247 (assoc-ref inputs "gtk+") "/lib/girepository-1.0"
248 ":" (assoc-ref inputs "pango") "/lib/girepository-1.0"
249 ":" (assoc-ref inputs "gdk-pixbuf") "/lib/girepository-1.0"
250 ":" (assoc-ref inputs "atk") "/lib/girepository-1.0")))
251 `("PATH" ":" prefix
252 (,(string-append (assoc-ref inputs "graphviz") "/bin"))))
253 #t)))))
254 (inputs
255 `(("atk" ,atk)
256 ("gdk-pixbuf" ,gdk-pixbuf+svg)
257 ("graphviz" ,graphviz)
258 ("gtk+" ,gtk+)
259 ("python-pycairo" ,python-pycairo)
260 ("python-pygobject" ,python-pygobject)))
261 (home-page "https://pypi.python.org/pypi/xdot")
262 (synopsis "Interactive viewer for graphviz dot files")
263 (description "Xdot is an interactive viewer for graphs written in
264 @code{graphviz}’s dot language. Internally, it uses the xdot output format as
265 an intermediate format,and @code{gtk} and @code{cairo} for rendering. Xdot can
266 be used either as a standalone application, or as a python library.")
267 (license license:lgpl3+)))
268
269 (define-public python-pydot
270 (package
271 (name "python-pydot")
272 (version "1.2.4")
273 (source
274 (origin
275 (method url-fetch)
276 (uri (pypi-uri "pydot" version))
277 (sha256
278 (base32
279 "1dhy4jpp646jslh2yks6klwwbaxcs905byyny880gl1iap8y5llj"))))
280 (build-system python-build-system)
281 (native-inputs
282 ;; For tests.
283 `(("python-chardet" ,python-chardet)))
284 (propagated-inputs
285 `(("python-pyparsing" ,python-pyparsing)))
286 (home-page "https://github.com/erocarrera/pydot")
287 (synopsis "Python interface to Graphviz's DOT language")
288 (description
289 "Pydot provides an interface to create, handle, modify and process
290 graphs in Graphviz's DOT language, written in pure Python.")
291 (license license:expat)))
292
293 (define-public python2-pydot
294 (package-with-python2 python-pydot))
295
296 (define-public dot2tex
297 (package
298 (name "dot2tex")
299 (version "2.9.0")
300 (source (origin
301 (method url-fetch)
302 (uri (pypi-uri "dot2tex" version))
303 (sha256
304 (base32
305 "0jhdwp0wv2h0xb7j2s5xiv7i8yaqgfpwwqcyrjvaxkfwsynm8gkx"))))
306 (build-system python-build-system)
307 (arguments
308 `(#:python ,python-2))
309 (inputs
310 `(("texlive-latex-preview" ,texlive-latex-preview)
311 ("graphviz" ,graphviz)))
312 (propagated-inputs
313 `(("python-pyparsing" ,python2-pyparsing)))
314 (home-page "https://github.com/kjellmf/dot2tex")
315 (synopsis "Graphviz to LaTeX converter")
316 (description
317 "The purpose of @code{dot2tex} is to give graphs generated by Graphviz a
318 more LaTeX friendly look and feel. This is accomplished by converting
319 @code{xdot} output from Graphviz to a series of PSTricks or PGF/TikZ commands.
320 This approach allows:
321
322 @itemize @bullet
323 @item Typesetting labels with LaTeX, allowing mathematical notation
324 @item Using native PSTricks and PGF/TikZ commands for drawing arrows
325 @item Using backend specific styles to customize the output
326 @end itemize")
327 (license license:expat)))