gnu: All snippets report errors using exceptions, else return #t.
[jackhill/guix/guix.git] / gnu / packages / plotutils.scm
CommitLineData
bb3fe7fc 1;;; GNU Guix --- Functional package management for GNU
1b0f266e 2;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
20977871 3;;; Copyright © 2015 Eric Bavier <bavier@member.fsf.org>
891f3dc0 4;;; Copyright © 2016, 2017 Nicolas Goaziou <mail@nicolasgoaziou.fr>
bb3fe7fc
LC
5;;;
6;;; This file is part of GNU Guix.
7;;;
8;;; GNU Guix is free software; you can redistribute it and/or modify it
9;;; under the terms of the GNU General Public License as published by
10;;; the Free Software Foundation; either version 3 of the License, or (at
11;;; your option) any later version.
12;;;
13;;; GNU Guix is distributed in the hope that it will be useful, but
14;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;;; GNU General Public License for more details.
17;;;
18;;; You should have received a copy of the GNU General Public License
19;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21(define-module (gnu packages plotutils)
40e9de2a 22 #:use-module ((guix licenses) #:prefix license:)
bb3fe7fc
LC
23 #:use-module (guix packages)
24 #:use-module (guix download)
25 #:use-module (guix build-system gnu)
20977871
EB
26 #:use-module (gnu packages algebra)
27 #:use-module (gnu packages bdw-gc)
80ed14d3 28 #:use-module (gnu packages emacs)
fa6141ec 29 #:use-module (gnu packages xorg)
e55354b8 30 #:use-module (gnu packages image)
20977871 31 #:use-module (gnu packages ghostscript)
00ebe474 32 #:use-module (gnu packages guile)
20977871 33 #:use-module (gnu packages gl)
00ebe474 34 #:use-module (gnu packages gtk)
20977871
EB
35 #:use-module (gnu packages maths)
36 #:use-module (gnu packages perl)
00ebe474 37 #:use-module (gnu packages pkg-config)
20977871
EB
38 #:use-module (gnu packages python)
39 #:use-module (gnu packages readline)
40 #:use-module (gnu packages texinfo)
8f9ac901 41 #:use-module (gnu packages tex)
40e9de2a 42 #:use-module (gnu packages compression)
8e5e7299 43 #:use-module (gnu packages))
bb3fe7fc
LC
44
45(define-public plotutils
46 (package
47 (name "plotutils")
48 (version "2.6")
49 (source (origin
50 (method url-fetch)
51 (uri (string-append "mirror://gnu/plotutils/plotutils-"
52 version ".tar.gz"))
53 (sha256
54 (base32
01eafd38 55 "1arkyizn5wbgvbh53aziv3s6lmd3wm9lqzkhxb3hijlp1y124hjg"))
fc1adab1 56 (patches (search-patches "plotutils-libpng-jmpbuf.patch"))
ceae3fef
LC
57 (modules '((guix build utils)))
58 (snippet
59 ;; Force the use of libXaw7 instead of libXaw. When not doing
60 ;; that, libplot.la ends up containing just "-lXaw" (without
61 ;; "-L/path/to/Xaw"), due to the fact that there is no
62 ;; libXaw.la, which forces us to propagate libXaw.
6cbee49d
MW
63 '(begin
64 (substitute* "configure"
65 (("-lXaw")
66 "-lXaw7"))
67 #t))))
bb3fe7fc 68 (build-system gnu-build-system)
fa6141ec
LC
69 (inputs `(("libpng" ,libpng)
70 ("libx11" ,libx11)
ceae3fef
LC
71 ("libxt" ,libxt)
72 ("libxaw" ,libxaw)))
a6eb1a95 73
bb3fe7fc
LC
74 (home-page
75 "http://www.gnu.org/software/plotutils/")
76 (synopsis "Plotting utilities and library")
77 (description
79c311b8
LC
78 "GNU Plotutils is a package for plotting and working with 2D graphics.
79It includes a library, \"libplot\", for C and C++ for exporting 2D vector
80graphics in many file formats. It also has support for 2D vector graphics
81animations. The package also contains command-line programs for plotting
82scientific data.")
40e9de2a 83 (license license:gpl2+)))
00ebe474
LC
84
85(define-public guile-charting
86 (package
87 (name "guile-charting")
88 (version "0.2.0")
89 (source (origin
90 (method url-fetch)
91 (uri (string-append "http://wingolog.org/pub/guile-charting/"
92 "guile-charting-" version ".tar.gz"))
93 (sha256
94 (base32
95 "0w5qiyv9v0ip5li22x762bm48g8xnw281w66iyw094zdw611pb2m"))
96 (modules '((guix build utils)))
97 (snippet
98 '(begin
99 ;; Use the standard location for modules.
100 (substitute* "Makefile.in"
101 (("godir = .*$")
6cbee49d
MW
102 "godir = $(moddir)\n"))
103 #t))))
00ebe474
LC
104 (build-system gnu-build-system)
105 (native-inputs `(("pkg-config" ,pkg-config)))
1b0f266e 106 (inputs `(("guile" ,guile-2.2)))
00ebe474
LC
107 (propagated-inputs `(("guile-cairo" ,guile-cairo)))
108 (home-page "http://wingolog.org/software/guile-charting/")
109 (synopsis "Create charts and graphs in Guile")
110 (description
111 "Guile-Charting is a Guile Scheme library to create bar charts and graphs
112using the Cairo drawing library.")
40e9de2a
LC
113 (license license:lgpl2.1+)))
114
115(define-public ploticus
116 (package
117 (name "ploticus")
118 (version "2.42")
119 (source (origin
120 (method url-fetch)
121 (uri (string-append "mirror://sourceforge/ploticus/ploticus/"
122 version "/ploticus242_src.tar.gz"))
123 (sha256
124 (base32
125 "1c70cvfvgjh83hj1x21130wb9qfr2rc0x47cxy9kl805yjwy8a9z"))
126 (modules '((guix build utils)))
127 (snippet
128 ;; Install binaries in the right place.
6cbee49d
MW
129 '(begin
130 (substitute* "src/Makefile"
131 (("INSTALLBIN =.*$")
132 (string-append "INSTALLBIN = $(out)/bin")))
133 #t))))
40e9de2a
LC
134 (build-system gnu-build-system)
135 (arguments
136 '(#:tests? #f
137 #:phases
138 (modify-phases %standard-phases
f8503e2b
LC
139 (replace 'configure (lambda _ (chdir "src")))
140 (add-before 'install 'make-target-directories
40e9de2a
LC
141 (lambda* (#:key outputs #:allow-other-keys)
142 (let ((out (assoc-ref outputs "out")))
143 (mkdir-p (string-append out "/bin"))
144 #t)))
f8503e2b 145 (add-after 'install 'install-prefabs
40e9de2a
LC
146 (lambda* (#:key outputs #:allow-other-keys)
147 (let* ((out (assoc-ref outputs "out"))
148 (dir (string-append out
149 "/share/ploticus/prefabs"))
150 (bin (string-append out "/bin")))
151 (mkdir-p dir)
152
153 ;; Install "prefabs".
154 (for-each (lambda (file)
155 (let ((target
156 (string-append dir "/"
157 (basename file))))
158 (copy-file file target)))
159 (find-files "../prefabs" "."))
160
161 ;; Allow them to be found.
162 (wrap-program (string-append bin "/pl")
163 `("PLOTICUS_PREFABS" ":" = (,dir)))))))))
164 (inputs
165 `(("libpng" ,libpng)
166 ("libx11" ,libx11)
167 ("zlib" ,zlib)))
168 (home-page "http://ploticus.sourceforge.net/")
169 (synopsis "Command-line tool for producing plots and charts")
170 (description
171 "Ploticus is a non-interactive software package for producing plots,
172charts, and graphics from data. Ploticus is good for automated or
173just-in-time graph generation, handles date and time data nicely, and has
174basic statistical capabilities. It allows significant user control over
175colors, styles, options and details.")
176 (license license:gpl2+)))
20977871
EB
177
178(define-public asymptote
179 (package
180 (name "asymptote")
891f3dc0 181 (version "2.41")
20977871
EB
182 (source (origin
183 (method url-fetch)
184 (uri (string-append "mirror://sourceforge/asymptote/"
185 version "/asymptote-" version ".src.tgz"))
186 (sha256
187 (base32
891f3dc0 188 "1w7fbq6gy65g0mxg6wdxi7v178c5yxvh9yrnv3bzm4sjzf4pwvhx"))))
20977871
EB
189 (build-system gnu-build-system)
190 ;; Note: The 'asy' binary retains a reference to docdir for use with its
191 ;; "help" command in interactive mode, so adding a "doc" output is not
192 ;; currently useful.
193 (native-inputs
fb0b9ff1 194 `(("gs" ,ghostscript) ;For tests
20977871
EB
195 ("texinfo" ,texinfo) ;For generating documentation
196 ("texlive" ,texlive) ;For tests and documentation
b8fc3622 197 ("emacs" ,emacs-minimal)
20977871
EB
198 ("perl" ,perl)))
199 (inputs
200 `(("fftw" ,fftw)
201 ("freeglut" ,freeglut)
202 ("gsl" ,gsl)
8c986ab1 203 ("libgc" ,libgc)
20977871
EB
204 ("python" ,python-2)
205 ("readline" ,readline)
206 ("zlib" ,zlib)))
207 (arguments
80ed14d3
NG
208 `(#:modules ((guix build emacs-utils)
209 (guix build gnu-build-system)
210 (guix build utils)
211 (srfi srfi-26))
212 #:imported-modules (,@%gnu-build-system-modules
213 (guix build emacs-utils))
214 #:configure-flags
20977871
EB
215 (list (string-append "--enable-gc=" (assoc-ref %build-inputs "libgc"))
216 (string-append "--with-latex="
217 (assoc-ref %outputs "out")
218 "/share/texmf/tex/latex")
219 (string-append "--with-context="
220 (assoc-ref %outputs "out")
221 "/share/texmf/tex/context/third"))
acb31b5d
NG
222 #:phases
223 (modify-phases %standard-phases
224 (add-before 'build 'patch-pdf-viewer
225 (lambda _
80ed14d3 226 ;; Default to a free pdf viewer.
acb31b5d
NG
227 (substitute* "settings.cc"
228 (("defaultPDFViewer=\"acroread\"")
80ed14d3
NG
229 "defaultPDFViewer=\"gv\""))
230 #t))
acb31b5d
NG
231 (add-before 'check 'set-HOME
232 ;; Some tests require write access to $HOME, otherwise leading to
233 ;; "failed to create directory /homeless-shelter/.asy" error.
234 (lambda _
80ed14d3
NG
235 (setenv "HOME" "/tmp")
236 #t))
237 (add-after 'install 'install-Emacs-data
238 (lambda* (#:key outputs #:allow-other-keys)
239 ;; Install related Emacs libraries into an appropriate location.
240 (let* ((out (assoc-ref outputs "out"))
241 (lisp-dir (string-append out "/share/emacs/site-lisp")))
242 (for-each (cut install-file <> lisp-dir)
243 (find-files "." "\\.el$"))
244 (emacs-generate-autoloads ,name lisp-dir))
245 #t)))))
20977871
EB
246 (home-page "http://asymptote.sourceforge.net")
247 (synopsis "Script-based vector graphics language")
248 (description
249 "Asymptote is a powerful descriptive vector graphics language for
250technical drawing, inspired by MetaPost but with an improved C++-like syntax.
251Asymptote provides for figures the same high-quality level of typesetting that
252LaTeX does for scientific text.")
253 ;; Most source files do not contain license statements, but the README
254 ;; contains: "All source files in the Asymptote project, unless explicitly
255 ;; noted otherwise, are released under version 3 (or later) of the GNU
256 ;; Lesser General Public License"
257 (license license:lgpl3+)))