projects/guix·blob wip-postfix · refs

476 lines · 20.2 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <[email protected]>
3;;; Copyright © 2015 Eric Bavier <[email protected]>
4;;; Copyright © 2016-2023 Nicolas Goaziou <[email protected]>
5;;; Copyright © 2018 Tobias Geerinckx-Rice <[email protected]>
6;;; Copyright © 2020 Maxim Cournoyer <[email protected]>
7;;; Copyright © 2023 gemmaro <[email protected]>
8;;;
9;;; This file is part of GNU Guix.
10;;;
11;;; GNU Guix is free software; you can redistribute it and/or modify it
12;;; under the terms of the GNU General Public License as published by
13;;; the Free Software Foundation; either version 3 of the License, or (at
14;;; your option) any later version.
15;;;
16;;; GNU Guix is distributed in the hope that it will be useful, but
17;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;;; GNU General Public License for more details.
20;;;
21;;; You should have received a copy of the GNU General Public License
22;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24(define-module (gnu packages plotutils)
25 #:use-module ((guix licenses) #:prefix license:)
26 #:use-module (guix gexp)
27 #:use-module ((guix utils) #:select (target-x86-32?))
28 #:use-module (guix packages)
29 #:use-module (guix download)
30 #:use-module (guix git-download)
31 #:use-module (guix build-system gnu)
32 #:use-module (guix build-system ruby)
33 #:use-module (gnu packages algebra)
34 #:use-module (gnu packages autotools)
35 #:use-module (gnu packages bash)
36 #:use-module (gnu packages bison)
37 #:use-module (gnu packages bdw-gc)
38 #:use-module (gnu packages boost)
39 #:use-module (gnu packages cmake)
40 #:use-module (gnu packages emacs)
41 #:use-module (gnu packages flex)
42 #:use-module (gnu packages xorg)
43 #:use-module (gnu packages image)
44 #:use-module (gnu packages ghostscript)
45 #:use-module (gnu packages guile)
46 #:use-module (gnu packages gl)
47 #:use-module (gnu packages gtk)
48 #:use-module (gnu packages maths)
49 #:use-module (gnu packages onc-rpc)
50 #:use-module (gnu packages perl)
51 #:use-module (gnu packages pkg-config)
52 #:use-module (gnu packages python)
53 #:use-module (gnu packages python-xyz)
54 #:use-module (gnu packages readline)
55 #:use-module (gnu packages ruby)
56 #:use-module (gnu packages qt)
57 #:use-module (gnu packages statistics)
58 #:use-module (gnu packages texinfo)
59 #:use-module (gnu packages tex)
60 #:use-module (gnu packages web)
61 #:use-module (gnu packages compression)
62 #:use-module (gnu packages))
63
64(define-public plotutils
65 (package
66 (name "plotutils")
67 (version "2.6")
68 (source (origin
69 (method url-fetch)
70 (uri (string-append "mirror://gnu/plotutils/plotutils-"
71 version ".tar.gz"))
72 (sha256
73 (base32
74 "1arkyizn5wbgvbh53aziv3s6lmd3wm9lqzkhxb3hijlp1y124hjg"))
75 (modules '((guix build utils)))
76 (snippet
77 ;; Force the use of libXaw7 instead of libXaw. When not doing
78 ;; that, libplot.la ends up containing just "-lXaw" (without
79 ;; "-L/path/to/Xaw"), due to the fact that there is no
80 ;; libXaw.la, which forces us to propagate libXaw.
81 '(begin
82 (substitute* "configure"
83 (("-lXaw")
84 "-lXaw7"))
85 ;; Use the `png_jmpbuf' accessor, as recommended since libpng
86 ;; 1.4.0 (see:
87 ;; http://www.libpng.org/pub/png/src/libpng-1.2.x-to-1.4.x-summary.txt).
88 (substitute* "libplot/z_write.c"
89 (("png_ptr->jmpbuf")
90 "png_jmpbuf (png_ptr)"))
91 #t))
92 (patches
93 ;; The test suite fails on some architectures such as i686 (see:
94 ;; https://lists.gnu.org/archive/html/bug-plotutils/2016-04/msg00002.html).
95 ;; The following Debian patch works around it.
96 (search-patches "plotutils-spline-test.patch"))))
97 (build-system gnu-build-system)
98 (arguments
99 (list #:configure-flags
100 #~(list "--enable-libplotter"
101
102 ;; On i686 some tests fail due to excess floating point
103 ;; precision; work around it. However, libplotter is C++
104 ;; and thus unaffected by CFLAGS, but '-fexcess-precision'
105 ;; is not implemented for C++ as of GCC 10.
106 #$@(if (target-x86-32?)
107 #~("CFLAGS=-g -O2 -fexcess-precision=standard")
108 #~()))
109
110 #:phases
111 (if (target-x86-32?)
112 #~(modify-phases %standard-phases
113 (add-before 'check 'skip-sloppy-test
114 (lambda _
115 ;; This test reveals a slight difference in the SVG
116 ;; output due to floating point inequalities. Skip it.
117 (substitute* "test/plot2svg.test"
118 (("^exit .*") "exit 77")))))
119 #~%standard-phases)))
120 (inputs (list libpng libx11 libxt libxaw))
121 (home-page "https://www.gnu.org/software/plotutils/")
122 (synopsis "Plotting utilities and library")
123 (description
124 "GNU Plotutils is a package for plotting and working with 2D graphics.
125It includes the C library @code{libplot} and the C++ @code{libplotter} library
126for exporting 2D vector graphics in many file formats. It also has support
127for 2D vector graphics animations. The package also contains command-line
128programs for plotting scientific data.")
129 (license license:gpl2+)))
130
131(define-public guile-plotutils
132 (package
133 (name "guile-plotutils")
134 (version "1.0.1")
135 (source (origin
136 (method url-fetch)
137 (uri (list (string-append "https://lonelycactus.com/tarball/"
138 "guile_plotutils-" version ".tar.gz")
139 (string-append
140 "https://github.com/spk121/guile-plotutils/releases/download/v"
141 version "/guile_plotutils-" version
142 ".tar.gz")))
143 (sha256
144 (base32
145 "0r245z75cdzgzi57fpz84mnyrjq44793zzaaxxrszyxm1d06hc6r"))))
146 (build-system gnu-build-system)
147 (arguments
148 `(#:imported-modules ((guix build guile-build-system)
149 ,@%gnu-build-system-modules)
150 #:modules (((guix build guile-build-system)
151 #:select (target-guile-effective-version))
152 (guix build gnu-build-system)
153 (guix build utils))
154 #:phases
155 (modify-phases %standard-phases
156 (add-before 'install 'set-library-file-name
157 (lambda* (#:key outputs #:allow-other-keys)
158 (let ((out (assoc-ref outputs "out"))
159 (version (target-guile-effective-version)))
160 ;; First install libguile-plotutils.so.
161 (invoke "make" "install-guileextensionLTLIBRARIES")
162
163 ;; Then change source files to refer to it.
164 (substitute* '("module/plotutils/graph.scm"
165 "module/plotutils/plot.scm")
166 (("\"libguile-plotutils\"")
167 (string-append "\"" out "/lib/guile/" version
168 "/extensions/libguile-plotutils\"")))))))))
169 (native-inputs (list pkg-config texinfo))
170 (inputs (list plotutils guile-3.0 zlib))
171 (home-page "https://lonelycactus.com/guile-plotutils.html")
172 (synopsis "Guile bindings to the GNU Plotutils plotting libraries")
173 (description
174 "Guile-Plotutils is a Guile binding to the venerable GNU Plotutils
175plotting and graphing library. If you want to make graphs that look like you
176went to university in the 1990s, this is the library for you.")
177 (license license:gpl3+)))
178
179(define-public guile-charting
180 ;; This commit fixes a few things, including Guile 3 support, not available
181 ;; in the latest release.
182 (let ((commit "75f755b691a9f712f3b956657d01805d6a8a1b98")
183 (revision "1"))
184 (package
185 (name "guile-charting")
186 (version (git-version "0.2.0" revision commit))
187 (source (origin
188 (method git-fetch)
189 (uri (git-reference
190 (url "https://gitlab.com/wingo/guile-charting")
191 (commit commit)))
192 (file-name (git-file-name name version))
193 (sha256
194 (base32
195 "03049g7wnpyfi0r36ij4a46kc9l45jbanx02iklkjwav2n6jqnnk"))))
196 (build-system gnu-build-system)
197 (native-inputs
198 (list autoconf automake texinfo pkg-config))
199 (inputs (list guile-3.0))
200 (propagated-inputs (list guile-cairo))
201 (home-page "https://wingolog.org/projects/guile-charting/")
202 (synopsis "Create charts and graphs in Guile")
203 (description
204 "Guile-Charting is a Guile Scheme library to create bar charts and graphs
205using the Cairo drawing library.")
206 (license license:lgpl2.1+))))
207
208(define-public guile2.2-charting
209 (package
210 (inherit guile-charting)
211 (name "guile2.2-charting")
212 (inputs (list guile-2.2))
213 (propagated-inputs (list guile2.2-cairo))))
214
215(define-public ploticus
216 (package
217 (name "ploticus")
218 (version "2.42")
219 (source (origin
220 (method url-fetch)
221 (uri (string-append "mirror://sourceforge/ploticus/ploticus/"
222 version "/ploticus242_src.tar.gz"))
223 (sha256
224 (base32
225 "1c70cvfvgjh83hj1x21130wb9qfr2rc0x47cxy9kl805yjwy8a9z"))
226 (modules '((guix build utils)))
227 (snippet
228 ;; Install binaries in the right place.
229 '(begin
230 (substitute* "src/Makefile"
231 (("INSTALLBIN =.*$")
232 (string-append "INSTALLBIN = $(out)/bin")))
233 #t))))
234 (build-system gnu-build-system)
235 (arguments
236 '(#:tests? #f
237 #:phases
238 (modify-phases %standard-phases
239 (replace 'configure (lambda _ (chdir "src")))
240 (add-before 'install 'make-target-directories
241 (lambda* (#:key outputs #:allow-other-keys)
242 (let ((out (assoc-ref outputs "out")))
243 (mkdir-p (string-append out "/bin"))
244 #t)))
245 (add-after 'install 'install-prefabs
246 (lambda* (#:key outputs #:allow-other-keys)
247 (let* ((out (assoc-ref outputs "out"))
248 (dir (string-append out
249 "/share/ploticus/prefabs"))
250 (bin (string-append out "/bin")))
251 (mkdir-p dir)
252
253 ;; Install "prefabs".
254 (for-each (lambda (file)
255 (let ((target
256 (string-append dir "/"
257 (basename file))))
258 (copy-file file target)))
259 (find-files "../prefabs" "."))
260
261 ;; Allow them to be found.
262 (wrap-program (string-append bin "/pl")
263 `("PLOTICUS_PREFABS" ":" = (,dir)))))))))
264 (inputs
265 (list libpng libx11 zlib))
266 (home-page "https://ploticus.sourceforge.net/")
267 (synopsis "Command-line tool for producing plots and charts")
268 (description
269 "Ploticus is a non-interactive software package for producing plots,
270charts, and graphics from data. Ploticus is good for automated or
271just-in-time graph generation, handles date and time data nicely, and has
272basic statistical capabilities. It allows significant user control over
273colors, styles, options and details.")
274 (license license:gpl2+)))
275
276(define-public asymptote
277 (package
278 (name "asymptote")
279 (version "2.86")
280 (source
281 (origin
282 (method url-fetch)
283 (uri (string-append "mirror://sourceforge/asymptote/"
284 version "/asymptote-" version ".src.tgz"))
285 (sha256
286 (base32 "07y9yg7kdkgmz024qzny8xhjw3c367kxfpwzv19cxcy7qcgsvsy4"))
287 (modules '((guix build utils)))
288 (snippet
289 ;; Remove bundled RapidJSON.
290 #~(begin
291 (delete-file-recursively "LspCpp/third_party/rapidjson")))))
292 (build-system gnu-build-system)
293 ;; Note: The 'asy' binary retains a reference to docdir for use with its
294 ;; "help" command in interactive mode, so adding a "doc" output is not
295 ;; currently useful.
296 (native-inputs
297 (list autoconf
298 automake
299 bison
300 boost
301 cmake
302 emacs-minimal
303 flex
304 ghostscript ;for tests
305 perl
306 pkg-config
307 rapidjson
308 texinfo ;for generating documentation
309 (texlive-updmap.cfg
310 (list texlive-epsf
311 texlive-etoolbox
312 texlive-hypdoc
313 texlive-infwarerr
314 texlive-kvdefinekeys
315 texlive-kvoptions
316 texlive-media9
317 texlive-ocgx2
318 texlive-parskip
319 texlive-pdftexcmds
320 texlive-texinfo))))
321 (inputs
322 (list bash-minimal
323 eigen
324 fftw
325 freeglut
326 glew
327 glm
328 gsl
329 libgc
330 libtirpc
331 python
332 python-cson
333 python-numpy
334 python-pyqt
335 readline
336 zlib))
337 (arguments
338 (list
339 #:modules '((guix build emacs-utils)
340 (guix build gnu-build-system)
341 (guix build utils)
342 (srfi srfi-26))
343 #:imported-modules `(,@%gnu-build-system-modules
344 (guix build emacs-utils))
345 #:configure-flags
346 #~(list (string-append "--enable-gc=" #$(this-package-input "libgc"))
347 (string-append "--with-latex=" #$output "/share/texmf/tex/latex")
348 (string-append "--with-context="
349 #$output
350 "/share/texmf/tex/context/third"))
351 #:phases
352 #~(modify-phases %standard-phases
353 (add-after 'unpack 'locate-tirpc
354 (lambda* (#:key inputs #:allow-other-keys)
355 (substitute* (list "configure.ac")
356 (("/usr/include/tirpc")
357 (search-input-directory inputs "include/tirpc")))))
358 (add-after 'unpack 'unbundle-rapidjson
359 (lambda* (#:key inputs #:allow-other-keys)
360 (substitute* (list "Makefile.in")
361 (("\\$\\(CMAKE\\)" all)
362 (string-append all " -DUSE_SYSTEM_RAPIDJSON=ON")))))
363 (add-after 'unpack 'fix-includes
364 (lambda _
365 (substitute* (find-files "." "\\.in$")
366 (("#include <primitives.h>") "#include \"primitives.h\""))
367 (substitute* (find-files "prc" "\\.h$")
368 (("#include \"config.h\"") "#include \"../config.h\""))
369 (substitute* "prc/oPRCFile.h"
370 (("#include \"xstream.h\"") "#include \"../xstream.h\""))
371 (substitute* "v3dfile.h"
372 (("#include <prc/oPRCFile.h>") "#include \"prc/oPRCFile.h\""))
373 (substitute* "LspCpp/src/lsp/ParentProcessWatcher.cpp"
374 (("#include <boost/process.hpp>" all)
375 (string-append "#include <algorithm>\n" all)))))
376 (replace 'bootstrap
377 (lambda _
378 (invoke "autoreconf" "-vfi")))
379 (add-after 'unpack 'move-info-location
380 ;; Build process installs info file in the unusual
381 ;; "%out/share/info/asymptote/" location. Move it to
382 ;; "%out/share/info/" so it appears in the top-level directory.
383 (lambda _
384 (substitute* "doc/png/Makefile.in"
385 (("(\\$\\(infodir\\))/asymptote" _ infodir) infodir))
386 (substitute* "doc/asymptote.texi"
387 (("asymptote/asymptote") "asymptote"))))
388 (add-before 'build 'patch-pdf-viewer
389 (lambda _
390 ;; Default to a free pdf viewer.
391 (substitute* "settings.cc"
392 (("defaultPDFViewer=\"acroread\"")
393 "defaultPDFViewer=\"gv\""))))
394 (add-before 'check 'set-HOME
395 ;; Some tests require write access to $HOME, otherwise leading to
396 ;; "failed to create directory /homeless-shelter/.asy" error.
397 (lambda _
398 (setenv "HOME" "/tmp")))
399 (add-after 'install 'install-Emacs-data
400 (lambda _
401 ;; Install related Emacs libraries into an appropriate location.
402 (let ((lisp-dir
403 (string-append #$output "/share/emacs/site-lisp")))
404 (for-each (cut install-file <> lisp-dir)
405 (find-files "." "\\.el$"))
406 (emacs-generate-autoloads #$name lisp-dir))))
407 (add-after 'install-Emacs-data 'wrap-python-script
408 (lambda* (#:key inputs outputs #:allow-other-keys)
409 ;; Make sure 'xasy' runs with the correct PYTHONPATH.
410 (let ((path (getenv "GUIX_PYTHONPATH")))
411 (wrap-program
412 (string-append #$output "/share/asymptote/GUI/xasy.py")
413 `("GUIX_PYTHONPATH" ":" prefix (,path)))))))))
414 (home-page "https://asymptote.sourceforge.io")
415 (synopsis "Script-based vector graphics language")
416 (description
417 "Asymptote is a powerful descriptive vector graphics language for
418technical drawing, inspired by MetaPost but with an improved C++-like syntax.
419Asymptote provides for figures the same high-quality level of typesetting that
420LaTeX does for scientific text.")
421 ;; Most source files do not contain license statements, but the README
422 ;; contains: "All source files in the Asymptote project, unless explicitly
423 ;; noted otherwise, are released under version 3 (or later) of the GNU
424 ;; Lesser General Public License"
425 (license license:lgpl3+)))
426
427(define-public ruby-unicode-plot
428 (package
429 (name "ruby-unicode-plot")
430 (version "0.0.5")
431 ;; Source at RubyGems.org doesn't have test fixtures.
432 (source (origin
433 (method git-fetch)
434 (uri (git-reference
435 (url
436 "https://github.com/red-data-tools/unicode_plot.rb")
437 (commit (string-append "v" version))))
438 (file-name (git-file-name name version))
439 (sha256
440 (base32
441 "0g67brnb7zp1xx9cp1x7bmyxwnvi2i8gplw7p1j7cppzin4kr1vj"))))
442 (build-system ruby-build-system)
443 (native-inputs (list bundler ruby-rake ruby-test-unit ruby-yard))
444 (propagated-inputs (list ruby-enumerable-statistics))
445 (synopsis "Library to plot your data by Unicode characters")
446 (description "UnicodePlot provides the feature to make charts with Unicode
447characters. Supported charts are: barplot, boxplot, densityplot,
448histogram, lineplot, and scatterplot.")
449 (home-page "https://github.com/red-data-tools/unicode_plot.rb")
450 (license license:expat)))
451
452(define-public youplot
453 (package
454 (name "youplot")
455 (version "0.4.5")
456 ;; Source at RubyGems.org doesn't have tests.
457 (source (origin
458 (method git-fetch)
459 (uri (git-reference
460 (url "https://github.com/red-data-tools/YouPlot")
461 (commit (string-append "v" version))))
462 (file-name (git-file-name name version))
463 (sha256
464 (base32
465 "1y54apw7hx9mhjnf277w9wayvq954mdnip4dpajhc0qjg2464c2b"))))
466 (build-system ruby-build-system)
467 (native-inputs (list ruby-rake ruby-simplecov ruby-test-unit))
468 (propagated-inputs (list ruby-unicode-plot))
469 (synopsis "Command line tool that draw plots on the terminal")
470 (description
471 "YouPlot is a command line tool that draws plots on the terminal,
472powered by UnicodePlot gem. It provides commands @command{youplot}
473and @command{uplot} (shorthand) are provided, and supports chart types
474of barplot, histogram, lineplot, scatter, density, boxplot, and count.")
475 (home-page "https://github.com/red-data-tools/YouPlot")
476 (license license:expat)))