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>
5 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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 which)
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))
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))
52 (define-public mit-scheme
56 (source #f) ; see below
57 (build-system gnu-build-system)
59 `(#:tests? #f ; no "check" target
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)
69 ;; Delete these dangling symlinks since they break
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\\.")))
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))))))
89 `(;; TODO: Build doc when TeX Live is available.
90 ;; ("automake" ,automake)
91 ;; ("texlive-core" ,texlive-core)
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
104 (uri (string-append "mirror://gnu/mit-scheme/stable.pkg/"
105 version "/mit-scheme-"
106 (match (%current-system)
108 (string-append version "-x86-64"))
110 (string-append version "-i386"))
112 (string-append "c-" version)))
115 (match (%current-system)
118 "1skzxxhr0iq96bf0j5m7mvf3i4sppfyfa6gpqn34mwgkw1fx8274"))
121 "1fmlpnhf5a75db93phajh4ysbdgrgl72v45lk3kznriprl0a7jc6"))
124 "0w5ib5vsidihb4hb6fma3sp596ykr8izagm57axvgd6lqzwicsjg"))))))))
126 ;; Fails to build on MIPS, see <http://bugs.gnu.org/18221>.
127 (supported-systems (delete "mips64el-linux" %supported-systems))
129 (home-page "http://www.gnu.org/software/mit-scheme/")
130 (synopsis "A Scheme implementation with integrated editor and debugger")
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.")
137 (define-public bigloo
143 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Bigloo/bigloo"
147 "170q7nh08n4v20xl81fxb0xcdxphqqacfa643hsa8i2ar6pki04c"))
148 (patches (list (search-patch "bigloo-gc-shebangs.patch")))))
149 (build-system gnu-build-system)
151 `(#:test-target "test"
152 #:phases (alist-replace
154 (lambda* (#:key outputs #:allow-other-keys)
156 (substitute* "configure"
158 (string-append "shell=" (which "bash") "\n")))
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)))
171 ;; Those variables are used by libgc's `configure'.
172 (setenv "SHELL" (which "sh"))
173 (setenv "CONFIG_SHELL" (which "sh"))
175 ;; ... but they turned out to be overridden later, so work
177 (substitute* (find-files "gc" "^configure-gc")
179 (string-append "sh=" (which "sh"))))
181 ;; The `configure' script doesn't understand options
182 ;; of those of Autoconf.
183 (let ((out (assoc-ref outputs "out")))
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"))))))
193 'install 'install-emacs-modes
194 (lambda* (#:key outputs #:allow-other-keys)
195 (let* ((out (assoc-ref outputs "out"))
196 (dir (string-append out "/share/emacs/site-lisp")))
197 (zero? (system* "make" "-C" "bmacs" "all" "install"
198 (string-append "EMACSBRAND=emacs24")
199 (string-append "EMACSDIR=" dir)))))
204 ;; Optional APIs for which Bigloo has bindings.
206 ("libphidget" ,libphidget)))
208 `(("pkg-config" ,pkg-config)))
210 `(("gmp" ,gmp))) ; bigloo.h refers to gmp.h
211 (home-page "http://www-sop.inria.fr/indes/fp/Bigloo/")
212 (synopsis "Efficient Scheme compiler")
214 "Bigloo is a Scheme implementation devoted to one goal: enabling
215 Scheme based programming style where C(++) is usually
216 required. Bigloo attempts to make Scheme practical by offering
217 features usually presented by traditional programming languages
218 but not offered by Scheme and functional programming. Bigloo
219 compiles Scheme modules. It delivers small and fast stand alone
220 binary executables. Bigloo enables full connections between
221 Scheme and C programs and between Scheme and Java programs.")
230 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Hop/hop-"
234 "1v2r4ga58kk1sx0frn8qa8ccmjpic9csqzpk499wc95y9c4b1wy3"))
235 (patches (list (search-patch "hop-bigloo-4.0b.patch")))))
236 (build-system gnu-build-system)
241 (lambda* (#:key inputs outputs #:allow-other-keys)
242 (let ((out (assoc-ref outputs "out")))
244 (system* "./configure"
245 (string-append "--prefix=" out)))))
248 (lambda* (#:key outputs #:allow-other-keys)
249 ;; Patch the RPATH of every installed library to point to $out/lib
250 ;; instead of $TMPDIR. Note that "patchelf --set-rpath" produces
251 ;; invalid binaries when used before stripping.
252 (let ((out (assoc-ref outputs "out"))
255 (let* ((in (open-pipe* OPEN_READ "patchelf"
256 "--print-rpath" lib))
257 (rpath (read-line in)))
258 (and (zero? (close-pipe in))
259 (let ((rpath* (regexp-substitute/global
260 #f (regexp-quote tmpdir) rpath
262 (or (equal? rpath rpath*)
264 (format #t "~a: changing RPATH from `~a' to `~a'~%"
267 (system* "patchelf" "--set-rpath"
269 (append (find-files (string-append out "/bin")
271 (find-files (string-append out "/lib")
274 #:tests? #f ; no test suite
275 #:modules ((guix build gnu-build-system)
281 (inputs `(("bigloo" ,bigloo)
283 ("patchelf" ,patchelf)))
284 (home-page "http://hop.inria.fr/")
285 (synopsis "Multi-tier programming language for the Web 2.0")
287 "HOP is a multi-tier programming language for the Web 2.0 and the
288 so-called diffuse Web. It is designed for programming interactive web
289 applications in many fields such as multimedia (web galleries, music players,
290 ...), ubiquitous and house automation (SmartPhones, personal appliance),
291 mashups, office (web agendas, mail clients, ...), etc.")
294 (define-public chicken
300 (uri (string-append "http://code.call-cc.org/releases/4.9.0/chicken-"
304 "0598mar1qswfd8hva9nqs88zjn02lzkqd8fzdd21dz1nki1prpq4"))))
305 (build-system gnu-build-system)
307 `(#:modules ((guix build gnu-build-system)
311 ;; No `configure' script; run "make check" after "make install" as
312 ;; prescribed by README.
313 #:phases (alist-cons-after
315 (assoc-ref %standard-phases 'check)
316 (fold alist-delete %standard-phases
319 #:make-flags (let ((out (assoc-ref %outputs "out")))
320 (list "PLATFORM=linux"
321 (string-append "PREFIX=" out)
322 (string-append "VARDIR=" out "/var/lib")))
324 ;; Parallel builds are not supported, as noted in README.
325 #:parallel-build? #f))
326 (home-page "http://www.call-cc.org/")
327 (synopsis "R5RS Scheme implementation that compiles native code via C")
329 "CHICKEN is a compiler for the Scheme programming language. CHICKEN
330 produces portable and efficient C, supports almost all of the R5RS Scheme
331 language standard, and includes many enhancements and extensions.")
334 (define-public scheme48
340 (uri (string-append "http://s48.org/" version
341 "/scheme48-" version ".tgz"))
344 "0rw2lz5xgld0klvld292ds6hvfk5l12vskzgf1hhwjdpa38r3fnw"))
345 (patches (list (search-patch "scheme48-tests.patch")))))
346 (build-system gnu-build-system)
347 (home-page "http://s48.org/")
348 (synopsis "Scheme implementation using a bytecode interpreter")
350 "Scheme 48 is an implementation of Scheme based on a byte-code
351 interpreter and is designed to be used as a testbed for experiments in
352 implementation techniques and as an expository tool.")
354 ;; Most files are BSD-3; see COPYING for the few exceptions.
357 (define-public racket
363 (uri (list (string-append "http://mirror.racket-lang.org/installers/"
364 version "/racket-" version "-src.tgz")
366 "http://mirror.informatik.uni-tuebingen.de/mirror/racket/"
367 version "/racket/racket-" version "-src-unix.tgz")))
370 "0xfsfdqkngz0xw2lqmc7bsznwx25cw91l9fjhp7abrr05m96j0h9"))))
371 (build-system gnu-build-system)
377 (string-append (assoc-ref inputs input) "/lib"))
386 (lib "sqlite"))))) ;to build the doc
388 'configure 'pre-configure
389 (lambda* (#:key inputs #:allow-other-keys)
392 ;; The GUI libs are dynamically opened through the FFI, so they
393 ;; must be in the loader's search path.
394 (setenv "LD_LIBRARY_PATH" (string-join (gui-libs inputs) ":")))
396 'unpack 'patch-/bin/sh
398 (substitute* "collects/racket/system.rkt"
399 (("/bin/sh") (which "sh"))))
401 'install 'wrap-programs
402 (lambda* (#:key inputs outputs #:allow-other-keys)
403 (let ((out (assoc-ref outputs "out")))
406 `("LD_LIBRARY_PATH" ":" prefix
407 ,(gui-libs inputs))))
409 (with-directory-excursion (string-append out "/bin")
411 (list "gracket" "drracket" "slideshow" "mred"))
414 #:tests? #f ; XXX: how to run them?
416 (inputs `(("libffi" ,libffi)
417 ("glib" ,glib) ; for DrRacket
420 ("libjpeg" ,libjpeg-8)
421 ("fontconfig" ,fontconfig)
422 ("gdk-pixbuf" ,gdk-pixbuf)
424 ("sqlite" ,sqlite))) ;needed to build the doc
425 (home-page "http://racket-lang.org")
426 (synopsis "Implementation of Scheme and related languages")
428 "Racket is an implementation of the Scheme programming language (R5RS and
429 R6RS) and related languages, such as Typed Racket. It features a compiler and
430 a virtual machine with just-in-time native compilation, as well as a large set
434 (define-public gambit-c
442 "http://www.iro.umontreal.ca/~gambit/download/gambit/v"
443 (version-major+minor version) "/source/gambc-v"
444 (string-map (lambda (c) (if (char=? c #\.) #\_ c)) version)
447 (base32 "0y2pklh4k65yrmxv63ass76xckrk9wqimbdad2gha35v2mi7blhs"))))
448 (build-system gnu-build-system)
451 ;; According to the ./configure script, this makes the build slower and
452 ;; use >= 1 GB memory, but makes Gambit much faster.
453 '("--enable-single-host")
458 (substitute* '("tests/makefile")
459 ;; '-:' is how run-time options are set. 'tl' sets some terminal
460 ;; option, which makes it fail in our build environment. It
461 ;; recommends using 'd-' as a solution, which sets the REPL
462 ;; interaction channel to stdin/stdout.
463 (("gsi -:tl") "gsi -:d-,tl")))
465 (home-page "http://www.iro.umontreal.ca/~gambit/")
466 (synopsis "Efficient Scheme interpreter and compiler")
468 "Gambit consists of two main programs: gsi, the Gambit Scheme
469 interpreter, and gsc, the Gambit Scheme compiler. The interpreter contains
470 the complete execution and debugging environment. The compiler is the
471 interpreter extended with the capability of generating executable files. The
472 compiler can produce standalone executables or compiled modules which can be
473 loaded at run time. Interpreted code and compiled code can be freely
476 (license (list lgpl2.1+ asl2.0))))
478 (define-public chibi-scheme
480 (name "chibi-scheme")
486 "http://abrek.synthcode.com/chibi-scheme-" version ".tgz"))
488 (base32 "0h6k2gdb4xk2pzhdipffcg2w3kfr4zh1va556k1hvng2did6prds"))))
489 (build-system gnu-build-system)
499 #:make-flags (let ((out (assoc-ref %outputs "out")))
500 (list (string-append "PREFIX=" out)
501 (string-append "LDFLAGS=-Wl,-rpath=" out "/lib")))
502 #:test-target "test"))
503 (home-page "https://code.google.com/p/chibi-scheme/")
504 (synopsis "Small embeddable Scheme implementation")
506 "Chibi-Scheme is a very small library with no external dependencies
507 intended for use as an extension and scripting language in C programs. In
508 addition to support for lightweight VM-based threads, each VM itself runs in
509 an isolated heap allowing multiple VMs to run simultaneously in different OS