1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
4 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
40 (define (mit-scheme-source-directory system version)
41 (string-append "mit-scheme-"
42 (if (or (string-prefix? "x86_64" system)
43 (string-prefix? "i686" system))
48 (define-public mit-scheme
52 (source #f) ; see below
53 (build-system gnu-build-system)
55 `(#:tests? #f ; no "check" target
59 (lambda* (#:key inputs #:allow-other-keys)
60 (and (zero? (system* "tar" "xzvf"
61 (assoc-ref inputs "source")))
62 (chdir ,(mit-scheme-source-directory (%current-system)
65 ;; Delete these dangling symlinks since they break
68 (append '("src/lib/shim-config.scm")
69 (find-files "src/lib/lib" "\\.so$")
70 (find-files "src/lib" "^liarc-")
71 (find-files "src/compiler" "^make\\.")))
76 (lambda* (#:key system outputs #:allow-other-keys)
77 (let ((out (assoc-ref outputs "out")))
78 (if (or (string-prefix? "x86_64" system)
79 (string-prefix? "i686" system))
80 (zero? (system* "make" "compile-microcode"))
81 (zero? (system* "./etc/make-liarc.sh"
82 (string-append "--prefix=" out))))))
85 `(;; TODO: Build doc when TeX Live is available.
86 ;; ("automake" ,automake)
87 ;; ("texlive-core" ,texlive-core)
93 ;; MIT/GNU Scheme is not bootstrappable, so it's recommended to
94 ;; compile from the architecture-specific tarballs, which contain
95 ;; pre-built binaries. It leads to more efficient code than when
96 ;; building the tarball that contains generated C code instead of
100 (uri (string-append "mirror://gnu/mit-scheme/stable.pkg/"
101 version "/mit-scheme-"
102 (match (%current-system)
104 (string-append version "-x86-64"))
106 (string-append version "-i386"))
108 (string-append "c-" version)))
111 (match (%current-system)
114 "1skzxxhr0iq96bf0j5m7mvf3i4sppfyfa6gpqn34mwgkw1fx8274"))
117 "1fmlpnhf5a75db93phajh4ysbdgrgl72v45lk3kznriprl0a7jc6"))
120 "0w5ib5vsidihb4hb6fma3sp596ykr8izagm57axvgd6lqzwicsjg"))))))))
122 ;; Fails to build on MIPS, see <http://bugs.gnu.org/18221>.
123 (supported-systems (delete "mips64el-linux" %supported-systems))
125 (home-page "http://www.gnu.org/software/mit-scheme/")
126 (synopsis "Scheme implementation with integrated editor and debugger")
128 "GNU/MIT Scheme is an implementation of the Scheme programming
129 language. It provides an interpreter, a compiler and a debugger. It also
130 features an integrated Emacs-like editor and a large runtime library.")
133 (define-public bigloo
139 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Bigloo/bigloo"
143 "170q7nh08n4v20xl81fxb0xcdxphqqacfa643hsa8i2ar6pki04c"))
144 (patches (list (search-patch "bigloo-gc-shebangs.patch")))))
145 (build-system gnu-build-system)
147 `(#:test-target "test"
148 #:phases (alist-replace
150 (lambda* (#:key outputs #:allow-other-keys)
152 (substitute* "configure"
154 (string-append "shell=" (which "bash") "\n")))
156 ;; Since libgc's pthread redirects are used, we end up
157 ;; using libgc symbols, so we must link against it.
158 ;; Reported on 2013-06-25.
159 (substitute* "api/pthread/src/Makefile"
160 (("^EXTRALIBS[[:blank:]]*=(.*)$" _ value)
161 (string-append "EXTRALIBS = "
162 (string-trim-right value)
163 " -l$(GCLIB)_fth-$(RELEASE)"
164 " -Wl,-rpath=" (assoc-ref outputs "out")
165 "/lib/bigloo/" ,version)))
167 ;; Those variables are used by libgc's `configure'.
168 (setenv "SHELL" (which "sh"))
169 (setenv "CONFIG_SHELL" (which "sh"))
171 ;; ... but they turned out to be overridden later, so work
173 (substitute* (find-files "gc" "^configure-gc")
175 (string-append "sh=" (which "sh"))))
177 ;; The `configure' script doesn't understand options
178 ;; of those of Autoconf.
179 (let ((out (assoc-ref outputs "out")))
181 (system* "./configure"
182 (string-append "--prefix=" out)
183 ;; FIXME: Currently fails, see
184 ;; <http://article.gmane.org/gmane.lisp.scheme.bigloo/6126>.
185 ;; "--customgc=no" ; use our libgc
186 (string-append"--mv=" (which "mv"))
187 (string-append "--rm=" (which "rm"))))))
189 'install 'install-emacs-modes
190 (lambda* (#:key outputs #:allow-other-keys)
191 (let* ((out (assoc-ref outputs "out"))
192 (dir (string-append out "/share/emacs/site-lisp")))
193 (zero? (system* "make" "-C" "bmacs" "all" "install"
194 (string-append "EMACSBRAND=emacs24")
195 (string-append "EMACSDIR=" dir)))))
200 ;; Optional APIs for which Bigloo has bindings.
202 ("libphidget" ,libphidget)))
204 `(("pkg-config" ,pkg-config)))
206 `(("gmp" ,gmp))) ; bigloo.h refers to gmp.h
207 (home-page "http://www-sop.inria.fr/indes/fp/Bigloo/")
208 (synopsis "Efficient Scheme compiler")
210 "Bigloo is a Scheme implementation devoted to one goal: enabling
211 Scheme based programming style where C(++) is usually
212 required. Bigloo attempts to make Scheme practical by offering
213 features usually presented by traditional programming languages
214 but not offered by Scheme and functional programming. Bigloo
215 compiles Scheme modules. It delivers small and fast stand alone
216 binary executables. Bigloo enables full connections between
217 Scheme and C programs and between Scheme and Java programs.")
226 (uri (string-append "ftp://ftp-sop.inria.fr/indes/fp/Hop/hop-"
230 "1v2r4ga58kk1sx0frn8qa8ccmjpic9csqzpk499wc95y9c4b1wy3"))
231 (patches (list (search-patch "hop-bigloo-4.0b.patch")))))
232 (build-system gnu-build-system)
237 (lambda* (#:key inputs outputs #:allow-other-keys)
238 (let ((out (assoc-ref outputs "out")))
240 (system* "./configure"
241 (string-append "--prefix=" out)))))
244 (lambda* (#:key outputs #:allow-other-keys)
245 ;; Patch the RPATH of every installed library to point to $out/lib
246 ;; instead of $TMPDIR. Note that "patchelf --set-rpath" produces
247 ;; invalid binaries when used before stripping.
248 (let ((out (assoc-ref outputs "out"))
251 (let* ((in (open-pipe* OPEN_READ "patchelf"
252 "--print-rpath" lib))
253 (rpath (read-line in)))
254 (and (zero? (close-pipe in))
255 (let ((rpath* (regexp-substitute/global
256 #f (regexp-quote tmpdir) rpath
258 (or (equal? rpath rpath*)
260 (format #t "~a: changing RPATH from `~a' to `~a'~%"
263 (system* "patchelf" "--set-rpath"
265 (append (find-files (string-append out "/bin")
267 (find-files (string-append out "/lib")
270 #:tests? #f ; no test suite
271 #:modules ((guix build gnu-build-system)
277 (inputs `(("bigloo" ,bigloo)
279 ("patchelf" ,patchelf)))
280 (home-page "http://hop.inria.fr/")
281 (synopsis "Multi-tier programming language for the Web 2.0")
283 "HOP is a multi-tier programming language for the Web 2.0 and the
284 so-called diffuse Web. It is designed for programming interactive web
285 applications in many fields such as multimedia (web galleries, music players,
286 ...), ubiquitous and house automation (SmartPhones, personal appliance),
287 mashups, office (web agendas, mail clients, ...), etc.")
290 (define-public chicken
296 (uri (string-append "http://code.call-cc.org/releases/4.8.0/chicken-"
300 "1hwrnc2dhgbnz3mlpcb4qvg76kwsfzqylw24gxyy91jmygk1853a"))))
301 (build-system gnu-build-system)
303 `(#:modules ((guix build gnu-build-system)
307 ;; No `configure' script; run "make check" after "make install" as
308 ;; prescribed by README.
309 #:phases (alist-cons-after
311 (assoc-ref %standard-phases 'check)
312 (fold alist-delete %standard-phases
315 #:make-flags (let ((out (assoc-ref %outputs "out")))
316 (list "PLATFORM=linux"
317 (string-append "PREFIX=" out)
318 (string-append "VARDIR=" out "/var/lib")))
320 ;; Parallel builds are not supported, as noted in README.
321 #:parallel-build? #f))
322 (home-page "http://www.call-cc.org/")
323 (synopsis "R5RS Scheme implementation that compiles native code via C")
325 "CHICKEN is a compiler for the Scheme programming language. CHICKEN
326 produces portable and efficient C, supports almost all of the R5RS Scheme
327 language standard, and includes many enhancements and extensions.")
330 (define-public scheme48
336 (uri (string-append "http://s48.org/" version
337 "/scheme48-" version ".tgz"))
340 "0rw2lz5xgld0klvld292ds6hvfk5l12vskzgf1hhwjdpa38r3fnw"))
341 (patches (list (search-patch "scheme48-tests.patch")))))
342 (build-system gnu-build-system)
343 (home-page "http://s48.org/")
344 (synopsis "Scheme implementation using a bytecode interpreter")
346 "Scheme 48 is an implementation of Scheme based on a byte-code
347 interpreter and is designed to be used as a testbed for experiments in
348 implementation techniques and as an expository tool.")
350 ;; Most files are BSD-3; see COPYING for the few exceptions.
353 (define-public racket
359 (uri (list (string-append "http://download.racket-lang.org/installers/"
360 version "/racket/racket-" version
363 "http://mirror.informatik.uni-tuebingen.de/mirror/racket/"
364 version "/racket/racket-" version "-src-unix.tgz")))
366 ;; XXX: Used to be 1xhnx3yd74zrvn6sfcqmk57kxj51cwvm660dwiaxr1qxnm5lq0v7.
367 (base32 "0yrdmpdvzf092869y6zjjjxl6j2kypgiv7qrfkv7lj8w01pbh7sd"))))
368 (build-system gnu-build-system)
374 (string-append (assoc-ref inputs input) "/lib"))
381 (lib "gdk-pixbuf")))))
383 'configure 'pre-configure
384 (lambda* (#:key inputs #:allow-other-keys)
387 ;; The GUI libs are dynamically opened through the FFI, so they
388 ;; must be in the loader's search path.
389 (setenv "LD_LIBRARY_PATH" (string-join (gui-libs inputs) ":")))
391 'unpack 'patch-/bin/sh
393 (substitute* "collects/racket/system.rkt"
394 (("/bin/sh") (which "sh"))))
396 'install 'wrap-programs
397 (lambda* (#:key inputs outputs #:allow-other-keys)
398 (let ((out (assoc-ref outputs "out")))
401 `("LD_LIBRARY_PATH" ":" prefix
402 ,(gui-libs inputs))))
404 (with-directory-excursion (string-append out "/bin")
406 (list "gracket" "drracket" "slideshow" "mred"))
409 #:tests? #f ; XXX: how to run them?
411 (inputs `(("libffi" ,libffi)
412 ("glib" ,glib) ; for DrRacket
415 ("libjpeg" ,libjpeg-8)
416 ("gdk-pixbuf" ,gdk-pixbuf)
418 (home-page "http://racket-lang.org")
419 (synopsis "Implementation of Scheme and related languages")
421 "Racket is an implementation of the Scheme programming language (R5RS and
422 R6RS) and related languages, such as Typed Racket. It features a compiler and
423 a virtual machine with just-in-time native compilation, as well as a large set
427 ;; Fails to build on MIPS with "address or size is not OS PAGE ALIGNED".
428 ;; See <http://hydra.gnu.org/build/121775>.
429 (supported-systems (delete "mips64el-linux" %supported-systems))))