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-2022 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 gexp)
26 #:use-module ((guix utils) #:select (target-x86-32?))
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix git-download)
30 #:use-module (guix build-system gnu)
31 #:use-module (gnu packages algebra)
32 #:use-module (gnu packages autotools)
33 #:use-module (gnu packages bdw-gc)
34 #:use-module (gnu packages boost)
35 #:use-module (gnu packages cmake)
36 #:use-module (gnu packages emacs)
37 #:use-module (gnu packages xorg)
38 #:use-module (gnu packages image)
39 #:use-module (gnu packages ghostscript)
40 #:use-module (gnu packages guile)
41 #:use-module (gnu packages gl)
42 #:use-module (gnu packages gtk)
43 #:use-module (gnu packages maths)
44 #:use-module (gnu packages onc-rpc)
45 #:use-module (gnu packages perl)
46 #:use-module (gnu packages pkg-config)
47 #:use-module (gnu packages python)
48 #:use-module (gnu packages python-xyz)
49 #:use-module (gnu packages readline)
50 #:use-module (gnu packages qt)
51 #:use-module (gnu packages texinfo)
52 #:use-module (gnu packages tex)
53 #:use-module (gnu packages web)
54 #:use-module (gnu packages compression)
55 #:use-module (gnu packages))
57 (define-public plotutils
63 (uri (string-append "mirror://gnu/plotutils/plotutils-"
67 "1arkyizn5wbgvbh53aziv3s6lmd3wm9lqzkhxb3hijlp1y124hjg"))
68 (modules '((guix build utils)))
70 ;; Force the use of libXaw7 instead of libXaw. When not doing
71 ;; that, libplot.la ends up containing just "-lXaw" (without
72 ;; "-L/path/to/Xaw"), due to the fact that there is no
73 ;; libXaw.la, which forces us to propagate libXaw.
75 (substitute* "configure"
78 ;; Use the `png_jmpbuf' accessor, as recommended since libpng
80 ;; http://www.libpng.org/pub/png/src/libpng-1.2.x-to-1.4.x-summary.txt).
81 (substitute* "libplot/z_write.c"
83 "png_jmpbuf (png_ptr)"))
86 ;; The test suite fails on some architectures such as i686 (see:
87 ;; https://lists.gnu.org/archive/html/bug-plotutils/2016-04/msg00002.html).
88 ;; The following Debian patch works around it.
89 (search-patches "plotutils-spline-test.patch"))))
90 (build-system gnu-build-system)
92 (list #:configure-flags
93 #~(list "--enable-libplotter"
95 ;; On i686 some tests fail due to excess floating point
96 ;; precision; work around it. However, libplotter is C++
97 ;; and thus unaffected by CFLAGS, but '-fexcess-precision'
98 ;; is not implemented for C++ as of GCC 10.
99 #$@(if (target-x86-32?)
100 #~("CFLAGS=-g -O2 -fexcess-precision=standard")
105 #~(modify-phases %standard-phases
106 (add-before 'check 'skip-sloppy-test
108 ;; This test reveals a slight difference in the SVG
109 ;; output due to floating point inequalities. Skip it.
110 (substitute* "test/plot2svg.test"
111 (("^exit .*") "exit 77")))))
112 #~%standard-phases)))
113 (inputs (list libpng libx11 libxt libxaw))
114 (home-page "https://www.gnu.org/software/plotutils/")
115 (synopsis "Plotting utilities and library")
117 "GNU Plotutils is a package for plotting and working with 2D graphics.
118 It includes the C library @code{libplot} and the C++ @code{libplotter} library
119 for exporting 2D vector graphics in many file formats. It also has support
120 for 2D vector graphics animations. The package also contains command-line
121 programs for plotting scientific data.")
122 (license license:gpl2+)))
124 (define-public guile-plotutils
126 (name "guile-plotutils")
130 (uri (list (string-append "https://lonelycactus.com/tarball/"
131 "guile_plotutils-" version ".tar.gz")
133 "https://github.com/spk121/guile-plotutils/releases/download/v"
134 version "/guile_plotutils-" version
138 "0r245z75cdzgzi57fpz84mnyrjq44793zzaaxxrszyxm1d06hc6r"))))
139 (build-system gnu-build-system)
141 `(#:imported-modules ((guix build guile-build-system)
142 ,@%gnu-build-system-modules)
143 #:modules (((guix build guile-build-system)
144 #:select (target-guile-effective-version))
145 (guix build gnu-build-system)
148 (modify-phases %standard-phases
149 (add-before 'install 'set-library-file-name
150 (lambda* (#:key outputs #:allow-other-keys)
151 (let ((out (assoc-ref outputs "out"))
152 (version (target-guile-effective-version)))
153 ;; First install libguile-plotutils.so.
154 (invoke "make" "install-guileextensionLTLIBRARIES")
156 ;; Then change source files to refer to it.
157 (substitute* '("module/plotutils/graph.scm"
158 "module/plotutils/plot.scm")
159 (("\"libguile-plotutils\"")
160 (string-append "\"" out "/lib/guile/" version
161 "/extensions/libguile-plotutils\"")))))))))
162 (native-inputs (list pkg-config texinfo))
163 (inputs (list plotutils guile-3.0 zlib))
164 (home-page "https://lonelycactus.com/guile-plotutils.html")
165 (synopsis "Guile bindings to the GNU Plotutils plotting libraries")
167 "Guile-Plotutils is a Guile binding to the venerable GNU Plotutils
168 plotting and graphing library. If you want to make graphs that look like you
169 went to university in the 1990s, this is the library for you.")
170 (license license:gpl3+)))
172 (define-public guile-charting
173 ;; This commit fixes a few things, including Guile 3 support, not available
174 ;; in the latest release.
175 (let ((commit "75f755b691a9f712f3b956657d01805d6a8a1b98")
178 (name "guile-charting")
179 (version (git-version "0.2.0" revision commit))
183 (url "https://gitlab.com/wingo/guile-charting")
185 (file-name (git-file-name name version))
188 "03049g7wnpyfi0r36ij4a46kc9l45jbanx02iklkjwav2n6jqnnk"))))
189 (build-system gnu-build-system)
191 (list autoconf automake texinfo pkg-config))
192 (inputs (list guile-3.0))
193 (propagated-inputs (list guile-cairo))
194 (home-page "http://wingolog.org/projects/guile-charting/")
195 (synopsis "Create charts and graphs in Guile")
197 "Guile-Charting is a Guile Scheme library to create bar charts and graphs
198 using the Cairo drawing library.")
199 (license license:lgpl2.1+))))
201 (define-public guile2.2-charting
203 (inherit guile-charting)
204 (name "guile2.2-charting")
205 (inputs (list guile-2.2))
206 (propagated-inputs (list guile2.2-cairo))))
208 (define-public ploticus
214 (uri (string-append "mirror://sourceforge/ploticus/ploticus/"
215 version "/ploticus242_src.tar.gz"))
218 "1c70cvfvgjh83hj1x21130wb9qfr2rc0x47cxy9kl805yjwy8a9z"))
219 (modules '((guix build utils)))
221 ;; Install binaries in the right place.
223 (substitute* "src/Makefile"
225 (string-append "INSTALLBIN = $(out)/bin")))
227 (build-system gnu-build-system)
231 (modify-phases %standard-phases
232 (replace 'configure (lambda _ (chdir "src")))
233 (add-before 'install 'make-target-directories
234 (lambda* (#:key outputs #:allow-other-keys)
235 (let ((out (assoc-ref outputs "out")))
236 (mkdir-p (string-append out "/bin"))
238 (add-after 'install 'install-prefabs
239 (lambda* (#:key outputs #:allow-other-keys)
240 (let* ((out (assoc-ref outputs "out"))
241 (dir (string-append out
242 "/share/ploticus/prefabs"))
243 (bin (string-append out "/bin")))
246 ;; Install "prefabs".
247 (for-each (lambda (file)
249 (string-append dir "/"
251 (copy-file file target)))
252 (find-files "../prefabs" "."))
254 ;; Allow them to be found.
255 (wrap-program (string-append bin "/pl")
256 `("PLOTICUS_PREFABS" ":" = (,dir)))))))))
258 (list libpng libx11 zlib))
259 (home-page "http://ploticus.sourceforge.net/")
260 (synopsis "Command-line tool for producing plots and charts")
262 "Ploticus is a non-interactive software package for producing plots,
263 charts, and graphics from data. Ploticus is good for automated or
264 just-in-time graph generation, handles date and time data nicely, and has
265 basic statistical capabilities. It allows significant user control over
266 colors, styles, options and details.")
267 (license license:gpl2+)))
269 (define-public asymptote
276 (uri (string-append "mirror://sourceforge/asymptote/"
277 version "/asymptote-" version ".src.tgz"))
279 (base32 "0wq0xnkxb8rsphmgls5f38ll61j8i0plh7cr1n0kldvpr14bm3kn"))
280 (modules '((guix build utils)))
282 ;; Remove bundled RapidJSON.
284 (delete-file-recursively "LspCpp/third_party/rapidjson")))))
285 (build-system gnu-build-system)
286 ;; Note: The 'asy' binary retains a reference to docdir for use with its
287 ;; "help" command in interactive mode, so adding a "doc" output is not
295 ghostscript ;for tests
298 texinfo ;for generating documentation
300 (list texlive-amsfonts
301 texlive-dvips-l3backend
305 texlive-generic-infwarerr
306 texlive-generic-kvdefinekeys
310 texlive-latex-geometry
311 texlive-latex-graphics
312 texlive-latex-kvoptions
315 texlive-latex-pdftexcmds
316 texlive-oberdiek ;for ifluatex
317 texlive-latex-parskip
318 texlive-tex-texinfo))))
335 #:modules '((guix build emacs-utils)
336 (guix build gnu-build-system)
339 #:imported-modules `(,@%gnu-build-system-modules
340 (guix build emacs-utils))
342 #~(list (string-append "--enable-gc=" #$(this-package-input "libgc"))
343 (string-append "--with-latex=" #$output "/share/texmf/tex/latex")
344 (string-append "--with-context="
346 "/share/texmf/tex/context/third"))
348 #~(modify-phases %standard-phases
349 (add-after 'unpack 'locate-tirpc
350 (lambda* (#:key inputs #:allow-other-keys)
351 (substitute* (list "configure.ac")
352 (("/usr/include/tirpc")
353 (search-input-directory inputs "include/tirpc")))))
354 (add-after 'unpack 'unbundle-rapidjson
355 (lambda* (#:key inputs #:allow-other-keys)
356 (substitute* (list "Makefile.in")
357 (("\\$\\(CMAKE\\)" all)
358 (string-append all " -DUSE_SYSTEM_RAPIDJSON=ON")))))
359 (add-after 'unpack 'fix-includes
361 (substitute* (find-files "." "\\.in$")
362 (("#include <primitives.h>") "#include \"primitives.h\""))
363 (substitute* (find-files "prc" "\\.h$")
364 (("#include \"config.h\"") "#include \"../config.h\""))
365 (substitute* "prc/oPRCFile.h"
366 (("#include \"xstream.h\"") "#include \"../xstream.h\""))
367 (substitute* "v3dfile.h"
368 (("#include <prc/oPRCFile.h>") "#include \"prc/oPRCFile.h\""))
369 (substitute* "LspCpp/src/lsp/ParentProcessWatcher.cpp"
370 (("#include <boost/process.hpp>" all)
371 (string-append "#include <algorithm>\n" all)))))
374 (invoke "autoreconf" "-vfi")))
375 (add-after 'unpack 'move-info-location
376 ;; Build process installs info file in the unusual
377 ;; "%out/share/info/asymptote/" location. Move it to
378 ;; "%out/share/info/" so it appears in the top-level directory.
380 (substitute* "doc/png/Makefile.in"
381 (("(\\$\\(infodir\\))/asymptote" _ infodir) infodir))
382 (substitute* "doc/asymptote.texi"
383 (("asymptote/asymptote") "asymptote"))))
384 (add-before 'build 'patch-pdf-viewer
386 ;; Default to a free pdf viewer.
387 (substitute* "settings.cc"
388 (("defaultPDFViewer=\"acroread\"")
389 "defaultPDFViewer=\"gv\""))))
390 (add-before 'check 'set-HOME
391 ;; Some tests require write access to $HOME, otherwise leading to
392 ;; "failed to create directory /homeless-shelter/.asy" error.
394 (setenv "HOME" "/tmp")))
395 (add-after 'install 'install-Emacs-data
396 (lambda* (#:key outputs #:allow-other-keys)
397 ;; Install related Emacs libraries into an appropriate location.
399 (string-append #$output "/share/emacs/site-lisp")))
400 (for-each (cut install-file <> lisp-dir)
401 (find-files "." "\\.el$"))
402 (emacs-generate-autoloads #$name lisp-dir))))
403 (add-after 'install-Emacs-data 'wrap-python-script
404 (lambda* (#:key inputs outputs #:allow-other-keys)
405 ;; Make sure 'xasy' runs with the correct PYTHONPATH.
406 (let ((path (getenv "GUIX_PYTHONPATH")))
408 (string-append #$output "/share/asymptote/GUI/xasy.py")
409 `("GUIX_PYTHONPATH" ":" prefix (,path)))))))))
410 (home-page "http://asymptote.sourceforge.net")
411 (synopsis "Script-based vector graphics language")
413 "Asymptote is a powerful descriptive vector graphics language for
414 technical drawing, inspired by MetaPost but with an improved C++-like syntax.
415 Asymptote provides for figures the same high-quality level of typesetting that
416 LaTeX does for scientific text.")
417 ;; Most source files do not contain license statements, but the README
418 ;; contains: "All source files in the Asymptote project, unless explicitly
419 ;; noted otherwise, are released under version 3 (or later) of the GNU
420 ;; Lesser General Public License"
421 (license license:lgpl3+)))