gnu: sequoia: Update to 0.17.0.
[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 (build-system gnu-build-system)
78 (arguments
79 `(#:configure-flags (list "--enable-libplotter")))
80 (inputs `(("libpng" ,libpng)
81 ("libx11" ,libx11)
82 ("libxt" ,libxt)
83 ("libxaw" ,libxaw)))
84 (home-page "https://www.gnu.org/software/plotutils/")
85 (synopsis "Plotting utilities and library")
86 (description
87 "GNU Plotutils is a package for plotting and working with 2D graphics.
88 It includes the C library @code{libplot} and the C++ @code{libplotter} library
89 for exporting 2D vector graphics in many file formats. It also has support
90 for 2D vector graphics animations. The package also contains command-line
91 programs for plotting scientific data.")
92 (license license:gpl2+)))
93
94 (define-public guile-charting
95 (package
96 (name "guile-charting")
97 (version "0.2.0")
98 (source (origin
99 (method url-fetch)
100 (uri (string-append "http://wingolog.org/pub/guile-charting/"
101 "guile-charting-" version ".tar.gz"))
102 (sha256
103 (base32
104 "0w5qiyv9v0ip5li22x762bm48g8xnw281w66iyw094zdw611pb2m"))
105 (modules '((guix build utils)))
106 (snippet
107 '(begin
108 ;; Allow builds with Guile 3.0.
109 (substitute* "configure"
110 (("2\\.2 2\\.0")
111 "3.0 2.2 2.0"))
112
113 ;; By default, .go files would be installed to
114 ;; $libdir/…/ccache instead of $libdir/…/site-ccache. Fix
115 ;; that.
116 (substitute* (find-files "." "^Makefile\\.in$")
117 (("/ccache") "/site-ccache"))
118 #t))))
119 (build-system gnu-build-system)
120 (native-inputs `(("pkg-config" ,pkg-config)))
121 (inputs `(("guile" ,guile-3.0)))
122 (propagated-inputs `(("guile-cairo" ,guile-cairo)))
123 (home-page "http://wingolog.org/software/guile-charting/")
124 (synopsis "Create charts and graphs in Guile")
125 (description
126 "Guile-Charting is a Guile Scheme library to create bar charts and graphs
127 using the Cairo drawing library.")
128 (license license:lgpl2.1+)))
129
130 (define-public guile2.2-charting
131 (package
132 (inherit guile-charting)
133 (name "guile2.2-charting")
134 (inputs `(("guile" ,guile-2.2)))
135 (propagated-inputs `(("guile-cairo" ,guile2.2-cairo)))))
136
137 (define-public guile3.0-charting
138 (deprecated-package "guile3.0-charting" guile-charting))
139
140 (define-public ploticus
141 (package
142 (name "ploticus")
143 (version "2.42")
144 (source (origin
145 (method url-fetch)
146 (uri (string-append "mirror://sourceforge/ploticus/ploticus/"
147 version "/ploticus242_src.tar.gz"))
148 (sha256
149 (base32
150 "1c70cvfvgjh83hj1x21130wb9qfr2rc0x47cxy9kl805yjwy8a9z"))
151 (modules '((guix build utils)))
152 (snippet
153 ;; Install binaries in the right place.
154 '(begin
155 (substitute* "src/Makefile"
156 (("INSTALLBIN =.*$")
157 (string-append "INSTALLBIN = $(out)/bin")))
158 #t))))
159 (build-system gnu-build-system)
160 (arguments
161 '(#:tests? #f
162 #:phases
163 (modify-phases %standard-phases
164 (replace 'configure (lambda _ (chdir "src")))
165 (add-before 'install 'make-target-directories
166 (lambda* (#:key outputs #:allow-other-keys)
167 (let ((out (assoc-ref outputs "out")))
168 (mkdir-p (string-append out "/bin"))
169 #t)))
170 (add-after 'install 'install-prefabs
171 (lambda* (#:key outputs #:allow-other-keys)
172 (let* ((out (assoc-ref outputs "out"))
173 (dir (string-append out
174 "/share/ploticus/prefabs"))
175 (bin (string-append out "/bin")))
176 (mkdir-p dir)
177
178 ;; Install "prefabs".
179 (for-each (lambda (file)
180 (let ((target
181 (string-append dir "/"
182 (basename file))))
183 (copy-file file target)))
184 (find-files "../prefabs" "."))
185
186 ;; Allow them to be found.
187 (wrap-program (string-append bin "/pl")
188 `("PLOTICUS_PREFABS" ":" = (,dir)))))))))
189 (inputs
190 `(("libpng" ,libpng)
191 ("libx11" ,libx11)
192 ("zlib" ,zlib)))
193 (home-page "http://ploticus.sourceforge.net/")
194 (synopsis "Command-line tool for producing plots and charts")
195 (description
196 "Ploticus is a non-interactive software package for producing plots,
197 charts, and graphics from data. Ploticus is good for automated or
198 just-in-time graph generation, handles date and time data nicely, and has
199 basic statistical capabilities. It allows significant user control over
200 colors, styles, options and details.")
201 (license license:gpl2+)))
202
203 (define-public asymptote
204 (package
205 (name "asymptote")
206 (version "2.65")
207 (source
208 (origin
209 (method url-fetch)
210 (uri (string-append "mirror://sourceforge/asymptote/"
211 version "/asymptote-" version ".src.tgz"))
212 (sha256
213 (base32 "0i4qqlvzz69mhdq6kf689sa9rxfb1cwsg1nx88hryb291hddgqqm"))))
214 (build-system gnu-build-system)
215 ;; Note: The 'asy' binary retains a reference to docdir for use with its
216 ;; "help" command in interactive mode, so adding a "doc" output is not
217 ;; currently useful.
218 (native-inputs
219 `(("emacs" ,emacs-minimal)
220 ("gs" ,ghostscript) ;For tests
221 ("perl" ,perl)
222 ("texinfo" ,texinfo) ;For generating documentation
223 ;; For the manual and the tests.
224 ("texlive" ,(texlive-union (list texlive-amsfonts
225 texlive-epsf
226 texlive-etoolbox
227 texlive-latex-base
228 texlive-latex-geometry
229 texlive-latex-graphics
230 texlive-latex-oberdiek ; for ifluatex
231 texlive-latex-parskip
232 texlive-tex-texinfo)))))
233 (inputs
234 `(("fftw" ,fftw)
235 ("freeglut" ,freeglut)
236 ("glew" ,glew)
237 ("glm" ,glm)
238 ("gsl" ,gsl)
239 ("libgc" ,libgc)
240 ("python" ,python)
241 ("python-cson" ,python-cson)
242 ("python-numpy" ,python-numpy)
243 ("python-pyqt" ,python-pyqt)
244 ("readline" ,readline)
245 ("zlib" ,zlib)))
246 (arguments
247 `(#:modules ((guix build emacs-utils)
248 (guix build gnu-build-system)
249 (guix build utils)
250 (srfi srfi-26))
251 #:imported-modules (,@%gnu-build-system-modules
252 (guix build emacs-utils))
253 #:configure-flags
254 (list (string-append "--enable-gc=" (assoc-ref %build-inputs "libgc"))
255 (string-append "--with-latex="
256 (assoc-ref %outputs "out")
257 "/share/texmf/tex/latex")
258 (string-append "--with-context="
259 (assoc-ref %outputs "out")
260 "/share/texmf/tex/context/third"))
261 #:phases
262 (modify-phases %standard-phases
263 (add-after 'unpack 'fix-build
264 ;; XXX: Build process complains about missing "config.h"
265 ;; and "primitives.h" files.
266 (lambda _
267 (substitute* (find-files "." "\\.in$")
268 (("#include <primitives.h>") "#include \"primitives.h\""))
269 (invoke "touch" "prc/config.h")))
270 (add-after 'unpack 'move-info-location
271 ;; Build process installs info file in the unusual
272 ;; "%out/share/info/asymptote/" location. Move it to
273 ;; "%out/share/info/" so it appears in the top-level directory.
274 (lambda _
275 (substitute* "doc/png/Makefile.in"
276 (("(\\$\\(infodir\\))/asymptote" _ infodir) infodir))
277 (substitute* "doc/asymptote.texi"
278 (("asymptote/asymptote") "asymptote"))
279 #t))
280 (add-before 'build 'patch-pdf-viewer
281 (lambda _
282 ;; Default to a free pdf viewer.
283 (substitute* "settings.cc"
284 (("defaultPDFViewer=\"acroread\"")
285 "defaultPDFViewer=\"gv\""))
286 #t))
287 (add-before 'check 'set-HOME
288 ;; Some tests require write access to $HOME, otherwise leading to
289 ;; "failed to create directory /homeless-shelter/.asy" error.
290 (lambda _
291 (setenv "HOME" "/tmp")
292 #t))
293 (add-after 'install 'install-Emacs-data
294 (lambda* (#:key outputs #:allow-other-keys)
295 ;; Install related Emacs libraries into an appropriate location.
296 (let* ((out (assoc-ref outputs "out"))
297 (lisp-dir (string-append out "/share/emacs/site-lisp")))
298 (for-each (cut install-file <> lisp-dir)
299 (find-files "." "\\.el$"))
300 (emacs-generate-autoloads ,name lisp-dir))
301 #t))
302 (add-after 'install-Emacs-data 'wrap-python-script
303 (lambda* (#:key inputs outputs #:allow-other-keys)
304 ;; Make sure 'xasy' runs with the correct PYTHONPATH.
305 (let* ((out (assoc-ref outputs "out"))
306 (path (getenv "PYTHONPATH")))
307 (wrap-program (string-append out "/share/asymptote/GUI/xasy.py")
308 `("PYTHONPATH" ":" prefix (,path))))
309 #t)))))
310 (home-page "http://asymptote.sourceforge.net")
311 (synopsis "Script-based vector graphics language")
312 (description
313 "Asymptote is a powerful descriptive vector graphics language for
314 technical drawing, inspired by MetaPost but with an improved C++-like syntax.
315 Asymptote provides for figures the same high-quality level of typesetting that
316 LaTeX does for scientific text.")
317 ;; Most source files do not contain license statements, but the README
318 ;; contains: "All source files in the Asymptote project, unless explicitly
319 ;; noted otherwise, are released under version 3 (or later) of the GNU
320 ;; Lesser General Public License"
321 (license license:lgpl3+)))