Merge branch 'core-updates'
[jackhill/guix/guix.git] / gnu / packages / scheme.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
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 scheme)
21 #:use-module (gnu packages)
22 #:use-module (guix licenses)
23 #:use-module (guix packages)
24 #:use-module (guix download)
25 #:use-module (guix utils)
26 #:use-module (guix build-system gnu)
27 #:use-module (gnu packages m4)
28 #:use-module (gnu packages multiprecision)
29 #:use-module (gnu packages databases)
30 #:use-module (gnu packages emacs)
31 #:use-module (gnu packages texinfo)
32 #:use-module (gnu packages elf)
33 #:use-module (gnu packages base)
34 #:use-module (gnu packages pkg-config)
35 #:use-module (gnu packages avahi)
36 #:use-module (gnu packages libphidget)
37 #:use-module (gnu packages glib)
38 #:use-module (gnu packages gtk)
39 #:use-module (gnu packages libffi)
40 #:use-module (gnu packages fontutils)
41 #:use-module (gnu packages image)
42 #:use-module (ice-9 match))
43
44 (define (mit-scheme-source-directory system version)
45 (string-append "mit-scheme-"
46 (if (or (string-prefix? "x86_64" system)
47 (string-prefix? "i686" system))
48 ""
49 "c-")
50 version))
51
52 (define-public mit-scheme
53 (package
54 (name "mit-scheme")
55 (version "9.2")
56 (source #f) ; see below
57 (build-system gnu-build-system)
58 (arguments
59 `(#:tests? #f ; no "check" target
60 #:phases
61 (alist-replace
62 'unpack
63 (lambda* (#:key inputs #:allow-other-keys)
64 (and (zero? (system* "tar" "xzvf"
65 (assoc-ref inputs "source")))
66 (chdir ,(mit-scheme-source-directory (%current-system)
67 version))
68 (begin
69 ;; Delete these dangling symlinks since they break
70 ;; `patch-shebangs'.
71 (for-each delete-file
72 (append '("src/lib/shim-config.scm")
73 (find-files "src/lib/lib" "\\.so$")
74 (find-files "src/lib" "^liarc-")
75 (find-files "src/compiler" "^make\\.")))
76 (chdir "src")
77 #t)))
78 (alist-replace
79 'build
80 (lambda* (#:key system outputs #:allow-other-keys)
81 (let ((out (assoc-ref outputs "out")))
82 (if (or (string-prefix? "x86_64" system)
83 (string-prefix? "i686" system))
84 (zero? (system* "make" "compile-microcode"))
85 (zero? (system* "./etc/make-liarc.sh"
86 (string-append "--prefix=" out))))))
87 %standard-phases))))
88 (inputs
89 `(;; TODO: Build doc when TeX Live is available.
90 ;; ("automake" ,automake)
91 ;; ("texlive-core" ,texlive-core)
92 ("texinfo" ,texinfo)
93 ("m4" ,m4)
94
95 ("source"
96
97 ;; MIT/GNU Scheme is not bootstrappable, so it's recommended to
98 ;; compile from the architecture-specific tarballs, which contain
99 ;; pre-built binaries. It leads to more efficient code than when
100 ;; building the tarball that contains generated C code instead of
101 ;; those binaries.
102 ,(origin
103 (method url-fetch)
104 (uri (string-append "mirror://gnu/mit-scheme/stable.pkg/"
105 version "/mit-scheme-"
106 (match (%current-system)
107 ("x86_64-linux"
108 (string-append version "-x86-64"))
109 ("i686-linux"
110 (string-append version "-i386"))
111 (_
112 (string-append "c-" version)))
113 ".tar.gz"))
114 (sha256
115 (match (%current-system)
116 ("x86_64-linux"
117 (base32
118 "1skzxxhr0iq96bf0j5m7mvf3i4sppfyfa6gpqn34mwgkw1fx8274"))
119 ("i686-linux"
120 (base32
121 "1fmlpnhf5a75db93phajh4ysbdgrgl72v45lk3kznriprl0a7jc6"))
122 (_
123 (base32
124 "0w5ib5vsidihb4hb6fma3sp596ykr8izagm57axvgd6lqzwicsjg"))))))))
125
126 ;; Fails to build on MIPS, see <http://bugs.gnu.org/18221>.
127 (supported-systems (delete "mips64el-linux" %supported-systems))
128
129 (home-page "http://www.gnu.org/software/mit-scheme/")
130 (synopsis "A Scheme implementation with integrated editor and debugger")
131 (description
132 "GNU/MIT Scheme is an implementation of the Scheme programming
133 language. It provides an interpreter, a compiler and a debugger. It also
134 features an integrated Emacs-like editor and a large runtime library.")
135 (license gpl2+)))
136
137 (define-public bigloo
138 (package
139 (name "bigloo")
140 (version "4.1a")
141 (source (origin
142 (method url-fetch)
143 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Bigloo/bigloo"
144 version ".tar.gz"))
145 (sha256
146 (base32
147 "170q7nh08n4v20xl81fxb0xcdxphqqacfa643hsa8i2ar6pki04c"))
148 (patches (list (search-patch "bigloo-gc-shebangs.patch")))))
149 (build-system gnu-build-system)
150 (arguments
151 `(#:test-target "test"
152 #:phases (alist-replace
153 'configure
154 (lambda* (#:key outputs #:allow-other-keys)
155
156 (substitute* "configure"
157 (("^shell=.*$")
158 (string-append "shell=" (which "bash") "\n")))
159
160 ;; Since libgc's pthread redirects are used, we end up
161 ;; using libgc symbols, so we must link against it.
162 ;; Reported on 2013-06-25.
163 (substitute* "api/pthread/src/Makefile"
164 (("^EXTRALIBS[[:blank:]]*=(.*)$" _ value)
165 (string-append "EXTRALIBS = "
166 (string-trim-right value)
167 " -l$(GCLIB)_fth-$(RELEASE)"
168 " -Wl,-rpath=" (assoc-ref outputs "out")
169 "/lib/bigloo/" ,version)))
170
171 ;; Those variables are used by libgc's `configure'.
172 (setenv "SHELL" (which "sh"))
173 (setenv "CONFIG_SHELL" (which "sh"))
174
175 ;; ... but they turned out to be overridden later, so work
176 ;; around that.
177 (substitute* (find-files "gc" "^configure-gc")
178 (("sh=/bin/sh")
179 (string-append "sh=" (which "sh"))))
180
181 ;; The `configure' script doesn't understand options
182 ;; of those of Autoconf.
183 (let ((out (assoc-ref outputs "out")))
184 (zero?
185 (system* "./configure"
186 (string-append "--prefix=" out)
187 ;; FIXME: Currently fails, see
188 ;; <http://article.gmane.org/gmane.lisp.scheme.bigloo/6126>.
189 ;; "--customgc=no" ; use our libgc
190 (string-append"--mv=" (which "mv"))
191 (string-append "--rm=" (which "rm"))
192 (string-append "--ldflags=-Wl,-rpath="
193 (assoc-ref outputs "out")
194 "/lib/bigloo/" ,version)))))
195 (alist-cons-after
196 'install 'install-emacs-modes
197 (lambda* (#:key outputs #:allow-other-keys)
198 (let* ((out (assoc-ref outputs "out"))
199 (dir (string-append out "/share/emacs/site-lisp")))
200 (zero? (system* "make" "-C" "bmacs" "all" "install"
201 (string-append "EMACSBRAND=emacs24")
202 (string-append "EMACSDIR=" dir)))))
203 %standard-phases))))
204 (inputs
205 `(("emacs" ,emacs) ;UDE needs the X version of Emacs
206
207 ;; Optional APIs for which Bigloo has bindings.
208 ("avahi" ,avahi)
209 ("libphidget" ,libphidget)))
210 (native-inputs
211 `(("pkg-config" ,pkg-config)))
212 (propagated-inputs
213 `(("gmp" ,gmp))) ; bigloo.h refers to gmp.h
214 (home-page "http://www-sop.inria.fr/indes/fp/Bigloo/")
215 (synopsis "Efficient Scheme compiler")
216 (description
217 "Bigloo is a Scheme implementation devoted to one goal: enabling
218 Scheme based programming style where C(++) is usually
219 required. Bigloo attempts to make Scheme practical by offering
220 features usually presented by traditional programming languages
221 but not offered by Scheme and functional programming. Bigloo
222 compiles Scheme modules. It delivers small and fast stand alone
223 binary executables. Bigloo enables full connections between
224 Scheme and C programs and between Scheme and Java programs.")
225 (license gpl2+)))
226
227 (define-public hop
228 (package
229 (name "hop")
230 (version "2.4.0")
231 (source (origin
232 (method url-fetch)
233 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Hop/hop-"
234 version ".tar.gz"))
235 (sha256
236 (base32
237 "1v2r4ga58kk1sx0frn8qa8ccmjpic9csqzpk499wc95y9c4b1wy3"))
238 (patches (list (search-patch "hop-bigloo-4.0b.patch")))))
239 (build-system gnu-build-system)
240 (arguments
241 '(#:phases
242 (alist-replace
243 'configure
244 (lambda* (#:key inputs outputs #:allow-other-keys)
245 (let ((out (assoc-ref outputs "out")))
246 (zero?
247 (system* "./configure"
248 (string-append "--prefix=" out)))))
249 (alist-cons-after
250 'strip 'patch-rpath
251 (lambda* (#:key outputs #:allow-other-keys)
252 ;; Patch the RPATH of every installed library to point to $out/lib
253 ;; instead of $TMPDIR. Note that "patchelf --set-rpath" produces
254 ;; invalid binaries when used before stripping.
255 (let ((out (assoc-ref outputs "out"))
256 (tmpdir (getcwd)))
257 (every (lambda (lib)
258 (let* ((in (open-pipe* OPEN_READ "patchelf"
259 "--print-rpath" lib))
260 (rpath (read-line in)))
261 (and (zero? (close-pipe in))
262 (let ((rpath* (regexp-substitute/global
263 #f (regexp-quote tmpdir) rpath
264 'pre out 'post)))
265 (or (equal? rpath rpath*)
266 (begin
267 (format #t "~a: changing RPATH from `~a' to `~a'~%"
268 lib rpath rpath*)
269 (zero?
270 (system* "patchelf" "--set-rpath"
271 rpath* lib))))))))
272 (append (find-files (string-append out "/bin")
273 ".*")
274 (find-files (string-append out "/lib")
275 "\\.so$")))))
276 %standard-phases))
277 #:tests? #f ; no test suite
278 #:modules ((guix build gnu-build-system)
279 (guix build utils)
280 (ice-9 popen)
281 (ice-9 regex)
282 (ice-9 rdelim)
283 (srfi srfi-1))))
284 (inputs `(("bigloo" ,bigloo)
285 ("which" ,which)
286 ("patchelf" ,patchelf)))
287 (home-page "http://hop.inria.fr/")
288 (synopsis "Multi-tier programming language for the Web 2.0")
289 (description
290 "HOP is a multi-tier programming language for the Web 2.0 and the
291 so-called diffuse Web. It is designed for programming interactive web
292 applications in many fields such as multimedia (web galleries, music players,
293 ...), ubiquitous and house automation (SmartPhones, personal appliance),
294 mashups, office (web agendas, mail clients, ...), etc.")
295 (license gpl2+)))
296
297 (define-public chicken
298 (package
299 (name "chicken")
300 (version "4.9.0.1")
301 (source (origin
302 (method url-fetch)
303 (uri (string-append "http://code.call-cc.org/releases/4.9.0/chicken-"
304 version ".tar.gz"))
305 (sha256
306 (base32
307 "0598mar1qswfd8hva9nqs88zjn02lzkqd8fzdd21dz1nki1prpq4"))))
308 (build-system gnu-build-system)
309 (arguments
310 `(#:modules ((guix build gnu-build-system)
311 (guix build utils)
312 (srfi srfi-1))
313
314 ;; No `configure' script; run "make check" after "make install" as
315 ;; prescribed by README.
316 #:phases (alist-cons-after
317 'install 'check
318 (assoc-ref %standard-phases 'check)
319 (fold alist-delete %standard-phases
320 '(configure check)))
321
322 #:make-flags (let ((out (assoc-ref %outputs "out")))
323 (list "PLATFORM=linux"
324 (string-append "PREFIX=" out)
325 (string-append "VARDIR=" out "/var/lib")))
326
327 ;; Parallel builds are not supported, as noted in README.
328 #:parallel-build? #f))
329 (home-page "http://www.call-cc.org/")
330 (synopsis "R5RS Scheme implementation that compiles native code via C")
331 (description
332 "CHICKEN is a compiler for the Scheme programming language. CHICKEN
333 produces portable and efficient C, supports almost all of the R5RS Scheme
334 language standard, and includes many enhancements and extensions.")
335 (license bsd-3)))
336
337 (define-public scheme48
338 (package
339 (name "scheme48")
340 (version "1.9")
341 (source (origin
342 (method url-fetch)
343 (uri (string-append "http://s48.org/" version
344 "/scheme48-" version ".tgz"))
345 (sha256
346 (base32
347 "0rw2lz5xgld0klvld292ds6hvfk5l12vskzgf1hhwjdpa38r3fnw"))
348 (patches (list (search-patch "scheme48-tests.patch")))))
349 (build-system gnu-build-system)
350 (home-page "http://s48.org/")
351 (synopsis "Scheme implementation using a bytecode interpreter")
352 (description
353 "Scheme 48 is an implementation of Scheme based on a byte-code
354 interpreter and is designed to be used as a testbed for experiments in
355 implementation techniques and as an expository tool.")
356
357 ;; Most files are BSD-3; see COPYING for the few exceptions.
358 (license bsd-3)))
359
360 (define-public racket
361 (package
362 (name "racket")
363 (version "6.1.1")
364 (source (origin
365 (method url-fetch)
366 (uri (list (string-append "http://mirror.racket-lang.org/installers/"
367 version "/racket-" version "-src.tgz")
368 (string-append
369 "http://mirror.informatik.uni-tuebingen.de/mirror/racket/"
370 version "/racket/racket-" version "-src-unix.tgz")))
371 (sha256
372 (base32
373 "0xfsfdqkngz0xw2lqmc7bsznwx25cw91l9fjhp7abrr05m96j0h9"))))
374 (build-system gnu-build-system)
375 (arguments
376 '(#:phases
377 (let* ((gui-libs
378 (lambda (inputs)
379 (define (lib input)
380 (string-append (assoc-ref inputs input) "/lib"))
381
382 (list (lib "glib")
383 (lib "cairo")
384 (lib "pango")
385 (lib "libjpeg")
386 (lib "gtk")
387 (lib "gdk-pixbuf")
388 (lib "fontconfig")
389 (lib "sqlite"))))) ;to build the doc
390 (alist-cons-before
391 'configure 'pre-configure
392 (lambda* (#:key inputs #:allow-other-keys)
393 (chdir "src")
394
395 ;; The GUI libs are dynamically opened through the FFI, so they
396 ;; must be in the loader's search path.
397 (setenv "LD_LIBRARY_PATH" (string-join (gui-libs inputs) ":")))
398 (alist-cons-after
399 'unpack 'patch-/bin/sh
400 (lambda _
401 (substitute* "collects/racket/system.rkt"
402 (("/bin/sh") (which "sh"))))
403 (alist-cons-after
404 'install 'wrap-programs
405 (lambda* (#:key inputs outputs #:allow-other-keys)
406 (let ((out (assoc-ref outputs "out")))
407 (define (wrap prog)
408 (wrap-program prog
409 `("LD_LIBRARY_PATH" ":" prefix
410 ,(gui-libs inputs))))
411
412 (with-directory-excursion (string-append out "/bin")
413 (for-each wrap
414 (list "gracket" "drracket" "slideshow" "mred"))
415 #t)))
416 %standard-phases))))
417 #:tests? #f ; XXX: how to run them?
418 ))
419 (inputs `(("libffi" ,libffi)
420 ("glib" ,glib) ; for DrRacket
421 ("cairo" ,cairo)
422 ("pango" ,pango)
423 ("libjpeg" ,libjpeg-8)
424 ("fontconfig" ,fontconfig)
425 ("gdk-pixbuf" ,gdk-pixbuf)
426 ("gtk" ,gtk+-2)
427 ("sqlite" ,sqlite))) ;needed to build the doc
428 (home-page "http://racket-lang.org")
429 (synopsis "Implementation of Scheme and related languages")
430 (description
431 "Racket is an implementation of the Scheme programming language (R5RS and
432 R6RS) and related languages, such as Typed Racket. It features a compiler and
433 a virtual machine with just-in-time native compilation, as well as a large set
434 of libraries.")
435 (license lgpl2.0+)))
436
437 (define-public gambit-c
438 (package
439 (name "gambit-c")
440 (version "4.7.4")
441 (source
442 (origin
443 (method url-fetch)
444 (uri (string-append
445 "http://www.iro.umontreal.ca/~gambit/download/gambit/v"
446 (version-major+minor version) "/source/gambc-v"
447 (string-map (lambda (c) (if (char=? c #\.) #\_ c)) version)
448 ".tgz"))
449 (sha256
450 (base32 "0y2pklh4k65yrmxv63ass76xckrk9wqimbdad2gha35v2mi7blhs"))))
451 (build-system gnu-build-system)
452 (arguments
453 '(#:configure-flags
454 ;; According to the ./configure script, this makes the build slower and
455 ;; use >= 1 GB memory, but makes Gambit much faster.
456 '("--enable-single-host")
457 #:phases
458 (alist-cons-before
459 'check 'fix-tests
460 (lambda _
461 (substitute* '("tests/makefile")
462 ;; '-:' is how run-time options are set. 'tl' sets some terminal
463 ;; option, which makes it fail in our build environment. It
464 ;; recommends using 'd-' as a solution, which sets the REPL
465 ;; interaction channel to stdin/stdout.
466 (("gsi -:tl") "gsi -:d-,tl")))
467 %standard-phases)))
468 (home-page "http://www.iro.umontreal.ca/~gambit/")
469 (synopsis "Efficient Scheme interpreter and compiler")
470 (description
471 "Gambit consists of two main programs: gsi, the Gambit Scheme
472 interpreter, and gsc, the Gambit Scheme compiler. The interpreter contains
473 the complete execution and debugging environment. The compiler is the
474 interpreter extended with the capability of generating executable files. The
475 compiler can produce standalone executables or compiled modules which can be
476 loaded at run time. Interpreted code and compiled code can be freely
477 mixed.")
478 ;; Dual license.
479 (license (list lgpl2.1+ asl2.0))))
480
481 (define-public chibi-scheme
482 (package
483 (name "chibi-scheme")
484 (version "0.7.2")
485 (source
486 (origin
487 (method url-fetch)
488 (uri (string-append
489 "http://abrek.synthcode.com/chibi-scheme-" version ".tgz"))
490 (sha256
491 (base32 "0h6k2gdb4xk2pzhdipffcg2w3kfr4zh1va556k1hvng2did6prds"))))
492 (build-system gnu-build-system)
493 (arguments
494 `(#:phases
495 (alist-delete
496 'configure
497 (alist-cons-before
498 'build 'set-cc
499 (lambda _
500 (setenv "CC" "gcc"))
501 %standard-phases))
502 #:make-flags (let ((out (assoc-ref %outputs "out")))
503 (list (string-append "PREFIX=" out)
504 (string-append "LDFLAGS=-Wl,-rpath=" out "/lib")))
505 #:test-target "test"))
506 (home-page "https://code.google.com/p/chibi-scheme/")
507 (synopsis "Small embeddable Scheme implementation")
508 (description
509 "Chibi-Scheme is a very small library with no external dependencies
510 intended for use as an extension and scripting language in C programs. In
511 addition to support for lightweight VM-based threads, each VM itself runs in
512 an isolated heap allowing multiple VMs to run simultaneously in different OS
513 threads.")
514 (license bsd-3)))