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