gnu: Fix cross-compilation issue in guile-json
[jackhill/guix/guix.git] / gnu / packages / guile.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
4 ;;;
5 ;;; This file is part of GNU Guix.
6 ;;;
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
11 ;;;
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
16 ;;;
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20 (define-module (gnu packages guile)
21 #:use-module (guix licenses)
22 #:use-module (gnu packages)
23 #:use-module (gnu packages bash)
24 #:use-module (gnu packages bdw-gc)
25 #:use-module (gnu packages gawk)
26 #:use-module (gnu packages gperf)
27 #:use-module (gnu packages libffi)
28 #:use-module (gnu packages autotools)
29 #:use-module (gnu packages libunistring)
30 #:use-module (gnu packages m4)
31 #:use-module (gnu packages multiprecision)
32 #:use-module (gnu packages pkg-config)
33 #:use-module (gnu packages readline)
34 #:use-module (gnu packages ncurses)
35 #:use-module (gnu packages ed)
36 #:use-module (gnu packages which)
37 #:use-module (gnu packages gtk)
38 #:use-module (guix packages)
39 #:use-module (guix download)
40 #:use-module (guix build-system gnu)
41 #:use-module (guix utils)
42 #:use-module (ice-9 match))
43
44 ;;; Commentary:
45 ;;;
46 ;;; GNU Guile, and modules and extensions.
47 ;;;
48 ;;; Code:
49
50 (define-public guile-1.8
51 (package
52 (name "guile")
53 (version "1.8.8")
54 (source (origin
55 (method url-fetch)
56 (uri (string-append "mirror://gnu/guile/guile-" version
57 ".tar.gz"))
58 (sha256
59 (base32
60 "0l200a0v7h8bh0cwz6v7hc13ds39cgqsmfrks55b1rbj5vniyiy3"))
61 (patches (list (search-patch "guile-1.8-cpp-4.5.patch")))))
62 (build-system gnu-build-system)
63 (arguments '(#:configure-flags '("--disable-error-on-warning")
64
65 ;; Insert a phase before `configure' to patch things up.
66 #:phases (alist-cons-before
67 'configure
68 'patch-stuff
69 (lambda* (#:key outputs #:allow-other-keys)
70 ;; Add a call to `lt_dladdsearchdir' so that
71 ;; `libguile-readline.so' & co. are in the
72 ;; loader's search path.
73 (substitute* "libguile/dynl.c"
74 (("lt_dlinit.*$" match)
75 (format #f
76 " ~a~% lt_dladdsearchdir(\"~a/lib\");~%"
77 match
78 (assoc-ref outputs "out"))))
79
80 ;; The usual /bin/sh...
81 (substitute* "ice-9/popen.scm"
82 (("/bin/sh") (which "sh"))))
83 %standard-phases)))
84 (inputs `(("gawk" ,gawk)
85 ("readline" ,readline)))
86
87 ;; Since `guile-1.8.pc' has "Libs: ... -lgmp -lltdl", these must be
88 ;; propagated.
89 (propagated-inputs `(("gmp" ,gmp)
90 ("libtool" ,libtool)))
91
92 ;; When cross-compiling, a native version of Guile itself is needed.
93 (self-native-input? #t)
94
95 (native-search-paths
96 (list (search-path-specification
97 (variable "GUILE_LOAD_PATH")
98 (directories '("share/guile/site")))))
99
100 (synopsis "Scheme implementation intended especially for extensions")
101 (description
102 "Guile is the GNU Ubiquitous Intelligent Language for Extensions, the
103 official extension language of the GNU system. It is an implementation of
104 the Scheme language which can be easily embedded in other applications to
105 provide a convenient means of extending the functionality of the application
106 without requiring the source code to be rewritten.")
107 (home-page "http://www.gnu.org/software/guile/")
108 (license lgpl2.0+)))
109
110 (define-public guile-2.0
111 (package
112 (name "guile")
113 (version "2.0.11")
114 (source (origin
115 (method url-fetch)
116 (uri (string-append "mirror://gnu/guile/guile-" version
117 ".tar.xz"))
118 (sha256
119 (base32
120 "1qh3j7308qvsjgwf7h94yqgckpbgz2k3yqdkzsyhqcafvfka9l5f"))))
121 (build-system gnu-build-system)
122 (native-inputs `(("pkgconfig" ,pkg-config)))
123 (inputs `(("libffi" ,libffi)
124 ("readline" ,readline)
125 ("bash" ,bash)))
126
127 (propagated-inputs
128 `( ;; These ones aren't normally needed here, but since `libguile-2.0.la'
129 ;; reads `-lltdl -lunistring', adding them here will add the needed
130 ;; `-L' flags. As for why the `.la' file lacks the `-L' flags, see
131 ;; <http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/18903>.
132 ("libunistring" ,libunistring)
133 ("libtool" ,libtool)
134
135 ;; The headers and/or `guile-2.0.pc' refer to these packages, so they
136 ;; must be propagated.
137 ("bdw-gc" ,libgc)
138 ("gmp" ,gmp)))
139
140 (self-native-input? #t)
141
142 (outputs '("out" "debug"))
143
144 (arguments
145 `(#:phases (alist-cons-before
146 'configure 'pre-configure
147 (lambda* (#:key inputs #:allow-other-keys)
148 ;; Tell (ice-9 popen) the file name of Bash.
149 (let ((bash (assoc-ref inputs "bash")))
150 (substitute* "module/ice-9/popen.scm"
151 (("/bin/sh")
152 (string-append bash "/bin/bash")))))
153 %standard-phases)))
154
155 (native-search-paths
156 (list (search-path-specification
157 (variable "GUILE_LOAD_PATH")
158 (directories '("share/guile/site/2.0")))
159 (search-path-specification
160 (variable "GUILE_LOAD_COMPILED_PATH")
161 (directories '("share/guile/site/2.0")))))
162
163 (synopsis "Scheme implementation intended especially for extensions")
164 (description
165 "Guile is the GNU Ubiquitous Intelligent Language for Extensions, the
166 official extension language of the GNU system. It is an implementation of
167 the Scheme language which can be easily embedded in other applications to
168 provide a convenient means of extending the functionality of the application
169 without requiring the source code to be rewritten.")
170 (home-page "http://www.gnu.org/software/guile/")
171 (license lgpl3+)))
172
173 (define-public guile-2.0/fixed
174 ;; A package of Guile 2.0 that's rarely changed. It is the one used
175 ;; in the `base' module, and thus changing it entails a full rebuild.
176 guile-2.0)
177
178 \f
179 ;;;
180 ;;; Extensions.
181 ;;;
182
183 (define (guile-reader guile)
184 "Build Guile-Reader against GUILE, a package of some version of Guile 1.8
185 or 2.0."
186 (package
187 (name (string-append "guile-reader-for-guile_" (package-version guile)))
188 (version "0.6")
189 (source (origin
190 (method url-fetch)
191 (uri (string-append
192 "http://download-mirror.savannah.gnu.org/releases/guile-reader/guile-reader-"
193 version ".tar.gz"))
194 (sha256
195 (base32
196 "1svlyk5pm4fsdp2g7n6qffdl6fdggxnlicj0jn9s4lxd63gzxy1n"))))
197 (build-system gnu-build-system)
198 (native-inputs `(("pkgconfig" ,pkg-config)
199 ("gperf" ,gperf)))
200 (inputs `(("guile" ,guile)))
201 (arguments `(#:configure-flags
202 (let ((out (assoc-ref %outputs "out")))
203 ,(if (string-prefix? "2." (package-version guile))
204 '(list (string-append "--with-guilemoduledir="
205 out "/share/guile/site/2.0"))
206 '(list (string-append "--with-guilemoduledir="
207 out "/share/guile/site"))))))
208 (synopsis "Framework for building readers for GNU Guile")
209 (description
210 "Guile-Reader is a simple framework for building readers for GNU Guile.
211
212 The idea is to make it easy to build procedures that extend Guile’s read
213 procedure. Readers supporting various syntax variants can easily be written,
214 possibly by re-using existing “token readers” of a standard Scheme
215 readers. For example, it is used to implement Skribilo’s R5RS-derived
216 document syntax.
217
218 Guile-Reader’s approach is similar to Common Lisp’s “read table”, but
219 hopefully more powerful and flexible (for instance, one may instantiate as
220 many readers as needed).")
221 (home-page "http://www.nongnu.org/guile-reader/")
222 (license gpl3+)))
223
224 (define-public guile-reader/guile-1.8
225 ;; Guile-Reader built against Guile 1.8.
226 (guile-reader guile-1.8))
227
228 (define-public guile-reader/guile-2.0
229 ;; Guile-Reader built against Guile 2.0.
230 (guile-reader guile-2.0))
231
232 (define-public guile-ncurses
233 (package
234 (name "guile-ncurses")
235 (version "1.6")
236 (source (origin
237 (method url-fetch)
238 (uri (string-append "mirror://gnu/guile-ncurses/guile-ncurses-"
239 version ".tar.gz"))
240 (sha256
241 (base32
242 "0wmk681zzi1wxw543r2s2r84ndnzxp69kr7pc01aw4l55hg7jn73"))))
243 (build-system gnu-build-system)
244 (inputs `(("ncurses" ,ncurses)
245 ("guile" ,guile-2.0)))
246 (arguments
247 '(#:configure-flags (list "--with-ncursesw" ; Unicode support
248 (string-append "--with-guilesitedir="
249 (assoc-ref %outputs "out")
250 "/share/guile/site/2.0"))
251 #:phases (alist-cons-after
252 'install 'post-install
253 (lambda* (#:key outputs #:allow-other-keys)
254 (let* ((out (assoc-ref outputs "out"))
255 (dir (string-append out "/share/guile/site/"))
256 (files (find-files dir ".scm")))
257 (substitute* files
258 (("\"libguile-ncurses\"")
259 (format #f "\"~a/lib/libguile-ncurses\""
260 out)))))
261 %standard-phases)))
262 (home-page "http://www.gnu.org/software/guile-ncurses/")
263 (synopsis "Guile bindings to ncurses")
264 (description
265 "guile-ncurses provides Guile language bindings for the ncurses
266 library.")
267 (license lgpl3+)))
268
269 (define-public mcron
270 (package
271 (name "mcron")
272 (version "1.0.8")
273 (source (origin
274 (method url-fetch)
275 (uri (string-append "mirror://gnu/mcron/mcron-"
276 version ".tar.gz"))
277 (sha256
278 (base32
279 "0zparwgf01jgl1x53ik71ghabldq6zz18ha4dscps1i0qrzgap1b"))
280 (patches (list (search-patch "mcron-install.patch")))))
281 (build-system gnu-build-system)
282 (native-inputs `(("pkg-config" ,pkg-config)))
283 (inputs `(("ed" ,ed) ("which" ,which) ("guile" ,guile-2.0)))
284 (home-page "http://www.gnu.org/software/mcron/")
285 (synopsis "Run jobs at scheduled times")
286 (description
287 "GNU Mcron is a complete replacement for Vixie cron. It is used to run
288 tasks on a schedule, such as every hour or every Monday. Mcron is written in
289 Guile, so its configuration can be written in Scheme; the original cron
290 format is also supported.")
291 (license gpl3+)))
292
293 (define-public guile-lib
294 (package
295 (name "guile-lib")
296 (version "0.2.2")
297 (source (origin
298 (method url-fetch)
299 (uri (string-append "mirror://savannah/guile-lib/guile-lib-"
300 version ".tar.gz"))
301 (sha256
302 (base32
303 "1f9n2b5b5r75lzjinyk6zp6g20g60msa0jpfrk5hhg4j8cy0ih4b"))))
304 (build-system gnu-build-system)
305 (arguments
306 '(#:phases (alist-cons-before
307 'configure 'patch-module-dir
308 (lambda _
309 (substitute* "src/Makefile.in"
310 (("^moddir[[:blank:]]*=[[:blank:]]*([[:graph:]]+)" _ rhs)
311 (string-append "moddir = " rhs "/2.0\n"))))
312 %standard-phases)))
313 (inputs `(("guile" ,guile-2.0)))
314 (home-page "http://www.nongnu.org/guile-lib/")
315 (synopsis "Collection of useful Guile Scheme modules")
316 (description
317 "Guile-Lib is intended as an accumulation place for pure-scheme Guile
318 modules, allowing for people to cooperate integrating their generic Guile
319 modules into a coherent library. Think \"a down-scaled, limited-scope CPAN
320 for Guile\".")
321
322 ;; The whole is under GPLv3+, but some modules are under laxer
323 ;; distribution terms such as LGPL and public domain. See `COPYING' for
324 ;; details.
325 (license gpl3+)))
326
327 (define-public guile-json
328 (package
329 (name "guile-json")
330 (version "0.4.0")
331 (source (origin
332 (method url-fetch)
333 (uri (string-append "mirror://savannah/guile-json/guile-json-"
334 version ".tar.gz"))
335 (sha256
336 (base32
337 "0v06272rw4ycwzssjf3fzpk2vhpslvl55hz94q80vc6f74j0d5h6"))
338 (modules '((guix build utils)))
339 (snippet
340 ;; Make sure everything goes under .../site/2.0, like Guile's
341 ;; search paths expects.
342 '(substitute* '("Makefile.in" "json/Makefile.in")
343 (("moddir =.*/share/guile/site" all)
344 (string-append all "/2.0"))))))
345 (build-system gnu-build-system)
346 (native-inputs `(("guile" ,guile-2.0)))
347 (home-page "http://savannah.nongnu.org/projects/guile-json/")
348 (synopsis "JSON module for Guile")
349 (description
350 "Guile-json supports parsing and building JSON documents according to the
351 http:://json.org specification. These are the main features:
352 - Strictly complies to http://json.org specification.
353 - Build JSON documents programmatically via macros.
354 - Unicode support for strings.
355 - Allows JSON pretty printing.")
356 (license lgpl3+)))
357
358 (define-public guile-charting
359 (package
360 (name "guile-charting")
361 (version "0.2.0")
362 (source (origin
363 (method url-fetch)
364 (uri (string-append "http://wingolog.org/pub/guile-charting/"
365 "guile-charting-" version ".tar.gz"))
366 (sha256
367 (base32
368 "0w5qiyv9v0ip5li22x762bm48g8xnw281w66iyw094zdw611pb2m"))
369 (modules '((guix build utils)))
370 (snippet
371 '(begin
372 ;; Use the standard location for modules.
373 (substitute* "Makefile.in"
374 (("godir = .*$")
375 "godir = $(moddir)\n"))))))
376 (build-system gnu-build-system)
377 (native-inputs `(("pkg-config" ,pkg-config)))
378 (inputs `(("guile" ,guile-2.0)))
379 (propagated-inputs `(("guile-cairo" ,guile-cairo)))
380 (home-page "http://wingolog.org/software/guile-charting/")
381 (synopsis "Create charts and graphs in Guile")
382 (description
383 "Guile-Charting is a Guile Scheme library to create bar charts and graphs
384 using the Cairo drawing library.")
385 (license lgpl2.1+)))
386
387 ;;; guile.scm ends here