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