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