graphviz.scm 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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. ;;;
  6. ;;; This file is part of GNU Guix.
  7. ;;;
  8. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  9. ;;; under the terms of the GNU General Public License as published by
  10. ;;; the Free Software Foundation; either version 3 of the License, or (at
  11. ;;; your option) any later version.
  12. ;;;
  13. ;;; GNU Guix is distributed in the hope that it will be useful, but
  14. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. ;;; GNU General Public License for more details.
  17. ;;;
  18. ;;; You should have received a copy of the GNU General Public License
  19. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  20. (define-module (gnu packages graphviz)
  21. #:use-module (guix packages)
  22. #:use-module (guix build-system gnu)
  23. #:use-module (guix build-system python)
  24. #:use-module (guix download)
  25. #:use-module (gnu packages xorg)
  26. #:use-module (gnu packages gtk)
  27. #:use-module (gnu packages xml)
  28. #:use-module (gnu packages glib)
  29. #:use-module (gnu packages guile)
  30. #:use-module (gnu packages bison)
  31. #:use-module (gnu packages image)
  32. #:use-module (gnu packages autotools)
  33. #:use-module (gnu packages pkg-config)
  34. #:use-module (gnu packages glib)
  35. #:use-module (gnu packages gtk)
  36. #:use-module (gnu packages gnome)
  37. #:use-module (gnu packages fontutils)
  38. #:use-module (gnu packages compression)
  39. #:use-module (gnu packages gd)
  40. #:use-module (gnu packages swig)
  41. #:use-module ((guix licenses) #:select (lgpl2.0+ epl1.0 lgpl3+)))
  42. (define-public graphviz
  43. (package
  44. (name "graphviz")
  45. (version "2.38.0")
  46. (source (origin
  47. (method url-fetch)
  48. (uri (string-append
  49. "http://www.graphviz.org/pub/graphviz/ARCHIVE/graphviz-"
  50. version ".tar.gz"))
  51. (sha256
  52. (base32
  53. "17l5czpvv5ilmg17frg0w4qwf89jzh2aglm9fgx0l0aakn6j7al1"))))
  54. (build-system gnu-build-system)
  55. (arguments
  56. ;; FIXME: rtest/rtest.sh is a ksh script (!). Add ksh as an input.
  57. '(#:tests? #f
  58. #:phases (alist-cons-before
  59. 'build 'pre-build
  60. (lambda _
  61. ;; Work around bogus makefile when using an external
  62. ;; libltdl. Failing to do so, one hits this error:
  63. ;; "No rule to make target `-lltdl', needed by `libgvc.la'."
  64. (substitute* "lib/gvc/Makefile"
  65. (("am__append_5 *=.*")
  66. "am_append_5 =\n")))
  67. (alist-cons-after
  68. '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. (alist-cons-after
  77. 'move-docs 'move-guile-bindings
  78. (lambda* (#:key outputs #:allow-other-keys)
  79. (let* ((out (assoc-ref outputs "out"))
  80. (lib (string-append out "/lib"))
  81. (extdir (string-append lib
  82. "/guile/2.0/extensions")))
  83. (mkdir-p extdir)
  84. (rename-file (string-append
  85. lib "/graphviz/guile/libgv_guile.so")
  86. (string-append extdir
  87. "/libgv_guile.so"))))
  88. %standard-phases)))))
  89. (inputs
  90. `(("libXrender" ,libxrender)
  91. ("libX11" ,libx11)
  92. ("gts" ,gts)
  93. ("gd" ,gd) ; FIXME: Our GD is too old
  94. ("guile" ,guile-2.0) ;Guile bindings
  95. ("swig" ,swig)
  96. ("pango" ,pango)
  97. ("fontconfig" ,fontconfig)
  98. ("freetype" ,freetype)
  99. ("libltdl" ,libltdl)
  100. ("libXaw" ,libxaw)
  101. ("expat" ,expat)
  102. ("libjpeg" ,libjpeg)
  103. ("libpng" ,libpng)))
  104. (native-inputs
  105. `(("bison" ,bison)
  106. ("pkg-config" ,pkg-config)))
  107. (outputs '("out" "doc")) ; 5 MiB of html + pdfs
  108. (home-page "http://www.graphviz.org/")
  109. (synopsis "Graph visualization software")
  110. (description
  111. "Graphviz is a graph visualization tool suite. Graph visualization is a
  112. way of representing structural information as diagrams of abstract graphs and
  113. networks. It has important applications in networking, bioinformatics,
  114. software engineering, database and web design, machine learning, and in visual
  115. interfaces for other technical domains.")
  116. (license epl1.0)))
  117. (define-public gts
  118. (package
  119. (name "gts")
  120. (version "0.7.6")
  121. (source (origin
  122. (method url-fetch)
  123. (uri (string-append "mirror://sourceforge/gts/gts/" version
  124. "/gts-" version ".tar.gz"))
  125. (sha256
  126. (base32
  127. "07mqx09jxh8cv9753y2d2jsv7wp8vjmrd7zcfpbrddz3wc9kx705"))))
  128. (build-system gnu-build-system)
  129. (arguments
  130. '(#:phases (alist-cons-before
  131. 'check 'pre-check
  132. (lambda _
  133. (chmod "test/boolean/test.sh" #o777))
  134. %standard-phases)
  135. ;; Some data files used by the test suite are missing.
  136. ;; See <http://sourceforge.net/p/gts/bugs/41/>.
  137. #:tests? #f))
  138. (native-inputs
  139. `(("pkg-config" ,pkg-config)))
  140. (propagated-inputs
  141. ;; The gts.pc file has glib-2.0 as required.
  142. `(("glib" ,glib)))
  143. (home-page "http://gts.sourceforge.net/")
  144. ;; Note: Despite the name, this is not official GNU software.
  145. (synopsis "Triangulated Surface Library")
  146. (description
  147. "Library intended to provide a set of useful functions to deal with
  148. 3D surfaces meshed with interconnected triangles.")
  149. (license lgpl2.0+)))
  150. (define-public xdot
  151. (package
  152. (name "xdot")
  153. (version "0.7")
  154. (source
  155. (origin
  156. (method url-fetch)
  157. (uri (pypi-uri "xdot" version))
  158. (sha256
  159. (base32
  160. "1q0f3pskb09saw1qkd2s6vmk80rq5zjhq8l93dfr2x6r04r0q46j"))))
  161. (build-system python-build-system)
  162. (arguments
  163. `(#:phases
  164. (modify-phases %standard-phases
  165. ;; We wrap xdot, so that we don't propagate gtk+ and graphviz
  166. (add-after 'install 'wrap
  167. (lambda* (#:key inputs outputs #:allow-other-keys)
  168. (wrap-program (string-append (assoc-ref outputs "out") "/bin/xdot")
  169. `("GI_TYPELIB_PATH" ":" prefix
  170. (,(string-append
  171. (assoc-ref inputs "gtk+") "/lib/girepository-1.0"
  172. ":" (assoc-ref inputs "pango") "/lib/girepository-1.0"
  173. ":" (assoc-ref inputs "gdk-pixbuf") "/lib/girepository-1.0"
  174. ":" (assoc-ref inputs "atk") "/lib/girepository-1.0")))
  175. `("PATH" ":" prefix
  176. (,(string-append (assoc-ref inputs "graphviz") "/bin"))))
  177. #t)))))
  178. (inputs
  179. `(("atk" ,atk)
  180. ("gdk-pixbuf" ,gdk-pixbuf+svg)
  181. ("graphviz" ,graphviz)
  182. ("gtk+" ,gtk+)
  183. ("python-pycairo" ,python-pycairo)
  184. ("python-pygobject" ,python-pygobject)))
  185. (home-page "https://pypi.python.org/pypi/xdot")
  186. (synopsis "Interactive viewer for graphviz dot files")
  187. (description "Xdot is an interactive viewer for graphs written in
  188. @code{graphviz}’s dot language. Internally, it uses the xdot output format as
  189. an intermediate format,and @code{gtk} and @code{cairo} for rendering. Xdot can
  190. be used either as a standalone application, or as a python library.")
  191. (license lgpl3+)))