gnu: mit-scheme: Update to 9.2.
[jackhill/guix/guix.git] / gnu / packages / scheme.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 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 scheme)
20 #:use-module (gnu packages)
21 #:use-module (guix licenses)
22 #:use-module (guix packages)
23 #:use-module (guix download)
24 #:use-module (guix build-system gnu)
25 #:use-module (gnu packages m4)
26 #:use-module (gnu packages multiprecision)
27 #:use-module (gnu packages emacs)
28 #:use-module (gnu packages texinfo)
29 #:use-module (gnu packages elf)
30 #:use-module (gnu packages which)
31 #:use-module (gnu packages pkg-config)
32 #:use-module (gnu packages avahi)
33 #:use-module (gnu packages libphidget)
34 #:use-module (gnu packages glib)
35 #:use-module (gnu packages gtk)
36 #:use-module (gnu packages libffi)
37 #:use-module (gnu packages image)
38 #:use-module (ice-9 match))
39
40 (define-public mit-scheme
41 (package
42 (name "mit-scheme")
43 (version "9.2")
44 (source #f) ; see below
45 (build-system gnu-build-system)
46 (arguments
47 `(#:tests? #f ; no "check" target
48 #:phases
49 (alist-replace
50 'unpack
51 (lambda* (#:key inputs #:allow-other-keys)
52 (and (zero? (system* "tar" "xzvf"
53 (assoc-ref inputs "source")))
54 (chdir ,(string-append name "-" version))
55 (begin
56 ;; Delete these dangling symlinks since they break
57 ;; `patch-shebangs'.
58 (for-each delete-file
59 (cons "src/lib/shim-config.scm"
60 (find-files "src/lib/lib" "\\.so$")))
61 (chdir "src")
62 #t)))
63 (alist-replace
64 'build
65 (lambda* (#:key system outputs #:allow-other-keys)
66 (let ((out (assoc-ref outputs "out")))
67 (if (or (string-prefix? "x86_64" system)
68 (string-prefix? "i686" system))
69 (zero? (system* "make" "compile-microcode"))
70 (zero? (system* "./etc/make-liarc.sh"
71 (string-append "--prefix=" out))))))
72 %standard-phases))))
73 (inputs
74 `(;; TODO: Build doc when TeX Live is available.
75 ;; ("automake" ,automake)
76 ;; ("texlive-core" ,texlive-core)
77 ("texinfo" ,texinfo)
78 ("m4" ,m4)
79
80 ("source"
81
82 ;; MIT/GNU Scheme is not bootstrappable, so it's recommended to
83 ;; compile from the architecture-specific tarballs, which contain
84 ;; pre-built binaries. It leads to more efficient code than when
85 ;; building the tarball that contains generated C code instead of
86 ;; those binaries.
87 ,(origin
88 (method url-fetch)
89 (uri (string-append "mirror://gnu/mit-scheme/stable.pkg/"
90 version "/mit-scheme-"
91 version "-"
92 (match (%current-system)
93 ("x86_64-linux" "x86-64")
94 ("i686-linux" "i386")
95 (_ "c"))
96 ".tar.gz"))
97 (sha256
98 (match (%current-system)
99 ("x86_64-linux"
100 (base32
101 "1skzxxhr0iq96bf0j5m7mvf3i4sppfyfa6gpqn34mwgkw1fx8274"))
102 ("i686-linux"
103 (base32
104 "1fmlpnhf5a75db93phajh4ysbdgrgl72v45lk3kznriprl0a7jc6"))
105 (_
106 (base32
107 "0w5ib5vsidihb4hb6fma3sp596ykr8izagm57axvgd6lqzwicsjg"))))))))
108 (home-page "http://www.gnu.org/software/mit-scheme/")
109 (synopsis "Scheme implementation with integrated editor and debugger")
110 (description
111 "GNU/MIT Scheme is an implementation of the Scheme programming
112 language. It provides an interpreter, a compiler and a debugger. It also
113 features an integrated Emacs-like editor and a large runtime library.")
114 (license gpl2+)))
115
116 (define-public bigloo
117 (package
118 (name "bigloo")
119 (version "4.1a")
120 (source (origin
121 (method url-fetch)
122 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Bigloo/bigloo"
123 version ".tar.gz"))
124 (sha256
125 (base32
126 "170q7nh08n4v20xl81fxb0xcdxphqqacfa643hsa8i2ar6pki04c"))
127 (patches (list (search-patch "bigloo-gc-shebangs.patch")))))
128 (build-system gnu-build-system)
129 (arguments
130 `(#:test-target "test"
131 #:phases (alist-replace
132 'configure
133 (lambda* (#:key outputs #:allow-other-keys)
134
135 (substitute* "configure"
136 (("^shell=.*$")
137 (string-append "shell=" (which "bash") "\n")))
138
139 ;; Since libgc's pthread redirects are used, we end up
140 ;; using libgc symbols, so we must link against it.
141 ;; Reported on 2013-06-25.
142 (substitute* "api/pthread/src/Makefile"
143 (("^EXTRALIBS[[:blank:]]*=(.*)$" _ value)
144 (string-append "EXTRALIBS = "
145 (string-trim-right value)
146 " -l$(GCLIB)_fth-$(RELEASE)"
147 " -Wl,-rpath=" (assoc-ref outputs "out")
148 "/lib/bigloo/" ,version)))
149
150 ;; Those variables are used by libgc's `configure'.
151 (setenv "SHELL" (which "sh"))
152 (setenv "CONFIG_SHELL" (which "sh"))
153
154 ;; ... but they turned out to be overridden later, so work
155 ;; around that.
156 (substitute* (find-files "gc" "^configure-gc")
157 (("sh=/bin/sh")
158 (string-append "sh=" (which "sh"))))
159
160 ;; The `configure' script doesn't understand options
161 ;; of those of Autoconf.
162 (let ((out (assoc-ref outputs "out")))
163 (zero?
164 (system* "./configure"
165 (string-append "--prefix=" out)
166 ;; FIXME: Currently fails, see
167 ;; <http://article.gmane.org/gmane.lisp.scheme.bigloo/6126>.
168 ;; "--customgc=no" ; use our libgc
169 (string-append"--mv=" (which "mv"))
170 (string-append "--rm=" (which "rm"))))))
171 (alist-cons-after
172 'install 'install-emacs-modes
173 (lambda* (#:key outputs #:allow-other-keys)
174 (let* ((out (assoc-ref outputs "out"))
175 (dir (string-append out "/share/emacs/site-lisp")))
176 (zero? (system* "make" "-C" "bmacs" "all" "install"
177 (string-append "EMACSBRAND=emacs24")
178 (string-append "EMACSDIR=" dir)))))
179 %standard-phases))))
180 (inputs
181 `(("emacs" ,emacs)
182
183 ;; Optional APIs for which Bigloo has bindings.
184 ("avahi" ,avahi)
185 ("libphidget" ,libphidget)))
186 (native-inputs
187 `(("pkg-config" ,pkg-config)))
188 (propagated-inputs
189 `(("gmp" ,gmp))) ; bigloo.h refers to gmp.h
190 (home-page "http://www-sop.inria.fr/indes/fp/Bigloo/")
191 (synopsis "Bigloo, an efficient Scheme compiler")
192 (description
193 "Bigloo is a Scheme implementation devoted to one goal: enabling
194 Scheme based programming style where C(++) is usually
195 required. Bigloo attempts to make Scheme practical by offering
196 features usually presented by traditional programming languages
197 but not offered by Scheme and functional programming. Bigloo
198 compiles Scheme modules. It delivers small and fast stand alone
199 binary executables. Bigloo enables full connections between
200 Scheme and C programs and between Scheme and Java programs.")
201 (license gpl2+)))
202
203 (define-public hop
204 (package
205 (name "hop")
206 (version "2.4.0")
207 (source (origin
208 (method url-fetch)
209 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Hop/hop-"
210 version ".tar.gz"))
211 (sha256
212 (base32
213 "1v2r4ga58kk1sx0frn8qa8ccmjpic9csqzpk499wc95y9c4b1wy3"))
214 (patches (list (search-patch "hop-bigloo-4.0b.patch")))))
215 (build-system gnu-build-system)
216 (arguments
217 '(#:phases
218 (alist-replace
219 'configure
220 (lambda* (#:key inputs outputs #:allow-other-keys)
221 (let ((out (assoc-ref outputs "out")))
222 (zero?
223 (system* "./configure"
224 (string-append "--prefix=" out)))))
225 (alist-cons-after
226 'strip 'patch-rpath
227 (lambda* (#:key outputs #:allow-other-keys)
228 ;; Patch the RPATH of every installed library to point to $out/lib
229 ;; instead of $TMPDIR. Note that "patchelf --set-rpath" produces
230 ;; invalid binaries when used before stripping.
231 (let ((out (assoc-ref outputs "out"))
232 (tmpdir (getcwd)))
233 (every (lambda (lib)
234 (let* ((in (open-pipe* OPEN_READ "patchelf"
235 "--print-rpath" lib))
236 (rpath (read-line in)))
237 (and (zero? (close-pipe in))
238 (let ((rpath* (regexp-substitute/global
239 #f (regexp-quote tmpdir) rpath
240 'pre out 'post)))
241 (or (equal? rpath rpath*)
242 (begin
243 (format #t "~a: changing RPATH from `~a' to `~a'~%"
244 lib rpath rpath*)
245 (zero?
246 (system* "patchelf" "--set-rpath"
247 rpath* lib))))))))
248 (append (find-files (string-append out "/bin")
249 ".*")
250 (find-files (string-append out "/lib")
251 "\\.so$")))))
252 %standard-phases))
253 #:tests? #f ; no test suite
254 #:modules ((guix build gnu-build-system)
255 (guix build utils)
256 (ice-9 popen)
257 (ice-9 regex)
258 (ice-9 rdelim)
259 (srfi srfi-1))))
260 (inputs `(("bigloo" ,bigloo)
261 ("which" ,which)
262 ("patchelf" ,patchelf)))
263 (home-page "http://hop.inria.fr/")
264 (synopsis "Multi-tier programming language for the Web 2.0")
265 (description
266 "HOP is a multi-tier programming language for the Web 2.0 and the
267 so-called diffuse Web. It is designed for programming interactive web
268 applications in many fields such as multimedia (web galleries, music players,
269 ...), ubiquitous and house automation (SmartPhones, personal appliance),
270 mashups, office (web agendas, mail clients, ...), etc.")
271 (license gpl2+)))
272
273 (define-public chicken
274 (package
275 (name "chicken")
276 (version "4.8.0.3")
277 (source (origin
278 (method url-fetch)
279 (uri (string-append "http://code.call-cc.org/releases/4.8.0/chicken-"
280 version ".tar.gz"))
281 (sha256
282 (base32
283 "1hwrnc2dhgbnz3mlpcb4qvg76kwsfzqylw24gxyy91jmygk1853a"))))
284 (build-system gnu-build-system)
285 (arguments
286 `(#:modules ((guix build gnu-build-system)
287 (guix build utils)
288 (srfi srfi-1))
289
290 ;; No `configure' script; run "make check" after "make install" as
291 ;; prescribed by README.
292 #:phases (alist-cons-after
293 'install 'check
294 (assoc-ref %standard-phases 'check)
295 (fold alist-delete %standard-phases
296 '(configure check)))
297
298 #:make-flags (let ((out (assoc-ref %outputs "out")))
299 (list "PLATFORM=linux"
300 (string-append "PREFIX=" out)
301 (string-append "VARDIR=" out "/var/lib")))
302
303 ;; Parallel builds are not supported, as noted in README.
304 #:parallel-build? #f))
305 (home-page "http://www.call-cc.org/")
306 (synopsis "R5RS Scheme implementation that compiles native code via C")
307 (description
308 "CHICKEN is a compiler for the Scheme programming language. CHICKEN
309 produces portable and efficient C, supports almost all of the R5RS Scheme
310 language standard, and includes many enhancements and extensions.")
311 (license bsd-3)))
312
313 (define-public scheme48
314 (package
315 (name "scheme48")
316 (version "1.9")
317 (source (origin
318 (method url-fetch)
319 (uri (string-append "http://s48.org/" version
320 "/scheme48-" version ".tgz"))
321 (sha256
322 (base32
323 "0rw2lz5xgld0klvld292ds6hvfk5l12vskzgf1hhwjdpa38r3fnw"))
324 (patches (list (search-patch "scheme48-tests.patch")))))
325 (build-system gnu-build-system)
326 (home-page "http://s48.org/")
327 (synopsis "Scheme implementation using a bytecode interpreter")
328 (description
329 "Scheme 48 is an implementation of Scheme based on a byte-code
330 interpreter and is designed to be used as a testbed for experiments in
331 implementation techniques and as an expository tool.")
332
333 ;; Most files are BSD-3; see COPYING for the few exceptions.
334 (license bsd-3)))
335
336 (define-public racket
337 (package
338 (name "racket")
339 (version "5.3.4")
340 (source (origin
341 (method url-fetch)
342 (uri (list (string-append "http://download.racket-lang.org/installers/"
343 version "/racket/racket-" version
344 "-src-unix.tgz")
345 (string-append
346 "http://mirror.informatik.uni-tuebingen.de/mirror/racket/"
347 version "/racket/racket-" version "-src-unix.tgz")))
348 (sha256
349 ;; XXX: Used to be 1xhnx3yd74zrvn6sfcqmk57kxj51cwvm660dwiaxr1qxnm5lq0v7.
350 (base32 "0yrdmpdvzf092869y6zjjjxl6j2kypgiv7qrfkv7lj8w01pbh7sd"))))
351 (build-system gnu-build-system)
352 (arguments
353 '(#:phases
354 (let* ((gui-libs
355 (lambda (inputs)
356 (define (lib input)
357 (string-append (assoc-ref inputs input) "/lib"))
358
359 (list (lib "glib")
360 (lib "cairo")
361 (lib "pango")
362 (lib "libjpeg")
363 (lib "gtk")
364 (lib "gdk-pixbuf")))))
365 (alist-cons-before
366 'configure 'pre-configure
367 (lambda* (#:key inputs #:allow-other-keys)
368 (chdir "src")
369
370 ;; The GUI libs are dynamically opened through the FFI, so they
371 ;; must be in the loader's search path.
372 (setenv "LD_LIBRARY_PATH" (string-join (gui-libs inputs) ":")))
373 (alist-cons-after
374 'unpack 'patch-/bin/sh
375 (lambda _
376 (substitute* "collects/racket/system.rkt"
377 (("/bin/sh") (which "sh"))))
378 (alist-cons-after
379 'install 'wrap-programs
380 (lambda* (#:key inputs outputs #:allow-other-keys)
381 (let ((out (assoc-ref outputs "out")))
382 (define (wrap prog)
383 (wrap-program prog
384 `("LD_LIBRARY_PATH" ":" prefix
385 ,(gui-libs inputs))))
386
387 (with-directory-excursion (string-append out "/bin")
388 (for-each wrap
389 (list "gracket" "drracket" "slideshow" "mred"))
390 #t)))
391 %standard-phases))))
392 #:tests? #f ; XXX: how to run them?
393 ))
394 (inputs `(("libffi" ,libffi)
395 ("glib" ,glib) ; for DrRacket
396 ("cairo" ,cairo)
397 ("pango" ,pango)
398 ("libjpeg" ,libjpeg-8)
399 ("gdk-pixbuf" ,gdk-pixbuf)
400 ("gtk" ,gtk+-2)))
401 (home-page "http://racket-lang.org")
402 (synopsis "Implementation of Scheme and related languages")
403 (description
404 "Racket is an implementation of the Scheme programming language (R5RS and
405 R6RS) and related languages, such as Typed Racket. It features a compiler and
406 a virtual machine with just-in-time native compilation, as well as a large set
407 of libraries.")
408 (license lgpl2.0+)))