gnu: ruby-pandoc-ruby: Use pandoc instead of ghc-pandoc.
[jackhill/guix/guix.git] / gnu / packages / plotutils.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015 Eric Bavier <bavier@member.fsf.org>
4 ;;; Copyright © 2016, 2017, 2019, 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
5 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
6 ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
7 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
14 ;;;
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
19 ;;;
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23 (define-module (gnu packages plotutils)
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module (guix packages)
26 #:use-module (guix download)
27 #:use-module (guix build-system gnu)
28 #:use-module (gnu packages algebra)
29 #:use-module (gnu packages bdw-gc)
30 #:use-module (gnu packages emacs)
31 #:use-module (gnu packages xorg)
32 #:use-module (gnu packages image)
33 #:use-module (gnu packages ghostscript)
34 #:use-module (gnu packages guile)
35 #:use-module (gnu packages gl)
36 #:use-module (gnu packages gtk)
37 #:use-module (gnu packages maths)
38 #:use-module (gnu packages perl)
39 #:use-module (gnu packages pkg-config)
40 #:use-module (gnu packages python)
41 #:use-module (gnu packages python-xyz)
42 #:use-module (gnu packages readline)
43 #:use-module (gnu packages qt)
44 #:use-module (gnu packages texinfo)
45 #:use-module (gnu packages tex)
46 #:use-module (gnu packages compression)
47 #:use-module (gnu packages))
48
49 (define-public plotutils
50 (package
51 (name "plotutils")
52 (version "2.6")
53 (source (origin
54 (method url-fetch)
55 (uri (string-append "mirror://gnu/plotutils/plotutils-"
56 version ".tar.gz"))
57 (sha256
58 (base32
59 "1arkyizn5wbgvbh53aziv3s6lmd3wm9lqzkhxb3hijlp1y124hjg"))
60 (modules '((guix build utils)))
61 (snippet
62 ;; Force the use of libXaw7 instead of libXaw. When not doing
63 ;; that, libplot.la ends up containing just "-lXaw" (without
64 ;; "-L/path/to/Xaw"), due to the fact that there is no
65 ;; libXaw.la, which forces us to propagate libXaw.
66 '(begin
67 (substitute* "configure"
68 (("-lXaw")
69 "-lXaw7"))
70 ;; Use the `png_jmpbuf' accessor, as recommended since libpng
71 ;; 1.4.0 (see:
72 ;; http://www.libpng.org/pub/png/src/libpng-1.2.x-to-1.4.x-summary.txt).
73 (substitute* "libplot/z_write.c"
74 (("png_ptr->jmpbuf")
75 "png_jmpbuf (png_ptr)"))
76 #t))
77 (patches
78 ;; The test suite fails on some architectures such as i686 (see:
79 ;; https://lists.gnu.org/archive/html/bug-plotutils/2016-04/msg00002.html).
80 ;; The following Debian patch works around it.
81 (search-patches "plotutils-spline-test.patch"))))
82 (build-system gnu-build-system)
83 (arguments
84 `(#:configure-flags (list "--enable-libplotter")))
85 (inputs `(("libpng" ,libpng)
86 ("libx11" ,libx11)
87 ("libxt" ,libxt)
88 ("libxaw" ,libxaw)))
89 (home-page "https://www.gnu.org/software/plotutils/")
90 (synopsis "Plotting utilities and library")
91 (description
92 "GNU Plotutils is a package for plotting and working with 2D graphics.
93 It includes the C library @code{libplot} and the C++ @code{libplotter} library
94 for exporting 2D vector graphics in many file formats. It also has support
95 for 2D vector graphics animations. The package also contains command-line
96 programs for plotting scientific data.")
97 (license license:gpl2+)))
98
99 (define-public guile-charting
100 (package
101 (name "guile-charting")
102 (version "0.2.0")
103 (source (origin
104 (method url-fetch)
105 (uri (string-append "http://wingolog.org/pub/guile-charting/"
106 "guile-charting-" version ".tar.gz"))
107 (sha256
108 (base32
109 "0w5qiyv9v0ip5li22x762bm48g8xnw281w66iyw094zdw611pb2m"))
110 (modules '((guix build utils)))
111 (snippet
112 '(begin
113 ;; Allow builds with Guile 3.0.
114 (substitute* "configure"
115 (("2\\.2 2\\.0")
116 "3.0 2.2 2.0"))
117
118 ;; By default, .go files would be installed to
119 ;; $libdir/…/ccache instead of $libdir/…/site-ccache. Fix
120 ;; that.
121 (substitute* (find-files "." "^Makefile\\.in$")
122 (("/ccache") "/site-ccache"))
123 #t))))
124 (build-system gnu-build-system)
125 (native-inputs `(("pkg-config" ,pkg-config)))
126 (inputs `(("guile" ,guile-3.0)))
127 (propagated-inputs `(("guile-cairo" ,guile-cairo)))
128 (home-page "http://wingolog.org/software/guile-charting/")
129 (synopsis "Create charts and graphs in Guile")
130 (description
131 "Guile-Charting is a Guile Scheme library to create bar charts and graphs
132 using the Cairo drawing library.")
133 (license license:lgpl2.1+)))
134
135 (define-public guile2.2-charting
136 (package
137 (inherit guile-charting)
138 (name "guile2.2-charting")
139 (inputs `(("guile" ,guile-2.2)))
140 (propagated-inputs `(("guile-cairo" ,guile2.2-cairo)))))
141
142 (define-public guile3.0-charting
143 (deprecated-package "guile3.0-charting" guile-charting))
144
145 (define-public ploticus
146 (package
147 (name "ploticus")
148 (version "2.42")
149 (source (origin
150 (method url-fetch)
151 (uri (string-append "mirror://sourceforge/ploticus/ploticus/"
152 version "/ploticus242_src.tar.gz"))
153 (sha256
154 (base32
155 "1c70cvfvgjh83hj1x21130wb9qfr2rc0x47cxy9kl805yjwy8a9z"))
156 (modules '((guix build utils)))
157 (snippet
158 ;; Install binaries in the right place.
159 '(begin
160 (substitute* "src/Makefile"
161 (("INSTALLBIN =.*$")
162 (string-append "INSTALLBIN = $(out)/bin")))
163 #t))))
164 (build-system gnu-build-system)
165 (arguments
166 '(#:tests? #f
167 #:phases
168 (modify-phases %standard-phases
169 (replace 'configure (lambda _ (chdir "src")))
170 (add-before 'install 'make-target-directories
171 (lambda* (#:key outputs #:allow-other-keys)
172 (let ((out (assoc-ref outputs "out")))
173 (mkdir-p (string-append out "/bin"))
174 #t)))
175 (add-after 'install 'install-prefabs
176 (lambda* (#:key outputs #:allow-other-keys)
177 (let* ((out (assoc-ref outputs "out"))
178 (dir (string-append out
179 "/share/ploticus/prefabs"))
180 (bin (string-append out "/bin")))
181 (mkdir-p dir)
182
183 ;; Install "prefabs".
184 (for-each (lambda (file)
185 (let ((target
186 (string-append dir "/"
187 (basename file))))
188 (copy-file file target)))
189 (find-files "../prefabs" "."))
190
191 ;; Allow them to be found.
192 (wrap-program (string-append bin "/pl")
193 `("PLOTICUS_PREFABS" ":" = (,dir)))))))))
194 (inputs
195 `(("libpng" ,libpng)
196 ("libx11" ,libx11)
197 ("zlib" ,zlib)))
198 (home-page "http://ploticus.sourceforge.net/")
199 (synopsis "Command-line tool for producing plots and charts")
200 (description
201 "Ploticus is a non-interactive software package for producing plots,
202 charts, and graphics from data. Ploticus is good for automated or
203 just-in-time graph generation, handles date and time data nicely, and has
204 basic statistical capabilities. It allows significant user control over
205 colors, styles, options and details.")
206 (license license:gpl2+)))
207
208 (define-public asymptote
209 (package
210 (name "asymptote")
211 (version "2.67")
212 (source
213 (origin
214 (method url-fetch)
215 (uri (string-append "mirror://sourceforge/asymptote/"
216 version "/asymptote-" version ".src.tgz"))
217 (sha256
218 (base32 "16rdwxal27fikzfqsm2sb8ji78whpxl98rdyyp0ky2qlh55mf7la"))))
219 (build-system gnu-build-system)
220 ;; Note: The 'asy' binary retains a reference to docdir for use with its
221 ;; "help" command in interactive mode, so adding a "doc" output is not
222 ;; currently useful.
223 (native-inputs
224 `(("emacs" ,emacs-minimal)
225 ("gs" ,ghostscript) ;For tests
226 ("perl" ,perl)
227 ("texinfo" ,texinfo) ;For generating documentation
228 ;; For the manual and the tests.
229 ("texlive" ,(texlive-union (list texlive-amsfonts
230 texlive-epsf
231 texlive-etoolbox
232 texlive-latex-base
233 texlive-latex-geometry
234 texlive-latex-graphics
235 texlive-latex-oberdiek ; for ifluatex
236 texlive-latex-parskip
237 texlive-tex-texinfo)))))
238 (inputs
239 `(("fftw" ,fftw)
240 ("freeglut" ,freeglut)
241 ("glew" ,glew)
242 ("glm" ,glm)
243 ("gsl" ,gsl)
244 ("libgc" ,libgc)
245 ("python" ,python)
246 ("python-cson" ,python-cson)
247 ("python-numpy" ,python-numpy)
248 ("python-pyqt" ,python-pyqt)
249 ("readline" ,readline)
250 ("zlib" ,zlib)))
251 (arguments
252 `(#:modules ((guix build emacs-utils)
253 (guix build gnu-build-system)
254 (guix build utils)
255 (srfi srfi-26))
256 #:imported-modules (,@%gnu-build-system-modules
257 (guix build emacs-utils))
258 #:configure-flags
259 (list (string-append "--enable-gc=" (assoc-ref %build-inputs "libgc"))
260 (string-append "--with-latex="
261 (assoc-ref %outputs "out")
262 "/share/texmf/tex/latex")
263 (string-append "--with-context="
264 (assoc-ref %outputs "out")
265 "/share/texmf/tex/context/third"))
266 #:phases
267 (modify-phases %standard-phases
268 (add-after 'unpack 'fix-build
269 ;; XXX: Build process complains about missing "config.h"
270 ;; and "primitives.h" files.
271 (lambda _
272 (substitute* (find-files "." "\\.in$")
273 (("#include <primitives.h>") "#include \"primitives.h\""))
274 (invoke "touch" "prc/config.h")))
275 (add-after 'unpack 'move-info-location
276 ;; Build process installs info file in the unusual
277 ;; "%out/share/info/asymptote/" location. Move it to
278 ;; "%out/share/info/" so it appears in the top-level directory.
279 (lambda _
280 (substitute* "doc/png/Makefile.in"
281 (("(\\$\\(infodir\\))/asymptote" _ infodir) infodir))
282 (substitute* "doc/asymptote.texi"
283 (("asymptote/asymptote") "asymptote"))
284 #t))
285 (add-before 'build 'patch-pdf-viewer
286 (lambda _
287 ;; Default to a free pdf viewer.
288 (substitute* "settings.cc"
289 (("defaultPDFViewer=\"acroread\"")
290 "defaultPDFViewer=\"gv\""))
291 #t))
292 (add-before 'check 'set-HOME
293 ;; Some tests require write access to $HOME, otherwise leading to
294 ;; "failed to create directory /homeless-shelter/.asy" error.
295 (lambda _
296 (setenv "HOME" "/tmp")
297 #t))
298 (add-after 'install 'install-Emacs-data
299 (lambda* (#:key outputs #:allow-other-keys)
300 ;; Install related Emacs libraries into an appropriate location.
301 (let* ((out (assoc-ref outputs "out"))
302 (lisp-dir (string-append out "/share/emacs/site-lisp")))
303 (for-each (cut install-file <> lisp-dir)
304 (find-files "." "\\.el$"))
305 (emacs-generate-autoloads ,name lisp-dir))
306 #t))
307 (add-after 'install-Emacs-data 'wrap-python-script
308 (lambda* (#:key inputs outputs #:allow-other-keys)
309 ;; Make sure 'xasy' runs with the correct PYTHONPATH.
310 (let* ((out (assoc-ref outputs "out"))
311 (path (getenv "PYTHONPATH")))
312 (wrap-program (string-append out "/share/asymptote/GUI/xasy.py")
313 `("PYTHONPATH" ":" prefix (,path))))
314 #t)))))
315 (home-page "http://asymptote.sourceforge.net")
316 (synopsis "Script-based vector graphics language")
317 (description
318 "Asymptote is a powerful descriptive vector graphics language for
319 technical drawing, inspired by MetaPost but with an improved C++-like syntax.
320 Asymptote provides for figures the same high-quality level of typesetting that
321 LaTeX does for scientific text.")
322 ;; Most source files do not contain license statements, but the README
323 ;; contains: "All source files in the Asymptote project, unless explicitly
324 ;; noted otherwise, are released under version 3 (or later) of the GNU
325 ;; Lesser General Public License"
326 (license license:lgpl3+)))