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