Merge branch 'staging' into core-updates
[jackhill/guix/guix.git] / gnu / packages / plotutils.scm
CommitLineData
bb3fe7fc 1;;; GNU Guix --- Functional package management for GNU
ece7731e 2;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
20977871 3;;; Copyright © 2015 Eric Bavier <bavier@member.fsf.org>
49181f84 4;;; Copyright © 2016, 2017, 2019, 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
fb5f8f01 5;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
bb3fe7fc
LC
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)
40e9de2a 23 #:use-module ((guix licenses) #:prefix license:)
bb3fe7fc
LC
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix build-system gnu)
20977871
EB
27 #:use-module (gnu packages algebra)
28 #:use-module (gnu packages bdw-gc)
80ed14d3 29 #:use-module (gnu packages emacs)
fa6141ec 30 #:use-module (gnu packages xorg)
e55354b8 31 #:use-module (gnu packages image)
20977871 32 #:use-module (gnu packages ghostscript)
00ebe474 33 #:use-module (gnu packages guile)
20977871 34 #:use-module (gnu packages gl)
00ebe474 35 #:use-module (gnu packages gtk)
20977871
EB
36 #:use-module (gnu packages maths)
37 #:use-module (gnu packages perl)
00ebe474 38 #:use-module (gnu packages pkg-config)
20977871 39 #:use-module (gnu packages python)
1b4c5af2 40 #:use-module (gnu packages python-xyz)
20977871 41 #:use-module (gnu packages readline)
1b4c5af2 42 #:use-module (gnu packages qt)
20977871 43 #:use-module (gnu packages texinfo)
8f9ac901 44 #:use-module (gnu packages tex)
40e9de2a 45 #:use-module (gnu packages compression)
8e5e7299 46 #:use-module (gnu packages))
bb3fe7fc
LC
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
01eafd38 58 "1arkyizn5wbgvbh53aziv3s6lmd3wm9lqzkhxb3hijlp1y124hjg"))
fc1adab1 59 (patches (search-patches "plotutils-libpng-jmpbuf.patch"))
ceae3fef
LC
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.
6cbee49d
MW
66 '(begin
67 (substitute* "configure"
68 (("-lXaw")
69 "-lXaw7"))
70 #t))))
bb3fe7fc 71 (build-system gnu-build-system)
fa6141ec
LC
72 (inputs `(("libpng" ,libpng)
73 ("libx11" ,libx11)
ceae3fef
LC
74 ("libxt" ,libxt)
75 ("libxaw" ,libxaw)))
a6eb1a95 76
bb3fe7fc
LC
77 (home-page
78 "http://www.gnu.org/software/plotutils/")
79 (synopsis "Plotting utilities and library")
80 (description
79c311b8
LC
81 "GNU Plotutils is a package for plotting and working with 2D graphics.
82It includes a library, \"libplot\", for C and C++ for exporting 2D vector
83graphics in many file formats. It also has support for 2D vector graphics
84animations. The package also contains command-line programs for plotting
85scientific data.")
40e9de2a 86 (license license:gpl2+)))
00ebe474
LC
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
ece7731e
LC
98 "0w5qiyv9v0ip5li22x762bm48g8xnw281w66iyw094zdw611pb2m"))
99 (modules '((guix build utils)))
100 (snippet
101 '(begin
102 ;; By default, .go files would be installed to
103 ;; $libdir/…/ccache instead of $libdir/…/site-ccache. Fix
104 ;; that.
105 (substitute* (find-files "." "^Makefile\\.in$")
106 (("/ccache") "/site-ccache"))
107 #t))))
00ebe474
LC
108 (build-system gnu-build-system)
109 (native-inputs `(("pkg-config" ,pkg-config)))
1b0f266e 110 (inputs `(("guile" ,guile-2.2)))
00ebe474
LC
111 (propagated-inputs `(("guile-cairo" ,guile-cairo)))
112 (home-page "http://wingolog.org/software/guile-charting/")
113 (synopsis "Create charts and graphs in Guile")
114 (description
115 "Guile-Charting is a Guile Scheme library to create bar charts and graphs
116using the Cairo drawing library.")
40e9de2a
LC
117 (license license:lgpl2.1+)))
118
119(define-public ploticus
120 (package
121 (name "ploticus")
122 (version "2.42")
123 (source (origin
124 (method url-fetch)
125 (uri (string-append "mirror://sourceforge/ploticus/ploticus/"
126 version "/ploticus242_src.tar.gz"))
127 (sha256
128 (base32
129 "1c70cvfvgjh83hj1x21130wb9qfr2rc0x47cxy9kl805yjwy8a9z"))
130 (modules '((guix build utils)))
131 (snippet
132 ;; Install binaries in the right place.
6cbee49d
MW
133 '(begin
134 (substitute* "src/Makefile"
135 (("INSTALLBIN =.*$")
136 (string-append "INSTALLBIN = $(out)/bin")))
137 #t))))
40e9de2a
LC
138 (build-system gnu-build-system)
139 (arguments
140 '(#:tests? #f
141 #:phases
142 (modify-phases %standard-phases
f8503e2b
LC
143 (replace 'configure (lambda _ (chdir "src")))
144 (add-before 'install 'make-target-directories
40e9de2a
LC
145 (lambda* (#:key outputs #:allow-other-keys)
146 (let ((out (assoc-ref outputs "out")))
147 (mkdir-p (string-append out "/bin"))
148 #t)))
f8503e2b 149 (add-after 'install 'install-prefabs
40e9de2a
LC
150 (lambda* (#:key outputs #:allow-other-keys)
151 (let* ((out (assoc-ref outputs "out"))
152 (dir (string-append out
153 "/share/ploticus/prefabs"))
154 (bin (string-append out "/bin")))
155 (mkdir-p dir)
156
157 ;; Install "prefabs".
158 (for-each (lambda (file)
159 (let ((target
160 (string-append dir "/"
161 (basename file))))
162 (copy-file file target)))
163 (find-files "../prefabs" "."))
164
165 ;; Allow them to be found.
166 (wrap-program (string-append bin "/pl")
167 `("PLOTICUS_PREFABS" ":" = (,dir)))))))))
168 (inputs
169 `(("libpng" ,libpng)
170 ("libx11" ,libx11)
171 ("zlib" ,zlib)))
172 (home-page "http://ploticus.sourceforge.net/")
173 (synopsis "Command-line tool for producing plots and charts")
174 (description
175 "Ploticus is a non-interactive software package for producing plots,
176charts, and graphics from data. Ploticus is good for automated or
177just-in-time graph generation, handles date and time data nicely, and has
178basic statistical capabilities. It allows significant user control over
179colors, styles, options and details.")
180 (license license:gpl2+)))
20977871
EB
181
182(define-public asymptote
183 (package
184 (name "asymptote")
49181f84 185 (version "2.62")
20977871
EB
186 (source (origin
187 (method url-fetch)
188 (uri (string-append "mirror://sourceforge/asymptote/"
189 version "/asymptote-" version ".src.tgz"))
190 (sha256
191 (base32
49181f84 192 "0510vnlpfyrvshsxr5lh3klwyhmn2cf4ba1ja476mbv5dcqqbc30"))))
20977871
EB
193 (build-system gnu-build-system)
194 ;; Note: The 'asy' binary retains a reference to docdir for use with its
195 ;; "help" command in interactive mode, so adding a "doc" output is not
196 ;; currently useful.
197 (native-inputs
4906a0b2
NG
198 `(("emacs" ,emacs-minimal)
199 ("gs" ,ghostscript) ;For tests
200 ("perl" ,perl)
1b4c5af2 201 ("texinfo" ,texinfo) ;For generating documentation
15e57838 202 ;; For the manual and the tests.
f75aa97f 203 ("texlive" ,(texlive-union (list texlive-amsfonts
d9de8fbb
NG
204 texlive-epsf
205 texlive-latex-base
15e57838
PN
206 texlive-latex-geometry
207 texlive-latex-graphics
8983a52c 208 texlive-latex-oberdiek ; for ifluatex
15e57838 209 texlive-latex-parskip
4906a0b2 210 texlive-tex-texinfo)))))
20977871
EB
211 (inputs
212 `(("fftw" ,fftw)
213 ("freeglut" ,freeglut)
4906a0b2
NG
214 ("glew" ,glew)
215 ("glm" ,glm)
20977871 216 ("gsl" ,gsl)
8c986ab1 217 ("libgc" ,libgc)
4906a0b2 218 ("python" ,python)
1b4c5af2 219 ("python-cson" ,python-cson)
584e46b1 220 ("python-numpy" ,python-numpy)
1b4c5af2 221 ("python-pyqt" ,python-pyqt)
20977871
EB
222 ("readline" ,readline)
223 ("zlib" ,zlib)))
224 (arguments
80ed14d3
NG
225 `(#:modules ((guix build emacs-utils)
226 (guix build gnu-build-system)
227 (guix build utils)
228 (srfi srfi-26))
229 #:imported-modules (,@%gnu-build-system-modules
230 (guix build emacs-utils))
231 #:configure-flags
20977871
EB
232 (list (string-append "--enable-gc=" (assoc-ref %build-inputs "libgc"))
233 (string-append "--with-latex="
234 (assoc-ref %outputs "out")
235 "/share/texmf/tex/latex")
236 (string-append "--with-context="
237 (assoc-ref %outputs "out")
238 "/share/texmf/tex/context/third"))
acb31b5d
NG
239 #:phases
240 (modify-phases %standard-phases
4906a0b2
NG
241 (add-after 'unpack 'fix-build
242 ;; XXX: Build process complains about missing "config.h"
243 ;; and "primitives.h" files.
244 (lambda _
245 (substitute* (find-files "." "\\.in$")
246 (("#include <primitives.h>") "#include \"primitives.h\""))
247 (invoke "touch" "prc/config.h")))
55a604db 248 (add-after 'unpack 'move-info-location
530b3a19 249 ;; Build process installs info file in the unusual
55a604db
NG
250 ;; "%out/share/info/asymptote/" location. Move it to
251 ;; "%out/share/info/" so it appears in the top-level directory.
252 (lambda _
253 (substitute* "doc/png/Makefile.in"
254 (("(\\$\\(infodir\\))/asymptote" _ infodir) infodir))
325a2e35
NG
255 (substitute* "doc/asymptote.texi"
256 (("asymptote/asymptote") "asymptote"))
55a604db 257 #t))
acb31b5d
NG
258 (add-before 'build 'patch-pdf-viewer
259 (lambda _
80ed14d3 260 ;; Default to a free pdf viewer.
acb31b5d
NG
261 (substitute* "settings.cc"
262 (("defaultPDFViewer=\"acroread\"")
80ed14d3
NG
263 "defaultPDFViewer=\"gv\""))
264 #t))
acb31b5d
NG
265 (add-before 'check 'set-HOME
266 ;; Some tests require write access to $HOME, otherwise leading to
267 ;; "failed to create directory /homeless-shelter/.asy" error.
268 (lambda _
80ed14d3
NG
269 (setenv "HOME" "/tmp")
270 #t))
271 (add-after 'install 'install-Emacs-data
272 (lambda* (#:key outputs #:allow-other-keys)
273 ;; Install related Emacs libraries into an appropriate location.
274 (let* ((out (assoc-ref outputs "out"))
275 (lisp-dir (string-append out "/share/emacs/site-lisp")))
276 (for-each (cut install-file <> lisp-dir)
277 (find-files "." "\\.el$"))
278 (emacs-generate-autoloads ,name lisp-dir))
1b4c5af2
NG
279 #t))
280 (add-after 'install-Emacs-data 'wrap-python-script
281 (lambda* (#:key inputs outputs #:allow-other-keys)
282 ;; Make sure 'xasy' runs with the correct PYTHONPATH.
283 (let* ((out (assoc-ref outputs "out"))
284 (path (getenv "PYTHONPATH")))
285 (wrap-program (string-append out "/share/asymptote/GUI/xasy.py")
286 `("PYTHONPATH" ":" prefix (,path))))
80ed14d3 287 #t)))))
20977871
EB
288 (home-page "http://asymptote.sourceforge.net")
289 (synopsis "Script-based vector graphics language")
290 (description
291 "Asymptote is a powerful descriptive vector graphics language for
292technical drawing, inspired by MetaPost but with an improved C++-like syntax.
293Asymptote provides for figures the same high-quality level of typesetting that
294LaTeX does for scientific text.")
295 ;; Most source files do not contain license statements, but the README
296 ;; contains: "All source files in the Asymptote project, unless explicitly
297 ;; noted otherwise, are released under version 3 (or later) of the GNU
298 ;; Lesser General Public License"
299 (license license:lgpl3+)))