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