distro: Rename (distro) to (gnu packages).
[jackhill/guix/guix.git] / gnu / packages / guile.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012 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 bdw-gc)
23 #:use-module (gnu packages gawk)
24 #:use-module (gnu packages gperf)
25 #:use-module (gnu packages libffi)
26 #:use-module (gnu packages autotools)
27 #:use-module (gnu packages libunistring)
28 #:use-module (gnu packages m4)
29 #:use-module (gnu packages multiprecision)
30 #:use-module (gnu packages pkg-config)
31 #:use-module (gnu packages readline)
32 #:use-module (guix packages)
33 #:use-module (guix download)
34 #:use-module (guix build-system gnu))
35
36 ;;; Commentary:
37 ;;;
38 ;;; GNU Guile, and modules and extensions.
39 ;;;
40 ;;; Code:
41
42 (define-public guile-1.8
43 (package
44 (name "guile")
45 (version "1.8.8")
46 (source (origin
47 (method url-fetch)
48 (uri (string-append "mirror://gnu/guile/guile-" version
49 ".tar.gz"))
50 (sha256
51 (base32
52 "0l200a0v7h8bh0cwz6v7hc13ds39cgqsmfrks55b1rbj5vniyiy3"))))
53 (build-system gnu-build-system)
54 (arguments '(#:configure-flags '("--disable-error-on-warning")
55 #:patches (list (assoc-ref %build-inputs "patch/snarf"))
56
57 ;; Insert a phase before `configure' to patch things up.
58 #:phases (alist-cons-before
59 'configure
60 'patch-loader-search-path
61 (lambda* (#:key outputs #:allow-other-keys)
62 ;; Add a call to `lt_dladdsearchdir' so that
63 ;; `libguile-readline.so' & co. are in the
64 ;; loader's search path.
65 (substitute* "libguile/dynl.c"
66 (("lt_dlinit.*$" match)
67 (format #f
68 " ~a~% lt_dladdsearchdir(\"~a/lib\");~%"
69 match
70 (assoc-ref outputs "out")))))
71 %standard-phases)))
72 (inputs `(("patch/snarf" ,(search-patch "guile-1.8-cpp-4.5.patch"))
73 ("gawk" ,gawk)
74 ("readline" ,readline)))
75
76 ;; Since `guile-1.8.pc' has "Libs: ... -lgmp -lltdl", these must be
77 ;; propagated.
78 (propagated-inputs `(("gmp" ,gmp)
79 ("libtool" ,libtool)))
80
81 ;; When cross-compiling, a native version of Guile itself is needed.
82 (self-native-input? #t)
83
84 (synopsis "GNU Guile 1.8, an embeddable Scheme interpreter")
85 (description
86 "GNU Guile 1.8 is an interpreter for the Scheme programming language,
87 packaged as a library that can be embedded into programs to make them
88 extensible. It supports many SRFIs.")
89 (home-page "http://www.gnu.org/software/guile/")
90 (license lgpl2.0+)))
91
92 (define-public guile-2.0
93 (package
94 (name "guile")
95 (version "2.0.7")
96 (source (origin
97 (method url-fetch)
98 (uri (string-append "mirror://gnu/guile/guile-" version
99 ".tar.xz"))
100 (sha256
101 (base32
102 "0f53pxkia4v17n0avwqlcjpy0n89hkazm2xsa6p84lv8k6k8y9vg"))))
103 (build-system gnu-build-system)
104 (native-inputs `(("pkgconfig" ,pkg-config)))
105 (inputs `(("libffi" ,libffi)
106 ("readline" ,readline)))
107
108 (propagated-inputs
109 `( ;; These ones aren't normally needed here, but since `libguile-2.0.la'
110 ;; reads `-lltdl -lunistring', adding them here will add the needed
111 ;; `-L' flags. As for why the `.la' file lacks the `-L' flags, see
112 ;; <http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/18903>.
113 ("libunistring" ,libunistring)
114 ("libtool" ,libtool)
115
116 ;; The headers and/or `guile-2.0.pc' refer to these packages, so they
117 ;; must be propagated.
118 ("bdw-gc" ,libgc)
119 ("gmp" ,gmp)))
120
121 (self-native-input? #t)
122
123 (arguments
124 '(#:phases (alist-cons-before
125 'configure 'pre-configure
126 (lambda* (#:key inputs #:allow-other-keys)
127 (let ((bash (assoc-ref inputs "bash")))
128 (substitute* "module/ice-9/popen.scm"
129 (("/bin/sh")
130 (string-append bash "/bin/bash")))))
131 %standard-phases)))
132
133 (synopsis "GNU Guile 2.0, an embeddable Scheme implementation")
134 (description
135 "GNU Guile is an implementation of the Scheme programming language, with
136 support for many SRFIs, packaged for use in a wide variety of environments.
137 In addition to implementing the R5RS Scheme standard and a large subset of
138 R6RS, Guile includes a module system, full access to POSIX system calls,
139 networking support, multiple threads, dynamic linking, a foreign function
140 call interface, and powerful string processing.")
141 (home-page "http://www.gnu.org/software/guile/")
142 (license lgpl3+)))
143
144 (define-public guile-2.0/fixed
145 ;; A package of Guile 2.0 that's rarely changed. It is the one used
146 ;; in the `base' module, and thus changing it entails a full rebuild.
147 guile-2.0)
148
149 \f
150 ;;;
151 ;;; Extensions.
152 ;;;
153
154 (define (guile-reader guile)
155 "Build Guile-Reader against GUILE, a package of some version of Guile 1.8
156 or 2.0."
157 (package
158 (name (string-append "guile-reader-for-guile-" (package-version guile)))
159 (version "0.6")
160 (source (origin
161 (method url-fetch)
162 (uri (string-append
163 "http://download-mirror.savannah.gnu.org/releases/guile-reader/guile-reader-"
164 version ".tar.gz"))
165 (sha256
166 (base32
167 "1svlyk5pm4fsdp2g7n6qffdl6fdggxnlicj0jn9s4lxd63gzxy1n"))))
168 (build-system gnu-build-system)
169 (native-inputs `(("pkgconfig" ,pkg-config)
170 ("gperf" ,gperf)))
171 (inputs `(("guile" ,guile)))
172 (synopsis "Guile-Reader, a simple framework for building readers for
173 GNU Guile")
174 (description
175 "Guile-Reader is a simple framework for building readers for GNU Guile.
176
177 The idea is to make it easy to build procedures that extend Guile’s read
178 procedure. Readers supporting various syntax variants can easily be written,
179 possibly by re-using existing “token readers” of a standard Scheme
180 readers. For example, it is used to implement Skribilo’s R5RS-derived
181 document syntax.
182
183 Guile-Reader’s approach is similar to Common Lisp’s “read table”, but
184 hopefully more powerful and flexible (for instance, one may instantiate as
185 many readers as needed).")
186 (home-page "http://www.nongnu.org/guile-reader/")
187 (license gpl3+)))
188
189 (define-public guile-reader/guile-1.8
190 ;; Guile-Reader built against Guile 1.8.
191 (guile-reader guile-1.8))
192
193 (define-public guile-reader/guile-2.0
194 ;; Guile-Reader built against Guile 2.0.
195 (guile-reader guile-2.0))
196
197 ;;; guile.scm ends here