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>
8 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
49 (define-public plotutils
55 (uri (string-append "mirror://gnu/plotutils/plotutils-"
59 "1arkyizn5wbgvbh53aziv3s6lmd3wm9lqzkhxb3hijlp1y124hjg"))
60 (modules '((guix build utils)))
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.
67 (substitute* "configure"
70 ;; Use the `png_jmpbuf' accessor, as recommended since libpng
72 ;; http://www.libpng.org/pub/png/src/libpng-1.2.x-to-1.4.x-summary.txt).
73 (substitute* "libplot/z_write.c"
75 "png_jmpbuf (png_ptr)"))
77 (build-system gnu-build-system)
79 `(#:configure-flags (list "--enable-libplotter")))
80 (inputs `(("libpng" ,libpng)
84 (home-page "https://www.gnu.org/software/plotutils/")
85 (synopsis "Plotting utilities and library")
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+)))
94 (define-public guile-charting
96 (name "guile-charting")
100 (uri (string-append "http://wingolog.org/pub/guile-charting/"
101 "guile-charting-" version ".tar.gz"))
104 "0w5qiyv9v0ip5li22x762bm48g8xnw281w66iyw094zdw611pb2m"))
105 (modules '((guix build utils)))
108 ;; Allow builds with Guile 3.0.
109 (substitute* "configure"
113 ;; By default, .go files would be installed to
114 ;; $libdir/…/ccache instead of $libdir/…/site-ccache. Fix
116 (substitute* (find-files "." "^Makefile\\.in$")
117 (("/ccache") "/site-ccache"))
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")
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+)))
130 (define-public guile2.2-charting
132 (inherit guile-charting)
133 (name "guile2.2-charting")
134 (inputs `(("guile" ,guile-2.2)))
135 (propagated-inputs `(("guile-cairo" ,guile2.2-cairo)))))
137 (define-public guile3.0-charting
138 (deprecated-package "guile3.0-charting" guile-charting))
140 (define-public ploticus
146 (uri (string-append "mirror://sourceforge/ploticus/ploticus/"
147 version "/ploticus242_src.tar.gz"))
150 "1c70cvfvgjh83hj1x21130wb9qfr2rc0x47cxy9kl805yjwy8a9z"))
151 (modules '((guix build utils)))
153 ;; Install binaries in the right place.
155 (substitute* "src/Makefile"
157 (string-append "INSTALLBIN = $(out)/bin")))
159 (build-system gnu-build-system)
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"))
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")))
178 ;; Install "prefabs".
179 (for-each (lambda (file)
181 (string-append dir "/"
183 (copy-file file target)))
184 (find-files "../prefabs" "."))
186 ;; Allow them to be found.
187 (wrap-program (string-append bin "/pl")
188 `("PLOTICUS_PREFABS" ":" = (,dir)))))))))
193 (home-page "http://ploticus.sourceforge.net/")
194 (synopsis "Command-line tool for producing plots and charts")
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+)))
203 (define-public asymptote
210 (uri (string-append "mirror://sourceforge/asymptote/"
211 version "/asymptote-" version ".src.tgz"))
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
219 `(("emacs" ,emacs-minimal)
220 ("gs" ,ghostscript) ;For tests
222 ("texinfo" ,texinfo) ;For generating documentation
223 ;; For the manual and the tests.
224 ("texlive" ,(texlive-union (list texlive-amsfonts
228 texlive-latex-geometry
229 texlive-latex-graphics
230 texlive-latex-oberdiek ; for ifluatex
231 texlive-latex-parskip
232 texlive-tex-texinfo)))))
235 ("freeglut" ,freeglut)
241 ("python-cson" ,python-cson)
242 ("python-numpy" ,python-numpy)
243 ("python-pyqt" ,python-pyqt)
244 ("readline" ,readline)
247 `(#:modules ((guix build emacs-utils)
248 (guix build gnu-build-system)
251 #:imported-modules (,@%gnu-build-system-modules
252 (guix build emacs-utils))
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"))
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.
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.
275 (substitute* "doc/png/Makefile.in"
276 (("(\\$\\(infodir\\))/asymptote" _ infodir) infodir))
277 (substitute* "doc/asymptote.texi"
278 (("asymptote/asymptote") "asymptote"))
280 (add-before 'build 'patch-pdf-viewer
282 ;; Default to a free pdf viewer.
283 (substitute* "settings.cc"
284 (("defaultPDFViewer=\"acroread\"")
285 "defaultPDFViewer=\"gv\""))
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.
291 (setenv "HOME" "/tmp")
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))
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))))
310 (home-page "http://asymptote.sourceforge.net")
311 (synopsis "Script-based vector graphics language")
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+)))