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